about summary refs log tree commit diff
path: root/pkgs/applications/system
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2023-01-26 11:50:03 -0300
committerGitHub <noreply@github.com>2023-01-26 11:50:03 -0300
commitea068dc485518de23fe8f27b94b7ae4c00a83ded (patch)
treedc711875d1d811682db06650ee8933cc666b1480 /pkgs/applications/system
parent16302ba83ca61c7cb50411420013674f011270a4 (diff)
parent72d43ddf528026416c84a7acf08c2922e9ce1e51 (diff)
Merge pull request #208338 from urandom2/zxfer
zxfer: init at 1.1.7
Diffstat (limited to 'pkgs/applications/system')
-rw-r--r--pkgs/applications/system/zxfer/default.nix86
1 files changed, 86 insertions, 0 deletions
diff --git a/pkgs/applications/system/zxfer/default.nix b/pkgs/applications/system/zxfer/default.nix
new file mode 100644
index 0000000000000..b62c1262430ca
--- /dev/null
+++ b/pkgs/applications/system/zxfer/default.nix
@@ -0,0 +1,86 @@
+{ lib
+, bash
+, fetchFromGitHub
+, installShellFiles
+, coreutils
+, gawk
+, gnugrep
+, gnused
+, openssh
+, resholve
+, rsync
+, which
+, zfs
+}:
+
+resholve.mkDerivation rec {
+  pname = "zxfer";
+  version = "1.1.7";
+
+  src = fetchFromGitHub {
+    owner = "allanjude";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-11SQJcD3GqPYBIgaycyKkc62/diVKPuuj2Or97j+NZY=";
+  };
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  # these may point to paths on remote systems, calculated at runtime, thus we cannot fix them
+  # we can only set their initial values, and let them remain dynamic
+  postPatch = ''
+    substituteInPlace zxfer \
+      --replace 'LCAT=""'                'LCAT=${coreutils}/bin/cat' \
+      --replace 'LZFS=$( which zfs )'    'LZFS=${zfs}/bin/zfs'
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    installManPage zxfer.1m zxfer.8
+    install -Dm755 zxfer -t $out/bin/
+
+    runHook postInstall
+  '';
+
+  solutions.default = {
+    scripts = [ "bin/zxfer" ];
+    interpreter = "${bash}/bin/sh";
+    inputs = [
+      coreutils
+      gawk
+      gnugrep
+      gnused
+      openssh
+      rsync
+      which
+    ];
+    fake.external = [
+      "kldload" # bsd builtin
+      "kldstat" # bsd builtin
+      "svcadm" # solaris builtin
+    ];
+    keep = {
+      "$LCAT" = true;
+      "$LZFS" = true;
+      "$PROGRESS_DIALOG" = true;
+      "$RZFS" = true;
+      "$input_optionts" = true;
+      "$option_O" = true;
+      "$option_T" = true;
+    };
+    fix = {
+      "$AWK" = [ "awk" ];
+      "$RSYNC" = [ "rsync" ];
+    };
+    execer = [ "cannot:${rsync}/bin/rsync" ];
+  };
+
+  meta = with lib; {
+    description = "A popular script for managing ZFS snapshot replication";
+    homepage = "https://github.com/allanjude/zxfer";
+    changelog = "https://github.com/allanjude/zxfer/releases/tag/v${version}";
+    license = licenses.bsd2;
+    maintainers = with lib.maintainers; [ urandom ];
+  };
+}