diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-11-01 21:05:33 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-11-01 21:05:33 +0100 |
commit | a73133a7c629c76a7a328f0e8d2bb693c46ef45d (patch) | |
tree | 11112e70dd44a3a1eb7fd1702c0b80baa578b386 /modules/zfssnap/default.nix | |
parent | 4188923d715bb4cfc3542eb05781fd45df85522e (diff) | |
download | nixos-a73133a7c629c76a7a328f0e8d2bb693c46ef45d.tar nixos-a73133a7c629c76a7a328f0e8d2bb693c46ef45d.tar.gz nixos-a73133a7c629c76a7a328f0e8d2bb693c46ef45d.tar.bz2 nixos-a73133a7c629c76a7a328f0e8d2bb693c46ef45d.tar.xz nixos-a73133a7c629c76a7a328f0e8d2bb693c46ef45d.zip |
fix backups
Diffstat (limited to 'modules/zfssnap/default.nix')
-rw-r--r-- | modules/zfssnap/default.nix | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/modules/zfssnap/default.nix b/modules/zfssnap/default.nix index 42cdf46f..735e73ec 100644 --- a/modules/zfssnap/default.nix +++ b/modules/zfssnap/default.nix | |||
@@ -1,32 +1,20 @@ | |||
1 | { config, pkgs, lib, ... }: | 1 | { config, pkgs, lib, flakeInputs, ... }: |
2 | 2 | ||
3 | with lib; | 3 | with lib; |
4 | 4 | ||
5 | let | 5 | let |
6 | zfssnap = pkgs.stdenv.mkDerivation rec { | 6 | zfssnap = flakeInputs.mach-nix.lib.${config.nixpkgs.system}.buildPythonPackage rec { |
7 | name = "zfssnap"; | 7 | pname = "zfssnap"; |
8 | src = ./zfssnap.py; | 8 | src = ./zfssnap; |
9 | version = "0.0.0"; | ||
10 | ignoreDataOutdated = true; | ||
9 | 11 | ||
10 | phases = [ "buildPhase" "checkPhase" "installPhase" ]; | 12 | requirements = '' |
11 | 13 | pyxdg | |
12 | buildInputs = with pkgs; [makeWrapper]; | 14 | pytimeparse |
13 | 15 | python-dateutil | |
14 | python = pkgs.python39.withPackages (ps: with ps; [pyxdg pytimeparse python-dateutil]); | ||
15 | |||
16 | buildPhase = '' | ||
17 | substitute $src zfssnap \ | ||
18 | --subst-var-by python ${escapeShellArg python} | ||
19 | ''; | ||
20 | |||
21 | doCheck = true; | ||
22 | checkPhase = '' | ||
23 | ${python}/bin/python -m py_compile zfssnap | ||
24 | ''; | 16 | ''; |
25 | 17 | postInstall = '' | |
26 | installPhase = '' | ||
27 | install -m 0755 -D -t $out/bin \ | ||
28 | zfssnap | ||
29 | |||
30 | wrapProgram $out/bin/zfssnap \ | 18 | wrapProgram $out/bin/zfssnap \ |
31 | --prefix PATH : ${makeBinPath [config.boot.zfs.package]} | 19 | --prefix PATH : ${makeBinPath [config.boot.zfs.package]} |
32 | ''; | 20 | ''; |
@@ -71,7 +59,9 @@ in { | |||
71 | before = [ "zfssnap-prune.service" ]; | 59 | before = [ "zfssnap-prune.service" ]; |
72 | serviceConfig = { | 60 | serviceConfig = { |
73 | Type = "oneshot"; | 61 | Type = "oneshot"; |
74 | ExecStart = "${zfssnap}/bin/zfssnap -v"; | 62 | ExecStart = "${zfssnap}/bin/zfssnap -vv"; |
63 | |||
64 | LogRateLimitIntervalSec = 0; | ||
75 | }; | 65 | }; |
76 | }; | 66 | }; |
77 | systemd.services."zfssnap-prune" = { | 67 | systemd.services."zfssnap-prune" = { |
@@ -82,7 +72,9 @@ in { | |||
82 | ExecStart = let | 72 | ExecStart = let |
83 | mkSectionName = name: strings.escape [ "[" "]" ] (strings.toUpper name); | 73 | mkSectionName = name: strings.escape [ "[" "]" ] (strings.toUpper name); |
84 | zfssnapConfig = generators.toINI { inherit mkSectionName; } cfg.config; | 74 | zfssnapConfig = generators.toINI { inherit mkSectionName; } cfg.config; |
85 | in "${zfssnap}/bin/zfssnap -vv prune --config=${pkgs.writeText "zfssnap.ini" zfssnapConfig}"; | 75 | in "${zfssnap}/bin/zfssnap -vv prune --exec-newest --config=${pkgs.writeText "zfssnap.ini" zfssnapConfig}"; # DEBUG |
76 | |||
77 | LogRateLimitIntervalSec = 0; | ||
86 | }; | 78 | }; |
87 | }; | 79 | }; |
88 | 80 | ||