diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2017-01-01 16:41:34 +0100 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2017-01-01 17:08:34 +0100 |
commit | 49d444416cf88dad03da0ec71573cd9747245581 (patch) | |
tree | d2fd7e4af151b1c2335ef238ddd20d090b985730 /nixos/modules/tasks/network-interfaces.nix | |
parent | 31dc66a55ae2a062b7f025879808afe30631fff8 (diff) |
nixos: cosmetic refactor of environment.etc."hostid"
Create the file using attrset instead of list, to make it easier to
later provide other files in the same module.
Diffstat (limited to 'nixos/modules/tasks/network-interfaces.nix')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index aaa78daeb3a3..74f7e5fcc2c3 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -910,20 +910,16 @@ in domainname "${cfg.domain}" ''; - environment.etc = mkIf (cfg.hostId != null) - [ - { - target = "hostid"; - source = pkgs.runCommand "gen-hostid" {} '' - 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 = pkgs.runCommand "gen-hostid" {} '' + 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.systemPackages = [ pkgs.host |