forked from anil-e/codd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
112 lines (100 loc) · 2.81 KB
/
Copy pathflake.nix
File metadata and controls
112 lines (100 loc) · 2.81 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
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
{
description = "Codd Dev Shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
inputs.systems.url = "github:nix-systems/default";
inputs.flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs =
{
nixpkgs,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustStable = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rustfmt"
"clippy"
];
};
rustNightly = pkgs.rust-bin.selectLatestNightlyWith (
t: t.default.override { extensions = [ "rustfmt" ]; }
);
rustfmtWrapper = pkgs.writeShellScriptBin "rustfmt" ''
exec "${rustNightly}/bin/rustfmt" "$@"
'';
cargo = pkgs.writeShellScriptBin "cargo" ''
set -euo pipefail
run_tc() {
local tc_bin="$1"
shift
exec env \
PATH="$tc_bin:$PATH" \
RUSTFMT="$tc_bin/rustfmt" \
"$@"
}
if [ "''${1:-}" = "+nightly" ]; then
shift
run_tc "${rustNightly}/bin" "${rustNightly}/bin/cargo" "$@"
elif [ "''${1:-}" = "+stable" ]; then
shift
run_tc "${rustStable}/bin" "${rustStable}/bin/cargo" "$@"
elif [ "''${1:-}" = "fmt" ]; then
run_tc "${rustNightly}/bin" "${rustNightly}/bin/cargo" "$@"
else
run_tc "${rustStable}/bin" "${rustStable}/bin/cargo" "$@"
fi
'';
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
gtk4
libadwaita
glib
gettext
openssl
gsettings-desktop-schemas
gtksourceview5
];
nativeBuildInputs = with pkgs; [
pkg-config
meson
ninja
desktop-file-utils
appstream
wrapGAppsHook4
];
shellHook = ''
export XDG_DATA_DIRS="${pkgs.gtk4}/share:${pkgs.libadwaita}/share:${pkgs.gsettings-desktop-schemas}/share:${pkgs.glib}/share:$XDG_DATA_DIRS"
'';
packages = with pkgs; [
bashInteractive
cargo
cargo-outdated
rustfmtWrapper
rustStable
rustNightly
rust-analyzer
clang
gcc
flatpak-builder
(python3.withPackages (ps: with ps; [
aiohttp
tomlkit
]))
];
};
}
);
}