-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathflake.nix
94 lines (78 loc) · 2.33 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
{
description = "Tool for pointing out issues in Nixpkgs packages";
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, flake-compat, nixpkgs, utils }: {
overlays = {
default =
final:
prev:
{
nixpkgs-hammering =
prev.rustPlatform.buildRustPackage {
pname = "nixpkgs-hammering";
version = (prev.lib.importTOML ./Cargo.toml).package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with prev; [
makeWrapper
];
passthru = {
exePath = "/bin/nixpkgs-hammer";
};
# Running tests is slow and requires properly placed overlays.
# We are doing that in CI outside of the derivation.
doCheck = false;
postInstall = ''
datadir="$out/share/nixpkgs-hammering"
mkdir -p "$datadir"
wrapProgram "$out/bin/nixpkgs-hammer" \
--prefix PATH ":" ${prev.lib.makeBinPath [
prev.nix
]} \
--set OVERLAYS_DIR "$datadir/overlays"
cp -r ${./overlays} "$datadir/overlays"
cp -r ${./lib} "$datadir/lib"
'';
};
};
};
} // utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; };
in {
packages = rec {
default = nixpkgs-hammering;
nixpkgs-hammering = (self.overlays.default pkgs pkgs).nixpkgs-hammering;
};
apps = rec {
nixpkgs-hammer = utils.lib.mkApp {
drv = self.packages.${system}.nixpkgs-hammering;
};
default = nixpkgs-hammer;
};
devShells = {
default =
pkgs.mkShell {
buildInputs = with pkgs; [
rustc
cargo
rust-analyzer
rustfmt
];
};
# For legacy shell.nix
nixpkgs-hammering =
pkgs.mkShell {
buildInputs = with pkgs; [
self.packages.${system}.nixpkgs-hammering
];
};
};
});
}