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.
This commit is contained in:
parent
31dc66a55a
commit
49d444416c
1 changed files with 10 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue