summaryrefslogtreecommitdiff
path: root/hosts/vidhar/borg/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/vidhar/borg/default.nix')
-rw-r--r--hosts/vidhar/borg/default.nix54
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 });
80in { 78in {
81 config = { 79 config = {
82 services.borgsnap = { 80 services.borgsnap = {