-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
72 lines (70 loc) · 1.49 KB
/
Copy pathshell.nix
File metadata and controls
72 lines (70 loc) · 1.49 KB
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
{
crane,
callPackage,
writeShellApplication,
fetchFromGitHub,
act,
}:
let
cargo-wrapper =
let
inherit (crane) cargo;
in
writeShellApplication {
name = "cargo-wrapper";
text = ''
if [ "$1" == "check" ]; then
${cargo}/bin/cargo clippy "''${@:2}"
else
${cargo}/bin/cargo "$@"
fi
'';
};
toolchain = crane.rustc.overrideAttrs (prev: {
buildCommand = prev.buildCommand + ''
cp -f ${cargo-wrapper}/bin/cargo-wrapper $out/bin/cargo
'';
});
knope =
let
src = crane.cleanCargoSource (fetchFromGitHub {
owner = "knope-dev";
repo = "knope";
rev = "knope/v0.18.1";
hash = "sha256-KA5ePuN9MWbhsrz3UVr8brbs77P0AHXK/3f6RccfWac=";
});
commonArgs = {
inherit src;
inherit (crane.crateNameFromCargoToml { cargoToml = "${src}/crates/knope/Cargo.toml"; })
pname
version
;
strictDeps = true;
};
cargoArtifacts = crane.buildDepsOnly commonArgs;
in
crane.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
cargoExtraArgs = "-p knope";
doCheck = false;
}
);
in
crane.devShell {
name = "rofi-jetbrains";
inputsFrom = [
(callPackage ./. { inherit crane; })
];
packages = [
act
knope
];
shellHook = ''
if [ ! -d .direnv/links/rust ]; then
mkdir -p .direnv/links/
ln -sf "${toolchain}" .direnv/links/rust
fi
'';
}