forked from arxanas/git-branchless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
136 lines (122 loc) · 3.46 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
description = "git-branchless";
outputs = { self, nixpkgs, ... }:
let
lib = nixpkgs.lib;
systems = [
"aarch64-linux"
"aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
foreachSystem = f: lib.foldl' (attrs: system: lib.recursiveUpdate attrs (f system)) { } systems;
in
{
overlay = (final: prev: {
git-branchless = final.callPackage
(
{ lib
, git
, libiconv
, ncurses
, openssl
, pkg-config
, rustPlatform
, sqlite
, stdenv
, Security
, SystemConfiguration
}:
rustPlatform.buildRustPackage {
name = "git-branchless";
src = self;
cargoLock = {
lockFile = "${self}/Cargo.lock";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
ncurses
openssl
sqlite
] ++ lib.optionals stdenv.isDarwin [
Security
SystemConfiguration
libiconv
];
preCheck = ''
export TEST_GIT=${git}/bin/git
export TEST_GIT_EXEC_PATH=$(${git}/bin/git --exec-path)
'';
# FIXME: these tests time out when run in the Nix sandbox
checkFlags = [
"--skip=test_switch_pty"
"--skip=test_next_ambiguous_interactive"
"--skip=test_switch_auto_switch_interactive"
];
}
)
{
inherit (final.darwin.apple_sdk.frameworks) Security SystemConfiguration;
};
scm-diff-editor = final.callPackage
(
{ lib
, git
, libiconv
, ncurses
, openssl
, pkg-config
, rustPlatform
, sqlite
, stdenv
, Security
, SystemConfiguration
}:
rustPlatform.buildRustPackage {
name = "scm-diff-editor";
src = self;
cargoLock = {
lockFile = "${self}/Cargo.lock";
};
buildAndTestSubdir = "scm-record";
buildFeatures = [ "scm-diff-editor" ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [
ncurses
openssl
sqlite
] ++ lib.optionals stdenv.isDarwin [
Security
SystemConfiguration
libiconv
];
}
)
{
inherit (final.darwin.apple_sdk.frameworks) Security SystemConfiguration;
};
});
} //
(foreachSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in
{
packages.${system} = {
inherit (pkgs)
git-branchless scm-diff-editor;
};
defaultPackage.${system} = self.packages.${system}.git-branchless;
checks.${system}.git-branchless = pkgs.git-branchless.overrideAttrs ({ preCheck, ... }: {
cargoBuildType = "debug";
cargoCheckType = "debug";
preCheck = ''
export RUST_BACKTRACE=1
'' + preCheck;
});
}));
}