nixos-installer/lib/setup-scripts/default.nix

14 lines
684 B
Nix
Raw Normal View History

2022-05-09 13:20:43 +02:00
dirname: inputs: let
inherit (inputs.config.rename) setup installer;
2022-05-09 13:20:43 +02:00
doRenames = if setup == "setup" && installer == "installer" then (x: x) else (builtins.mapAttrs (name: path: (
2022-05-09 13:20:43 +02:00
builtins.toFile name (builtins.replaceStrings
[ "@{config.setup." "@{#config.setup." "@{!config.setup." "@{config.installer." "@{#config.installer." "@{!config.installer." ]
[ "@{config.${setup}." "@{#config.${setup}." "@{!config.${setup}." "@{config.${installer}." "@{#config.${installer}." "@{!config.${installer}." ]
2022-05-09 13:20:43 +02:00
(builtins.readFile path)
)
)));
in doRenames (inputs.functions.lib.getFilesExt "sh(.md)?" dirname)