mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-13 23:23:47 +01:00
package mzteinit for nix
This commit is contained in:
parent
28134cfe4e
commit
4d713eef83
3 changed files with 167 additions and 3 deletions
108
flake.lock
108
flake.lock
|
@ -1,6 +1,75 @@
|
|||
{
|
||||
"nodes": {
|
||||
"confgen": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-zig-0-12": "nixpkgs-zig-0-12",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710099294,
|
||||
"narHash": "sha256-u4TQiW0IODAjGRGy1igEQsaZ6P/xI+RVyzZqrCR4vfI=",
|
||||
"ref": "a6fbe3c79eeed1dbda04a0be501fa2b95450a03f",
|
||||
"rev": "a6fbe3c79eeed1dbda04a0be501fa2b95450a03f",
|
||||
"revCount": 43,
|
||||
"type": "git",
|
||||
"url": "https://git.mzte.de/LordMZTE/confgen"
|
||||
},
|
||||
"original": {
|
||||
"rev": "a6fbe3c79eeed1dbda04a0be501fa2b95450a03f",
|
||||
"type": "git",
|
||||
"url": "https://git.mzte.de/LordMZTE/confgen"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709961763,
|
||||
"narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-zig-0-12": {
|
||||
"locked": {
|
||||
"lastModified": 1710092316,
|
||||
"narHash": "sha256-96pThxPueCevkteIFsx2lMDcCjDrQtBfEbIJR2g+C5Q=",
|
||||
"owner": "vancluever",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "add3752a30c1d9caa7614208afcb8e5502ce4407",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "vancluever",
|
||||
"ref": "vancluever-zig-0-12",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-zig-0-12_2": {
|
||||
"locked": {
|
||||
"lastModified": 1710092316,
|
||||
"narHash": "sha256-96pThxPueCevkteIFsx2lMDcCjDrQtBfEbIJR2g+C5Q=",
|
||||
"owner": "vancluever",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "add3752a30c1d9caa7614208afcb8e5502ce4407",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "vancluever",
|
||||
"ref": "vancluever-zig-0-12",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1709703039,
|
||||
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
|
||||
|
@ -18,8 +87,10 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"utils": "utils"
|
||||
"confgen": "confgen",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-zig-0-12": "nixpkgs-zig-0-12_2",
|
||||
"utils": "utils_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
@ -37,6 +108,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
@ -54,6 +140,24 @@
|
|||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709126324,
|
||||
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
15
flake.nix
15
flake.nix
|
@ -2,14 +2,27 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
confgen.url = "git+https://git.mzte.de/LordMZTE/confgen?rev=a6fbe3c79eeed1dbda04a0be501fa2b95450a03f";
|
||||
nixpkgs-zig-0-12.url = "github:vancluever/nixpkgs/vancluever-zig-0-12";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, utils
|
||||
, confgen
|
||||
, nixpkgs-zig-0-12
|
||||
}: utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
flakePkg = ref: (builtins.getFlake ref).packages.${system}.default;
|
||||
in
|
||||
{
|
||||
packages.mzteinit = import ./scripts/mzteinit/package.nix {
|
||||
inherit pkgs;
|
||||
confgen = confgen.packages.${system};
|
||||
zig_0_12 = nixpkgs-zig-0-12.legacyPackages.${system}.zig_0_12;
|
||||
};
|
||||
# Local user nix env
|
||||
packages.mzte-nix = pkgs.symlinkJoin {
|
||||
name = "mzte-nix";
|
||||
|
|
47
scripts/mzteinit/package.nix
Normal file
47
scripts/mzteinit/package.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ pkgs, confgen, zig_0_12 }:
|
||||
let
|
||||
deps = pkgs.linkFarm "zig-packages" [
|
||||
# ansi-term
|
||||
{
|
||||
name = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7";
|
||||
path = pkgs.fetchgit {
|
||||
url = "https://github.com/LordMZTE/ansi-term.git";
|
||||
rev = "73c03175068679685535111dbea72cade075719e";
|
||||
hash = "sha256-YeCZPUNciJz141HSHk4kBIfVYW/JqLflkKCjRHhIORk=";
|
||||
};
|
||||
}
|
||||
];
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "mzteinit";
|
||||
# TODO: WTF
|
||||
src = ./../..;
|
||||
dontBuild = true;
|
||||
dontFixup = true;
|
||||
|
||||
configurePhase = ''
|
||||
mkdir cgout
|
||||
# TODO: WTF
|
||||
sed -i 's#/usr/share/lua/5.4/fennel.lua#${pkgs.luajitPackages.fennel}/share/lua/5.1/fennel.lua#' confgen.lua
|
||||
${confgen.default}/bin/confgen --json-opt confgen.lua > cgout/opts.json
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
cd scripts/mzteinit
|
||||
export ZIG_LOCAL_CACHE_DIR=$(pwd)/zig-cache
|
||||
export ZIG_GLOBAL_CACHE_DIR=$ZIG_LOCAL_CACHE_DIR
|
||||
mkdir -p $ZIG_GLOBAL_CACHE_DIR
|
||||
ln -s ${deps} $ZIG_GLOBAL_CACHE_DIR/p
|
||||
cd ../..
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cd scripts/mzteinit
|
||||
runHook preBuild
|
||||
${zig_0_12}/bin/zig build install --prefix $out
|
||||
runHook postBuild
|
||||
cd ../..
|
||||
'';
|
||||
|
||||
passthru.shellPath = "/bin/mzteinit";
|
||||
}
|
Loading…
Reference in a new issue