-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
flake.nix
80 lines (71 loc) · 2.43 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "git-branchless";
outputs = { self, nixpkgs, ... }:
let
lib = nixpkgs.lib;
systems = [
"aarch64-linux"
"aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
foreachSystem = lib.genAttrs systems;
in
{
overlays.default = (final: prev: {
# reuse the definition from nixpkgs git-branchless
git-branchless = prev.git-branchless.overrideAttrs ({ meta, ... }: {
name = "git-branchless";
src = self;
cargoDeps = final.rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
# for `flake.nix` contributors: put additional local overrides here.
# if the changes are also applicable to the `git-branchless` package
# in nixpkgs, consider first improving the definition there, and then
# update the `flake.lock` here.
# in case local overrides might confuse upstream maintainers,
# we do not list them here:
meta = (removeAttrs meta [ "maintainers" ]) // {
# to correctly generate meta.position for back trace:
inherit (meta) description;
};
});
# reuse the definition for git-branchless
scm-diff-editor = final.git-branchless.overrideAttrs (finalAttrs: prevAttrs: {
name = "scm-diff-editor";
meta = prevAttrs.meta // {
mainProgram = finalAttrs.name;
description = "UI to interactively select changes, bundled in git-branchless";
};
buildAndTestSubdir = "scm-record";
buildFeatures = [ "scm-diff-editor" ];
# remove the git-branchless specific build commands
postInstall = "";
preCheck = "";
checkFlags = "";
});
});
packages = foreachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend self.overlays.default;
in
{
inherit (pkgs)
git-branchless scm-diff-editor;
default = pkgs.git-branchless;
}
);
checks = foreachSystem (system: {
git-branchless =
self.packages.${system}.git-branchless.overrideAttrs ({ preCheck, ... }: {
cargoBuildType = "debug";
cargoCheckType = "debug";
preCheck = ''
export RUST_BACKTRACE=1
'' + preCheck;
});
});
};
}