diff options
author | Janne Heß <janne@hess.ooo> | 2022-04-18 18:31:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-18 18:31:18 +0200 |
commit | a719f5fb9d19c639860176981b9c9ec1ae457c25 (patch) | |
tree | fe3cfde36adb1be9501cbf9fe25c5060e6fcbff1 /nixos/modules | |
parent | e6326e3694b45c97293dc16370c3a705a67035c8 (diff) | |
parent | 3396c96e4b884f9d3cba6ad37da30e83a7c52e60 (diff) | |
download | nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.tar nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.tar.gz nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.tar.bz2 nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.tar.lz nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.tar.xz nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.tar.zst nixpkgs-a719f5fb9d19c639860176981b9c9ec1ae457c25.zip |
Merge pull request #168965 from helsinki-systems/feat/systemd-stage-1-hostid
nixos/stage-1-init: Set host id for ZFS
Diffstat (limited to 'nixos/modules')
-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) |