-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
43 lines (41 loc) · 1.45 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
{
outputs = { ... }: {
und =
let
mapNames = f: names: builtins.listToAttrs (map
(name: {
inherit name;
value = f name;
})
names);
in
flake: mapNames
(system: flake.inputs.nixpkgs.lib.pipe flake.nixosConfigurations [
builtins.attrNames
(builtins.filter (name: flake.nixosConfigurations.${name} ? _module.args.und))
(mapNames (name:
let
pkgs = import flake.inputs.nixpkgs { inherit system; };
conf = flake.nixosConfigurations.${name};
args = conf._module.args.und;
program = "${pkgs.writeShellApplication {
name = "und-${name}";
runtimeInputs = with pkgs; [ openssh ];
text = builtins.readFile
(pkgs.substituteAll {
src = ./und.sh;
inherit name flake;
user = args.user or "";
host = args.host or "";
preUser = args.preUser or args.user or "";
kexec = args.kexec or "https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-${conf.pkgs.system}.tar.gz";
});
}}/bin/und-${name}";
in
{
type = "app";
inherit program;
}))
]) [ "x86_64-linux" "aarch64-linux" ];
};
}