reading base-profile.yaml into config
This commit is contained in:
42
modules/services/restic/base-profile.yaml
Normal file
42
modules/services/restic/base-profile.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
base:
|
||||||
|
repository: local:/mnt/backup
|
||||||
|
password-file: '{{ .ConfigDir }}/password.txt'
|
||||||
|
status-file: '{{ .ConfigDir }}/backup-status.json'
|
||||||
|
retention:
|
||||||
|
after-backup: true
|
||||||
|
keep-last: '10'
|
||||||
|
keep-hourly: '8'
|
||||||
|
keep-daily: '14'
|
||||||
|
keep-weekly: '8'
|
||||||
|
backup:
|
||||||
|
verbose: true
|
||||||
|
exclude:
|
||||||
|
- .cache
|
||||||
|
- .devenv
|
||||||
|
- .rustup
|
||||||
|
- .cargo
|
||||||
|
- .venv
|
||||||
|
- .pyenv
|
||||||
|
- .vscode*
|
||||||
|
- data/postgres
|
||||||
|
- build
|
||||||
|
- __pycache__
|
||||||
|
- '*.log'
|
||||||
|
- '*.egg-info'
|
||||||
|
- '*.csv'
|
||||||
|
- '*.m4a'
|
||||||
|
- .local/share/Steam
|
||||||
|
- .local/share/Trash
|
||||||
|
- build
|
||||||
|
- dist
|
||||||
|
- /home/*/Pictures
|
||||||
|
- /home/*/Videos
|
||||||
|
- /home/*/go
|
||||||
|
- /home/*/snap
|
||||||
|
- /home/john/john-nas
|
||||||
|
schedule-permission: user
|
||||||
|
schedule-priority: background
|
||||||
|
check-after: true
|
||||||
|
prune:
|
||||||
|
schedule-permission: user
|
||||||
|
schedule-lock-wait: 1h
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
base:
|
|
||||||
repository: local:/mnt/backup
|
|
||||||
password-file: '{{ .ConfigDir }}/password.txt'
|
|
||||||
status-file: '{{ .ConfigDir }}/backup-status.json'
|
|
||||||
retention:
|
|
||||||
after-backup: true
|
|
||||||
keep-last: '10'
|
|
||||||
keep-hourly: '8'
|
|
||||||
keep-daily: '14'
|
|
||||||
keep-weekly: '8'
|
|
||||||
backup:
|
|
||||||
verbose: true
|
|
||||||
exclude:
|
|
||||||
- .cache
|
|
||||||
- .devenv
|
|
||||||
- .rustup
|
|
||||||
- .cargo
|
|
||||||
- .venv
|
|
||||||
- .pyenv
|
|
||||||
- .vscode*
|
|
||||||
- data/postgres
|
|
||||||
- build
|
|
||||||
- __pycache__
|
|
||||||
- '*.log'
|
|
||||||
- '*.egg-info'
|
|
||||||
- '*.csv'
|
|
||||||
- '*.m4a'
|
|
||||||
- .local/share/Steam
|
|
||||||
- .local/share/Trash
|
|
||||||
- build
|
|
||||||
- dist
|
|
||||||
- /home/*/Pictures
|
|
||||||
- /home/*/Videos
|
|
||||||
- /home/*/go
|
|
||||||
- /home/*/snap
|
|
||||||
- /home/john/john-nas
|
|
||||||
schedule-permission: user
|
|
||||||
schedule-priority: background
|
|
||||||
check-after: true
|
|
||||||
prune:
|
|
||||||
schedule-permission: user
|
|
||||||
schedule-lock-wait: 1h
|
|
||||||
@@ -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, ... }:
|
flake.modules.homeManager.resticprofile = { config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.programs.resticprofile;
|
cfg = config.programs.resticprofile;
|
||||||
yamlFormat = pkgs.formats.yaml { };
|
yamlFormat = pkgs.formats.yaml { };
|
||||||
baseProfile = import ../../../resticprofile/base.nix;
|
# baseProfile = import ../../../resticprofile/base.nix;
|
||||||
# baseProfile = builtins.fromJSON (builtins.readFile ./base.yaml)
|
baseProfile = inputs.self.lib.fromYAML pkgs ./base-profile.yaml;
|
||||||
profiles = lib.recursiveUpdate baseProfile cfg.profiles;
|
profiles = lib.recursiveUpdate baseProfile cfg.profiles;
|
||||||
in {
|
in {
|
||||||
options.programs.resticprofile = {
|
options.programs.resticprofile = {
|
||||||
|
|||||||
Reference in New Issue
Block a user