Make known-folders a flake input

Simpler than using `fetchFromGitHub`, we can have `nix` manage the
version instead
This commit is contained in:
LeRoyce Pearson 2022-07-19 00:08:04 -06:00
parent 5b94a7df02
commit 5010de46db
2 changed files with 21 additions and 17 deletions

View File

@ -50,6 +50,22 @@
"type": "github" "type": "github"
} }
}, },
"known-folders": {
"flake": false,
"locked": {
"lastModified": 1640092413,
"narHash": "sha256-eqaZxIax8C75L2UwDbVKSUZ7iThm/iWblfoaTfPyHLM=",
"owner": "ziglibs",
"repo": "known-folders",
"rev": "9db1b99219c767d5e24994b1525273fe4031e464",
"type": "github"
},
"original": {
"owner": "ziglibs",
"repo": "known-folders",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1658119717, "lastModified": 1658119717,
@ -70,6 +86,7 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"gitignore": "gitignore", "gitignore": "gitignore",
"known-folders": "known-folders",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"zig-overlay": "zig-overlay" "zig-overlay": "zig-overlay"
} }

View File

@ -9,9 +9,12 @@
gitignore.inputs.nixpkgs.follows = "nixpkgs"; gitignore.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
known-folders.url = "github:ziglibs/known-folders";
known-folders.flake = false;
}; };
outputs = {self, nixpkgs, zig-overlay, gitignore, flake-utils }: outputs = {self, nixpkgs, zig-overlay, gitignore, flake-utils, known-folders }:
let let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
inherit (gitignore.lib) gitignoreSource; inherit (gitignore.lib) gitignoreSource;
@ -19,21 +22,6 @@
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
zig = zig-overlay.packages.${system}.master.latest; zig = zig-overlay.packages.${system}.master.latest;
known-folders = pkgs.stdenvNoCC.mkDerivation {
name = "known-folders";
src = pkgs.fetchFromGitHub {
owner = "ziglibs";
repo = "known-folders";
rev = "9db1b99219c767d5e24994b1525273fe4031e464";
sha256 = "sha256-eqaZxIax8C75L2UwDbVKSUZ7iThm/iWblfoaTfPyHLM=";
};
dontConfigure = true;
dontInstall = true;
buildPhase = ''
mkdir -p $out
cp known-folders.zig $out
'';
};
in rec { in rec {
packages.default = packages.zls; packages.default = packages.zls;
packages.zls = pkgs.stdenvNoCC.mkDerivation { packages.zls = pkgs.stdenvNoCC.mkDerivation {
@ -41,7 +29,6 @@
version = "master"; version = "master";
src = gitignoreSource ./.; src = gitignoreSource ./.;
nativeBuildInputs = [ zig ]; nativeBuildInputs = [ zig ];
buildInputs = [ known-folders ];
dontConfigure = true; dontConfigure = true;
dontInstall = true; dontInstall = true;
buildPhase = '' buildPhase = ''