-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
49 lines (38 loc) · 1.25 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
description = "Simplify Nix source management using familiar glob patterns";
inputs.nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
outputs = { self, nixpkgs-lib }:
let
inherit (builtins)
fromJSON
readFile
;
system = "x86_64-linux";
nodes = (fromJSON (readFile ./dev/flake.lock)).nodes;
inputFromLock = name:
let locked = nodes.${name}.locked;
in fetchTarball {
url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz";
sha256 = locked.narHash;
};
nixpkgs = inputFromLock "nixpkgs";
pkgs = import nixpkgs { inherit system; };
globset = import self { inherit (nixpkgs-lib) lib; };
in {
lib = globset;
tests.${system} = import ./internal/tests.nix {
lib = nixpkgs-lib.lib // { inherit globset; };
};
checks.${system}.default = pkgs.runCommand "tests" {
nativeBuildInputs = [ pkgs.nix-unit ];
} ''
export HOME="$(realpath .)"
nix-unit \
--eval-store "$HOME" \
--extra-experimental-features flakes \
--override-input nixpkgs-lib ${nixpkgs-lib} \
--flake ${self}#tests
touch $out
'';
};
}