-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
104 lines (90 loc) · 2.66 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
92
93
94
95
96
97
98
99
100
101
102
103
104
{
description = "Infrastructure of the Deutsche Hacking Meisterschaft";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
sops-nix.url = "github:Mic92/sops-nix";
};
outputs =
{
self,
flake-utils,
nixpkgs,
...
}@inputs:
let
pkgsFor =
system:
import nixpkgs {
inherit system;
config = import ./nix/nixpkgs-config.nix inputs;
overlays = [
(final: prev: {
crun = prev.crun.overrideAttrs (old: {
configureFlags = [ "--with-libkrun" ];
buildInputs = old.buildInputs ++ [ final.libkrun ];
nativeBuildInputs = old.nativeBuildInputs ++ [ final.patchelf ];
# needs to be a copy /shrug
postInstall = ''
cp $out/bin/crun $out/bin/krun
'';
postFixup = ''
patchelf --add-rpath ${nixpkgs.lib.makeLibraryPath [ final.libkrun ]} $out/bin/krun
'';
});
})
];
};
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = pkgsFor system;
callDir =
with builtins;
with pkgs.lib;
path:
mapAttrs' (n: _: {
name = strings.removeSuffix ".nix" n;
value = pkgs.callPackage "${path}/${n}" { inherit inputs self; };
}) (filterAttrs (_: t: t == "regular") (readDir path));
in
{
checks = callDir ./nix/checks;
devShells = callDir ./nix/shells;
formatter = pkgs.nixfmt-rfc-style;
}
)
// {
nixosModules =
with builtins;
with nixpkgs.lib;
mapAttrs (n: _: import ./nix/modules/${n}) (
filterAttrs (_: t: t == "directory") (readDir ./nix/modules)
);
nixosConfigurations =
with builtins;
with nixpkgs.lib;
mapAttrs (
n: _:
nixpkgs.lib.nixosSystem {
pkgs = pkgsFor "x86_64-linux";
specialArgs = {
inherit inputs self;
systemConfigs = mapAttrs (_: e: e.config) self.nixosConfigurations;
};
modules = [
./nix/systems/${n}
inputs.sops-nix.nixosModules.default
] ++ attrValues self.nixosModules;
}
) (filterAttrs (_: t: t == "directory") (readDir ./nix/systems));
};
}