diff options
Diffstat (limited to 'modules/borgcopy/default.nix')
| -rw-r--r-- | modules/borgcopy/default.nix | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/modules/borgcopy/default.nix b/modules/borgcopy/default.nix index 8e1afc27..af021777 100644 --- a/modules/borgcopy/default.nix +++ b/modules/borgcopy/default.nix | |||
| @@ -1,25 +1,32 @@ | |||
| 1 | { config, pkgs, lib, utils, flakeInputs, ... }: | 1 | { config, pkgs, lib, utils, flake, flakeInputs, ... }: |
| 2 | 2 | ||
| 3 | with lib; | 3 | with lib; |
| 4 | 4 | ||
| 5 | let | 5 | let |
| 6 | copyBorg = | 6 | copyBorg = let |
| 7 | with pkgs.poetry2nix; | 7 | workspace = flakeInputs.uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; }; |
| 8 | mkPoetryApplication { | 8 | pythonSet = flake.lib.pythonSet { |
| 9 | projectDir = cleanPythonSources { src = ./.; }; | 9 | inherit pkgs; |
| 10 | python = pkgs.python312; | ||
| 11 | overlay = workspace.mkPyprojectOverlay { | ||
| 12 | sourcePreference = "wheel"; | ||
| 13 | }; | ||
| 14 | }; | ||
| 15 | virtualEnv = pythonSet.mkVirtualEnv "copy_borg" workspace.deps.default; | ||
| 16 | in virtualEnv.overrideAttrs (oldAttrs: { | ||
| 17 | meta = (oldAttrs.meta or {}) // { | ||
| 18 | mainProgram = "copy_borg"; | ||
| 19 | }; | ||
| 10 | 20 | ||
| 11 | overrides = overrides.withDefaults (self: super: { | 21 | nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [ pkgs.makeWrapper ]; |
| 12 | pyprctl = super.pyprctl.overridePythonAttrs (oldAttrs: { | ||
| 13 | buildInputs = (oldAttrs.buildInputs or []) ++ [super.setuptools]; | ||
| 14 | }); | ||
| 15 | inherit (pkgs.python3Packages) python-unshare; | ||
| 16 | }); | ||
| 17 | 22 | ||
| 18 | postInstall = '' | 23 | postInstall = '' |
| 19 | wrapProgram $out/bin/copy_borg \ | 24 | ${oldAttrs.postInstall or ""} |
| 20 | --prefix PATH : ${makeBinPath (with pkgs; [util-linux borgbackup])}:${config.security.wrapperDir} | 25 | |
| 21 | ''; | 26 | wrapProgram $out/bin/copy_borg \ |
| 22 | }; | 27 | --prefix PATH : ${makeBinPath (with pkgs; [util-linux borgbackup])}:${config.security.wrapperDir} |
| 28 | ''; | ||
| 29 | }); | ||
| 23 | 30 | ||
| 24 | copyService = name: opts: nameValuePair "copy-borg@${utils.escapeSystemdPath name}" { | 31 | copyService = name: opts: nameValuePair "copy-borg@${utils.escapeSystemdPath name}" { |
| 25 | restartIfChanged = false; | 32 | restartIfChanged = false; |
