1{
2 stdenv,
3 autoreconfHook,
4 lib,
5 fetchFromGitHub,
6 util-linux,
7 mergerfs,
8 attr,
9 makeWrapper,
10 pandoc,
11 coreutils,
12 installShellFiles,
13 versionCheckHook,
14}:
15stdenv.mkDerivation {
16 pname = "try";
17 version = "0.2.0-unstable-2025-02-25";
18
19 src = fetchFromGitHub {
20 owner = "binpash";
21 repo = "try";
22 rev = "67052d8f20725f3cdc22ffaec33f7b7c14f1eb6b";
23 hash = "sha256-8mfCmqN50pRAeNTJUlRVrRQulWon4b2OL4Ug/ygBhB0=";
24 };
25
26 # skip TRY_REQUIRE_PROG as it detects executable dependencies by running it
27 postPatch = ''
28 sed -i '/^AC_DEFUN(\[TRY_REQUIRE_PROG\]/,/^])$/c\AC_DEFUN([TRY_REQUIRE_PROG], [])' configure.ac
29 '';
30
31 nativeBuildInputs = [
32 makeWrapper
33 autoreconfHook
34 pandoc
35 installShellFiles
36 ];
37
38 installPhase = ''
39 runHook preInstall
40 install -Dt $out/bin try
41 install -Dt $out/bin utils/try-commit
42 install -Dt $out/bin utils/try-summary
43 wrapProgram $out/bin/try --prefix PATH : ${
44 lib.makeBinPath [
45 coreutils
46 util-linux
47 mergerfs
48 attr
49 ]
50 }
51 installManPage man/try.1.gz
52 installShellCompletion --bash --name try.bash completions/try.bash
53 runHook postInstall
54 '';
55
56 doInstallCheck = true;
57 nativeInstallCheckInputs = [
58 versionCheckHook
59 ];
60 preVersionCheck = ''
61 export version=0.2.0
62 '';
63 versionCheckProgramArg = "-v";
64
65 meta = {
66 homepage = "https://github.com/binpash/try";
67 description = "Lets you run a command and inspect its effects before changing your live system";
68 mainProgram = "try";
69 maintainers = with lib.maintainers; [
70 pasqui23
71 ezrizhu
72 ];
73 license = with lib.licenses; [ mit ];
74 platforms = lib.platforms.linux;
75 };
76}