forked from c3d2/nix-config
nix-build: generate a tftproot
This commit is contained in:
parent
5a2202c9cd
commit
34c96c6768
|
@ -273,6 +273,9 @@
|
|||
modules = [
|
||||
./hosts/containers/nix-build
|
||||
];
|
||||
extraArgs.tftproots = nixpkgs.lib.filterAttrs (name: _:
|
||||
builtins.match ".+-tftproot" name != null
|
||||
) self.packages.x86_64-linux;
|
||||
};
|
||||
|
||||
pulsebert = nixosSystem' {
|
||||
|
@ -309,6 +312,7 @@
|
|||
modules = [
|
||||
"${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
self.nixosModules.rpi-netboot
|
||||
./hosts/dacbert
|
||||
];
|
||||
system = "aarch64-linux";
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{
|
||||
dacbert.ip4 = "dacbert.hq.c3d2.de";
|
||||
dacbert.serial = "d2526256";
|
||||
|
||||
dn42 = {
|
||||
ip4 = "172.22.99.253";
|
||||
|
@ -120,5 +121,7 @@
|
|||
storage-ng.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMeg5ojU7U8+Lx824y+brazVJ007mEJDM7C7aUruOWGP";
|
||||
|
||||
schalter.ip4 = "schalter.hq.c3d2.de";
|
||||
|
||||
# Hack
|
||||
rpi-netboot.ip4 = "127.0.0.1";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
{ lib, ... }:
|
||||
{ tftproots, hostRegistry, lib, pkgs, ... }:
|
||||
let
|
||||
tftpRoot = "/var/lib/tftproot";
|
||||
tftpRoot = pkgs.runCommand "tftproot" {} ''
|
||||
mkdir $out
|
||||
cp -sr ${tftproots.rpi-netboot-tftproot} $out/
|
||||
${lib.concatMapStrings (host: ''
|
||||
ln -s ${tftproots."${host}-tftproot"} $out/${hostRegistry.${host}.serial}
|
||||
'') (
|
||||
builtins.attrNames (
|
||||
lib.filterAttrs (_: { serial ? null, ... }: serial != null) hostRegistry
|
||||
)
|
||||
)}
|
||||
'';
|
||||
in
|
||||
{
|
||||
networking.firewall.enable = false;
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
raspberryPi = {
|
||||
enable = true;
|
||||
version = 4;
|
||||
uboot.enable = true;
|
||||
firmwareConfig = ''
|
||||
gpu_mem=192
|
||||
dtparam=audio=on
|
||||
|
|
|
@ -116,6 +116,13 @@ in
|
|||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
serial = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Hardware serial number to help identification when netbooting.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user