mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-08 06:19:01 +00:00
33 lines
977 B
Nix
33 lines
977 B
Nix
|
{ config, lib, pkgs, bahaghariLib }:
|
||
|
|
||
|
let
|
||
|
cfg = config.bahaghari.tinted-theming;
|
||
|
in
|
||
|
rec {
|
||
|
# Return a derivation containing all of the template output from the given
|
||
|
# schemes.
|
||
|
generateOutputFromSchemes = { schemes ? {}, template }:
|
||
|
let
|
||
|
schemesDir = pkgs.runCommand "aggregate-schemes" { }
|
||
|
''
|
||
|
mkdir -p "$out"
|
||
|
${
|
||
|
lib.concatMapStrings (scheme: ''
|
||
|
echo <<EOF > "$out/${scheme.name}.yml"
|
||
|
${bahaghariLib.toYAML scheme}
|
||
|
EOF
|
||
|
'') lib.attrNames schemes
|
||
|
}
|
||
|
'';
|
||
|
in
|
||
|
pkgs.runCommand "generate-templates" { } (cfg.builder.script {
|
||
|
inherit schemesDir;
|
||
|
templateDir = template;
|
||
|
});
|
||
|
|
||
|
# Return a derivation containing the generated template with the given
|
||
|
# builder script with all of the Tinted Theming schemes.
|
||
|
generateOutputFromAllSchemes = { template }:
|
||
|
generateOutputFromSchemes { schemes = cfg.schemes; inherit template; };
|
||
|
}
|