reading base-profile.yaml into config

This commit is contained in:
John Lancaster
2026-03-11 18:02:00 -05:00
parent cf2ba8731d
commit ee1b2aafba
3 changed files with 57 additions and 44 deletions

View File

@@ -29,12 +29,25 @@
};
};
flake.lib.fromYAML = pkgs: path:
builtins.fromJSON (
builtins.readFile (
pkgs.runCommand "${builtins.baseNameOf path}.json"
{
nativeBuildInputs = [ pkgs.remarshal ];
}
''
remarshal -if yaml -of json ${path} > "$out"
''
)
);
flake.modules.homeManager.resticprofile = { config, lib, pkgs, ... }:
let
cfg = config.programs.resticprofile;
yamlFormat = pkgs.formats.yaml { };
baseProfile = import ../../../resticprofile/base.nix;
# baseProfile = builtins.fromJSON (builtins.readFile ./base.yaml)
# baseProfile = import ../../../resticprofile/base.nix;
baseProfile = inputs.self.lib.fromYAML pkgs ./base-profile.yaml;
profiles = lib.recursiveUpdate baseProfile cfg.profiles;
in {
options.programs.resticprofile = {