a flake module to ease creating and managing multiple hosts in your nix flake.

feat: Add perArch option (#11)

Co-authored-by: isabel <isabel@isabelroses.com>

authored by bartbie isabel and committed by GitHub 9f928f70 72dc72f9

+4
README.md
··· 37 37 - `modules`: A list of modules that will be included in all the hosts of the given class. 38 38 - `specialArgs`: A list of special arguments that will be passed to all the hosts of the given class. 39 39 40 + - `easy-hosts.perArch`: This provides you with the `arch` argument such that you can specify what architectures get which modules. 41 + - `modules`: A list of modules that will be included in all the hosts of the given arch. 42 + - `specialArgs`: A list of special arguments that will be passed to all the hosts of the given arch. 43 + 40 44 - `easy-hosts.perTag`: This provides you with the `tag` argument such that you can specify what tags get which modules. 41 45 - `modules`: A list of modules that will be included in all the hosts with the given tag. 42 46 - `specialArgs`: A list of special arguments that will be passed to all the hosts with the given tag.
+31
flake-module.nix
··· 93 93 description = "Per class settings"; 94 94 }; 95 95 96 + perArch = mkOption { 97 + default = _: { 98 + modules = [ ]; 99 + specialArgs = { }; 100 + }; 101 + defaultText = '' 102 + arch: { 103 + modules = [ ]; 104 + specialArgs = { }; 105 + }; 106 + ''; 107 + 108 + type = types.functionTo ( 109 + types.submodule { 110 + options = mkBasicParams "Per arch"; 111 + } 112 + ); 113 + 114 + example = literalExpression '' 115 + arch: { 116 + modules = [ 117 + { system.nixos.label = arch; } 118 + ]; 119 + 120 + specialArgs = { }; 121 + } 122 + ''; 123 + 124 + description = "Per arch settings"; 125 + }; 126 + 96 127 perTag = mkOption { 97 128 default = _: { 98 129 modules = [ ];
+3
lib.nix
··· 364 364 # memoize the class and perClass values so we don't have to recompute them 365 365 perClass = easyHostsConfig.perClass hostConfig.class; 366 366 perTag = builtins.map (easyHostsConfig.perTag) hostConfig.tags; 367 + perArch = builtins.map (easyHostsConfig.perTag) hostConfig.arch; 367 368 class = redefineClass easyHostsConfig.additionalClasses hostConfig.class; 368 369 in 369 370 toHostOutput { ··· 384 385 hostConfig.modules 385 386 easyHostsConfig.shared.modules 386 387 perClass.modules 388 + perArch.modules 387 389 ] 388 390 ++ (builtins.map ({ modules, ... }: modules) perTag) 389 391 ); ··· 393 395 hostConfig.specialArgs 394 396 easyHostsConfig.shared.specialArgs 395 397 perClass.specialArgs 398 + perArch.specialArgs 396 399 ] 397 400 ++ (builtins.map ({ specialArgs, ... }: specialArgs) perTag) 398 401 );