generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
91 lines (84 loc) · 2.92 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
description = "Personal NUR repository of @sigprof";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.systems.follows = "systems";
git-hooks-nix.url = "github:cachix/git-hooks.nix";
git-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
git-hooks-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
git-hooks-nix,
devshell,
...
}:
{
lib = import ./lib inputs;
nixosModules = import ./modules {inherit self inputs;};
nixosConfigurations = import ./hosts {inherit self inputs;};
overlays.default = import ./overlay.nix;
}
// (
flake-utils.lib.eachDefaultSystem (system: let
inherit (flake-utils.lib) filterPackages flattenTree;
pkgs = nixpkgs.legacyPackages.${system};
legacyPackages = (pkgs.callPackage ./pkgs {inherit inputs;}).packages;
packages = filterPackages system (flattenTree legacyPackages);
in {
inherit packages legacyPackages;
})
)
// (
let
checkedSystems = with flake-utils.lib.system; [
x86_64-linux
x86_64-darwin
aarch64-linux
aarch64-darwin
# No `i686-linux` because `git-hooks-nix` does not evaluate
];
in
flake-utils.lib.eachSystem checkedSystems (system: let
nixos-unstable = inputs.nixos-unstable.legacyPackages.${system};
alejandra = nixos-unstable.alejandra;
in {
checks =
{
pre-commit = git-hooks-nix.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
tools.alejandra = alejandra;
};
}
// (
let
inherit (nixpkgs.lib) filterAttrs mapAttrs mapAttrs' nameValuePair pipe;
inherit (self.legacyPackages.${system}.lib) forceCached;
in
pipe self.nixosConfigurations [
(mapAttrs' (name: host: (nameValuePair ("host/" + name) host.config.system.build.toplevel)))
(filterAttrs (_: drv: drv.system == system))
(mapAttrs (_: drv: forceCached drv))
]
);
devShells.default = devshell.legacyPackages.${system}.mkShell {
name = "sigprof/nur-packages";
motd = "{6}🔨 Welcome to {bold}sigprof/nur-packages{reset}";
packages = [
alejandra
];
devshell.startup.git-hooks-nix.text = self.checks.${system}.pre-commit.shellHook;
};
})
);
}