Repository navigation
Expand file tree
/
Copy pathdevshell.nix
More file actions
86 lines (79 loc) · 1.64 KB
/
Copy pathdevshell.nix
File metadata and controls
86 lines (79 loc) · 1.64 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ pkgs, ... }:
let
crb = pkgs.writeShellScriptBin "crb" /* sh */ ''
FEATURES_FLAG=""
RELEASE_FLAG=""
BINARY_NAME=""
REST_ARGS=()
# first arg in bin name
if [[ $# -gt 0 ]]; then
BINARY_NAME="$1"
shift
fi
# use --features flag if provided
while [[ $# -gt 0 ]]; do
case $1 in
--features)
FEATURES_FLAG="--features $2"
shift 2
;;
--release)
RELEASE_FLAG="--release"
shift
;;
*)
REST_ARGS+=("$1")
shift
;;
esac
done
CARGO_ARGS=(cargo run --manifest-path "modules/gui/dotfiles-rs/Cargo.toml")
[[ -n "$RELEASE_FLAG" ]] && CARGO_ARGS+=("$RELEASE_FLAG")
[[ ''${#FEATURES[@]} -gt 0 ]] && CARGO_ARGS+=("''${FEATURES[@]}")
CARGO_ARGS+=(--bin "$BINARY_NAME")
if [[ ''${#REST_ARGS[@]} -gt 0 ]]; then
CARGO_ARGS+=(--)
CARGO_ARGS+=("''${REST_ARGS[@]}")
fi
echo "''${CARGO_ARGS[@]}"
"''${CARGO_ARGS[@]}"
'';
in
pkgs.mkShell {
packages =
with pkgs;
[
age
sops
cachix
deadnix
statix
nil
nixd
nixfmt-rs
pre-commit
cargo-edit
crb
(pkgs.writeShellScriptBin "crrb" /* sh */ ''
crb "$1" --release "''${@:2}"
'')
]
++ [
wlr-randr # used to get display info
];
env = {
# Required by rust-analyzer
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
};
nativeBuildInputs = with pkgs; [
cargo
rustc
rust-analyzer
rustfmt
clippy
pkg-config
];
buildInputs = with pkgs; [
pre-commit
];
}