-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
116 lines (101 loc) · 2.83 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
{
description = "Cargo subcommand for overriding dependencies";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
{
overlays.default = (
final: prev: {
cargo-override = self.packages.${final.system}.cargo-override;
}
);
}
// (flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
darwinDeps =
with pkgs;
lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Foundation
libiconv
];
in
{
packages = {
cargo-override = pkgs.rustPlatform.buildRustPackage {
pname = "cargo-override";
version = "unstable-${self.shortRev or "dirty"}";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs =
with pkgs;
[
libssh2
]
++ darwinDeps;
preCheck = ''
export RUST_BACKTRACE=1
'';
checkFlags = [
# Broken when run under the nix sandbox
"--skip=cli_tests::override_subcommand_help_message"
"--skip=git::git_patch"
"--skip=git::git_patch_branch"
"--skip=git::git_patch_branch"
"--skip=git::git_patch_rev"
"--skip=git::git_patch_tag"
"--skip=git::git_patch_tag"
"--skip=git::git_patch_version_missmatch"
"--skip=git::git_patch_version_missmatch"
"--skip=missing_manifest"
"--skip=patch_absolute_path"
"--skip=patch_manifest_doesnt_exist"
];
};
default = self.packages.${system}.cargo-override;
};
apps.default = {
type = "app";
program = "${self.packages.${system}.cargo-override}/bin/cargo-override";
};
formatter = pkgs.nixfmt-rfc-style;
checks.cargo-override = self.packages.${system}.cargo-override.overrideAttrs (
{ ... }:
{
buildPhase = "true";
installPhase = "touch $out";
cargoCheckType = "test";
}
);
devShells.default = pkgs.mkShell {
buildInputs =
with pkgs;
[
# Dependencies
curl
pkg-config
# Additional tools recommended by contributing.md
cargo-insta
cargo-nextest
nil
]
++ darwinDeps;
shellHook = ''
export RUST_BACKTRACE=1
'';
};
}
));
}