diff options
author | Janne Heß <janne@hess.ooo> | 2022-04-16 21:31:58 +0100 |
---|---|---|
committer | Janne Heß <janne@hess.ooo> | 2022-04-16 21:32:18 +0100 |
commit | 3396c96e4b884f9d3cba6ad37da30e83a7c52e60 (patch) | |
tree | f4da8be39ca33d3a230385dfcd1e2128e7e3c87d /nixos | |
parent | 031b95e587f75da4796c95e8ee232383310389c5 (diff) | |
download | nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.tar nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.tar.gz nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.tar.bz2 nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.tar.lz nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.tar.xz nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.tar.zst nixpkgs-3396c96e4b884f9d3cba6ad37da30e83a7c52e60.zip |
nixos/stage-1-init: Set host id for ZFS
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 8ca4ad7b7d8..d09e9b99248 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -403,6 +403,15 @@ let </itemizedlist> ''; + hostidFile = pkgs.runCommand "gen-hostid" { preferLocalBuild = true; } '' + hi="${cfg.hostId}" + ${if pkgs.stdenv.isBigEndian then '' + echo -ne "\x''${hi:0:2}\x''${hi:2:2}\x''${hi:4:2}\x''${hi:6:2}" > $out + '' else '' + echo -ne "\x''${hi:6:2}\x''${hi:4:2}\x''${hi:2:2}\x''${hi:0:2}" > $out + ''} + ''; + in { @@ -1383,16 +1392,8 @@ in domainname "${cfg.domain}" ''; - environment.etc.hostid = mkIf (cfg.hostId != null) - { source = pkgs.runCommand "gen-hostid" { preferLocalBuild = true; } '' - hi="${cfg.hostId}" - ${if pkgs.stdenv.isBigEndian then '' - echo -ne "\x''${hi:0:2}\x''${hi:2:2}\x''${hi:4:2}\x''${hi:6:2}" > $out - '' else '' - echo -ne "\x''${hi:6:2}\x''${hi:4:2}\x''${hi:2:2}\x''${hi:0:2}" > $out - ''} - ''; - }; + environment.etc.hostid = mkIf (cfg.hostId != null) { source = hostidFile; }; + boot.initrd.systemd.contents."/etc/hostid" = mkIf (cfg.hostId != null) { source = hostidFile; }; # static hostname configuration needed for hostnamectl and the # org.freedesktop.hostname1 dbus service (both provided by systemd) |