Add flake support
Have to use it with `nix run '.?submodules=1'`, unfortunately. Might be able to remove that requirement by using the following, but I don't know how it interacts with `gitignoreSource`: ``` fetchGit { url = ./.; submodules = true; } ```
This commit is contained in:
parent
949e4fe525
commit
ac8600cd8c
85
flake.lock
Normal file
85
flake.lock
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1629481132,
|
||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1657706534,
|
||||
"narHash": "sha256-5jIzNHKtDu06mA325K/5CshUVb5r7sSmnRiula6Gr7o=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "f840a659d57e53fa751a9248b17149fd0cf2a221",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1658119717,
|
||||
"narHash": "sha256-4upOZIQQ7Bc4CprqnHsKnqYfw+arJeAuU+QcpjYBXW0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9eb60f25aff0d2218c848dd4574a0ab5e296cabe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"zig-overlay": "zig-overlay"
|
||||
}
|
||||
},
|
||||
"zig-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1658105291,
|
||||
"narHash": "sha256-3EXG2r5/h/iyzytRqI+tWTP11f1PdaJJ8Hl5QRe95OE=",
|
||||
"owner": "arqv",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "bfd640ef3c9bf8b4cd300af9f79a7ba950823ef5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "arqv",
|
||||
"repo": "zig-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
43
flake.nix
Normal file
43
flake.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
zig-overlay.url = "github:arqv/zig-overlay";
|
||||
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
gitignore.url = "github:hercules-ci/gitignore.nix";
|
||||
gitignore.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {self, nixpkgs, zig-overlay, gitignore }:
|
||||
let
|
||||
inherit (gitignore.lib) gitignoreSource;
|
||||
zls-derivation-fn = (system: nixpkgs.legacyPackages.${system}.stdenvNoCC.mkDerivation {
|
||||
name = "zls";
|
||||
version = "master";
|
||||
src = gitignoreSource ./.;
|
||||
nativeBuildInputs = [
|
||||
zig-overlay.packages.${system}.master.latest
|
||||
];
|
||||
dontConfigure = true;
|
||||
dontInstall = true;
|
||||
buildPhase = ''
|
||||
mkdir -p $out
|
||||
zig build install -Drelease-safe=true -Ddata_version=master --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