Use flake-utils
This commit is contained in:
parent
542f49087e
commit
5b94a7df02
18
flake.lock
18
flake.lock
@ -1,6 +1,21 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1629481132,
|
||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||
@ -53,6 +68,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"zig-overlay": "zig-overlay"
|
||||
@ -60,7 +76,7 @@
|
||||
},
|
||||
"zig-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
|
46
flake.nix
46
flake.nix
@ -7,15 +7,21 @@
|
||||
|
||||
gitignore.url = "github:hercules-ci/gitignore.nix";
|
||||
gitignore.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = {self, nixpkgs, zig-overlay, gitignore }:
|
||||
outputs = {self, nixpkgs, zig-overlay, gitignore, flake-utils }:
|
||||
let
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
inherit (gitignore.lib) gitignoreSource;
|
||||
|
||||
known-folders-fetch = (system: nixpkgs.legacyPackages.${system}.stdenvNoCC.mkDerivation {
|
||||
in flake-utils.lib.eachSystem systems (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
zig = zig-overlay.packages.${system}.master.latest;
|
||||
known-folders = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "known-folders";
|
||||
src = nixpkgs.legacyPackages.${system}.fetchFromGitHub {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ziglibs";
|
||||
repo = "known-folders";
|
||||
rev = "9db1b99219c767d5e24994b1525273fe4031e464";
|
||||
@ -27,20 +33,15 @@
|
||||
mkdir -p $out
|
||||
cp known-folders.zig $out
|
||||
'';
|
||||
});
|
||||
|
||||
zls-derivation-fn = (system: nixpkgs.legacyPackages.${system}.stdenvNoCC.mkDerivation
|
||||
(let known-folders = known-folders-fetch system;
|
||||
in {
|
||||
};
|
||||
in rec {
|
||||
packages.default = packages.zls;
|
||||
packages.zls = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "zls";
|
||||
version = "master";
|
||||
src = gitignoreSource ./.;
|
||||
nativeBuildInputs = [
|
||||
zig-overlay.packages.${system}.master.latest
|
||||
];
|
||||
buildInputs = [
|
||||
known-folders
|
||||
];
|
||||
nativeBuildInputs = [ zig ];
|
||||
buildInputs = [ known-folders ];
|
||||
dontConfigure = true;
|
||||
dontInstall = true;
|
||||
buildPhase = ''
|
||||
@ -48,18 +49,7 @@
|
||||
zig build install -Drelease-safe=true -Ddata_version=master -Dknown-folders=${known-folders}/known-folders.zig --prefix $out
|
||||
'';
|
||||
XDG_CACHE_HOME = ".cache";
|
||||
}));
|
||||
in {
|
||||
packages = rec {
|
||||
x86_64-linux.zls = zls-derivation-fn "x86_64-linux";
|
||||
aarch64-linux.zls = zls-derivation-fn "aarch64-linux";
|
||||
x86_64-darwin.zls = zls-derivation-fn "x86_64-darwin";
|
||||
aarch64-darwin.zls = zls-derivation-fn "aarch64-darwin";
|
||||
|
||||
x86_64-linux.default = x86_64-linux.zls;
|
||||
aarch64-linux.default = aarch64-linux.zls;
|
||||
x86_64-darwin.default = x86_64-darwin.zls;
|
||||
aarch64-darwin.default = aarch64-darwin.zls;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user