Skip to content

Commit 15b2321

Browse files
bryangoarxanas
authored andcommitted
feat(nix): reuse packaging code for scm-diff-editor
Since the package definition for scm-diff-editor is almost identical to git-branchless, we reuse the code to avoid duplication and improve coherence.
1 parent 6b0cbf9 commit 15b2321

File tree

1 file changed

+14
-40
lines changed

1 file changed

+14
-40
lines changed

flake.nix

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -37,48 +37,22 @@
3737
};
3838
});
3939

40-
scm-diff-editor = final.callPackage
41-
(
42-
{ lib
43-
, git
44-
, libiconv
45-
, ncurses
46-
, openssl
47-
, pkg-config
48-
, rustPlatform
49-
, sqlite
50-
, stdenv
51-
, Security
52-
, SystemConfiguration
53-
}:
54-
55-
rustPlatform.buildRustPackage {
56-
name = "scm-diff-editor";
57-
58-
src = self;
59-
60-
cargoLock = {
61-
lockFile = "${self}/Cargo.lock";
62-
};
40+
# reuse the definition for git-branchless
41+
scm-diff-editor = final.git-branchless.overrideAttrs (finalAttrs: prevAttrs: {
42+
name = "scm-diff-editor";
43+
meta = prevAttrs.meta // {
44+
mainProgram = finalAttrs.name;
45+
description = "UI to interactively select changes, bundled in git-branchless";
46+
};
6347

64-
buildAndTestSubdir = "scm-record";
65-
buildFeatures = [ "scm-diff-editor" ];
66-
nativeBuildInputs = [ pkg-config ];
48+
buildAndTestSubdir = "scm-record";
49+
buildFeatures = [ "scm-diff-editor" ];
6750

68-
buildInputs = [
69-
ncurses
70-
openssl
71-
sqlite
72-
] ++ lib.optionals stdenv.isDarwin [
73-
Security
74-
SystemConfiguration
75-
libiconv
76-
];
77-
}
78-
)
79-
{
80-
inherit (final.darwin.apple_sdk.frameworks) Security SystemConfiguration;
81-
};
51+
# remove the git-branchless specific build commands
52+
postInstall = "";
53+
preCheck = "";
54+
checkFlags = "";
55+
});
8256
});
8357

8458
packages = foreachSystem (system:

0 commit comments

Comments
 (0)