btrfs-assistant: cleanup

This commit is contained in:
Austin Horstman 2024-06-13 19:08:23 -05:00
parent dc2ccabad2
commit 976a8edb68
No known key found for this signature in database

View File

@ -1,17 +1,18 @@
{ lib
, stdenv
, fetchFromGitLab
, bash
, btrfs-progs
, cmake
, coreutils
, git
, pkg-config
, qt6
, snapper
, util-linux
, enableSnapper ? true
, nix-update-script
{
lib,
stdenv,
fetchFromGitLab,
bash,
btrfs-progs,
cmake,
coreutils,
git,
pkg-config,
qt6,
snapper,
util-linux,
enableSnapper ? true,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
@ -42,45 +43,34 @@ stdenv.mkDerivation (finalAttrs: {
util-linux
] ++ lib.optionals enableSnapper [ snapper ];
prePatch =
''
substituteInPlace src/util/System.cpp \
--replace-fail '/bin/bash' "${lib.getExe bash}"
prePatch = ''
substituteInPlace src/util/System.cpp \
--replace '/bin/bash' "${lib.getExe bash}"
substituteInPlace src/main.cpp \
--replace-fail 'if (!qEnvironmentVariableIsEmpty("DISPLAY"))' ' if(!qEnvironmentVariableIsEmpty("DISPLAY") || !qEnvironmentVariableIsEmpty("WAYLAND_DISPLAY"))'
''
+ lib.optionalString enableSnapper ''
substituteInPlace src/main.cpp \
--replace-fail '/usr/bin/snapper' "${lib.getExe snapper}"
'';
substituteInPlace src/main.cpp \
--replace-fail 'if (!qEnvironmentVariableIsEmpty("DISPLAY"))' ' if(!qEnvironmentVariableIsEmpty("DISPLAY") || !qEnvironmentVariableIsEmpty("WAYLAND_DISPLAY"))'
''
+ lib.optionalString enableSnapper ''
substituteInPlace src/main.cpp \
--replace '/usr/bin/snapper' "${lib.getExe snapper}"
'';
postPatch =
''
substituteInPlace src/org.btrfs-assistant.pkexec.policy \
--replace-fail '/usr/bin' "$out/bin"
postPatch = ''
substituteInPlace src/org.btrfs-assistant.pkexec.policy \
--replace '/usr/bin' "$out/bin"
substituteInPlace src/btrfs-assistant \
--replace-fail 'btrfs-assistant-bin' "$out/bin/btrfs-assistant-bin"
substituteInPlace src/btrfs-assistant \
--replace 'btrfs-assistant-bin' "$out/bin/btrfs-assistant-bin"
substituteInPlace src/btrfs-assistant-launcher \
--replace 'btrfs-assistant' "$out/bin/btrfs-assistant"
''
+ lib.optionalString enableSnapper ''
substituteInPlace src/btrfs-assistant.conf \
--replace '/usr/bin/snapper' "${lib.getExe snapper}"
'';
qtWrapperArgs =
let
runtimeDeps = lib.makeBinPath ([
coreutils
util-linux
]
++ lib.optionals enableSnapper [ snapper ]);
in
[
"--prefix PATH : ${runtimeDeps}"
];
substituteInPlace src/btrfs-assistant-launcher \
--replace-fail 'btrfs-assistant' "$out/bin/btrfs-assistant"
''
+ lib.optionalString enableSnapper ''
substituteInPlace src/btrfs-assistant.conf \
--replace-fail '/usr/bin/snapper' "${lib.getExe snapper}"
'';
passthru.updateScript = nix-update-script { };