diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-11-02 16:31:02 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-11-02 16:31:02 +0100 |
commit | 6bafcb244bd6cd031ac9b65fce8a2a939698ecaa (patch) | |
tree | ad5346d15e226f227e9a9b111c5894782885b79a /hosts/vidhar/borg/default.nix | |
parent | 7f5cf6c9bbc830ab830275cb71cc1e6229d79afd (diff) | |
download | nixos-6bafcb244bd6cd031ac9b65fce8a2a939698ecaa.tar nixos-6bafcb244bd6cd031ac9b65fce8a2a939698ecaa.tar.gz nixos-6bafcb244bd6cd031ac9b65fce8a2a939698ecaa.tar.bz2 nixos-6bafcb244bd6cd031ac9b65fce8a2a939698ecaa.tar.xz nixos-6bafcb244bd6cd031ac9b65fce8a2a939698ecaa.zip |
...
Diffstat (limited to 'hosts/vidhar/borg/default.nix')
-rw-r--r-- | hosts/vidhar/borg/default.nix | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/hosts/vidhar/borg/default.nix b/hosts/vidhar/borg/default.nix index 8d0b46ef..7672de18 100644 --- a/hosts/vidhar/borg/default.nix +++ b/hosts/vidhar/borg/default.nix | |||
@@ -26,7 +26,7 @@ let | |||
26 | in nameValuePair serviceName { | 26 | in nameValuePair serviceName { |
27 | serviceConfig = { | 27 | serviceConfig = { |
28 | Type = "oneshot"; | 28 | Type = "oneshot"; |
29 | ExecStart = "${copyBorg}/bin/copy ${escapeShellArg repo} yggdrasil.borgbase:repo"; | 29 | ExecStart = "${copyBorg}/bin/copy_borg --verbosity 3 ${escapeShellArg repo} yggdrasil.borgbase:repo"; |
30 | TimeoutStartSec = "8h"; | 30 | TimeoutStartSec = "8h"; |
31 | # User = "borg"; | 31 | # User = "borg"; |
32 | # Group = "borg"; | 32 | # Group = "borg"; |
@@ -43,40 +43,38 @@ let | |||
43 | "BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes" | 43 | "BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes" |
44 | "BORG_HOSTNAME_IS_UNIQUE=yes" | 44 | "BORG_HOSTNAME_IS_UNIQUE=yes" |
45 | ]; | 45 | ]; |
46 | |||
47 | LogRateLimitIntervalSec = 0; | ||
46 | }; | 48 | }; |
47 | }; | 49 | }; |
48 | 50 | ||
49 | copyBorg = pkgs.stdenv.mkDerivation (let | 51 | copyBorg = flakeInputs.mach-nix.lib.${config.nixpkgs.system}.buildPythonPackage rec { |
50 | packageOverrides = pkgs.callPackage ./pyprctl-packages.nix {}; | 52 | pname = "copy-borg"; |
51 | inpPython = pkgs.python39.override { inherit packageOverrides; }; | 53 | src = ./copy; |
52 | in rec { | 54 | version = "0.0.0"; |
53 | name = "copy"; | 55 | ignoreDataOutdated = true; |
54 | src = ./copy.py; | 56 | |
55 | 57 | requirements = '' | |
56 | phases = ["buildPhase" "checkPhase" "installPhase"]; | 58 | humanize |
57 | 59 | tqdm | |
58 | buildInputs = with pkgs; [makeWrapper]; | 60 | python-dateutil |
59 | 61 | xdg | |
60 | python = inpPython.withPackages (ps: with ps; [humanize tqdm python-dateutil xdg python-unshare pyprctl halo]); | 62 | python-unshare |
61 | 63 | pyprctl | |
62 | buildPhase = '' | 64 | halo |
63 | substitute $src copy \ | ||
64 | --subst-var-by python ${escapeShellArg python} | ||
65 | ''; | 65 | ''; |
66 | 66 | postInstall = '' | |
67 | doCheck = true; | 67 | wrapProgram $out/bin/copy_borg \ |
68 | checkPhase = '' | 68 | --prefix PATH : ${makeBinPath (with pkgs; [util-linux borgbackup])}:${config.security.wrapperDir} |
69 | ${python}/bin/python -m py_compile copy | ||
70 | ''; | 69 | ''; |
71 | 70 | ||
72 | installPhase = '' | 71 | providers.python-unshare = "nixpkgs"; |
73 | install -m 0755 -D -t $out/bin \ | 72 | overridesPre = [ |
74 | copy | 73 | (self: super: { python-unshare = super.python-unshare.overrideAttrs (oldAttrs: { name = "python-unshare-0.2.1"; version = "0.2.1"; }); }) |
74 | ]; | ||
75 | 75 | ||
76 | wrapProgram $out/bin/copy \ | 76 | # _.tomli.buildInputs.add = with pkgs."python3Packages"; [ flit-core ]; |
77 | --prefix PATH : ${makeBinPath (with pkgs; [util-linux borgbackup])}:${config.security.wrapperDir} | 77 | }; |
78 | ''; | ||
79 | }); | ||
80 | in { | 78 | in { |
81 | config = { | 79 | config = { |
82 | services.borgsnap = { | 80 | services.borgsnap = { |