about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Titor <50095635+JohnRTitor@users.noreply.github.com>2024-07-18 21:33:59 +0530
committerJohn Titor <50095635+JohnRTitor@users.noreply.github.com>2024-07-18 22:08:23 +0530
commit989666769f5635f965851e654d77e26ca6144224 (patch)
tree918ef0ed99b1af633636d0d9209ad254d63e20ad
parent6caafcba3bdccda8cf32eeef91a23d323b42c797 (diff)
bcachefs-tools: add version-test and mainProgram
and more cleanup
-rw-r--r--pkgs/by-name/bc/bcachefs-tools/package.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/by-name/bc/bcachefs-tools/package.nix b/pkgs/by-name/bc/bcachefs-tools/package.nix
index 7794c2bab8761..3f37b633f9eef 100644
--- a/pkgs/by-name/bc/bcachefs-tools/package.nix
+++ b/pkgs/by-name/bc/bcachefs-tools/package.nix
@@ -13,7 +13,6 @@
   lz4,
   attr,
   udev,
-  nixosTests,
   fuse3,
   cargo,
   rustc,
@@ -21,7 +20,8 @@
   makeWrapper,
   nix-update-script,
   python3,
-  fetchpatch,
+  testers,
+  nixosTests,
   installShellFiles,
   fuseSupport ? false,
 }:
@@ -99,7 +99,7 @@ stdenv.mkDerivation (finalAttrs: {
   postInstall =
     ''
       substituteInPlace $out/libexec/bcachefsck_all \
-        --replace-fail "/usr/bin/python3" "${python3}/bin/python3"
+        --replace-fail "/usr/bin/python3" "${python3.interpreter}"
     ''
     + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
       installShellCompletion --cmd bcachefs \
@@ -110,6 +110,11 @@ stdenv.mkDerivation (finalAttrs: {
 
   passthru = {
     tests = {
+      version = testers.testVersion {
+        package = finalAttrs.finalPackage;
+        command = "${finalAttrs.meta.mainProgram} version";
+        version = "${finalAttrs.version}";
+      };
       smoke-test = nixosTests.bcachefs;
       inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
     };
@@ -129,5 +134,6 @@ stdenv.mkDerivation (finalAttrs: {
       Madouura
     ];
     platforms = lib.platforms.linux;
+    mainProgram = "bcachefs";
   };
 })