-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (96 loc) · 3.12 KB
/
Copy pathflake.nix
File metadata and controls
96 lines (96 loc) · 3.12 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-tinygo.url = "github:NixOS/nixpkgs/b40629efe5d6ec48dd1efba650c797ddbd39ace0";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
obelisk = {
url = "github:obeli-sk/obelisk/latest";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
rust-overlay.follows = "rust-overlay";
};
};
};
outputs = { self, nixpkgs, nixpkgs-tinygo, flake-utils, rust-overlay, obelisk }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
pkgsTinyGo = import nixpkgs-tinygo {
inherit system;
};
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
wit-bindgen-go-cli = pkgs.buildGoModule (rec {
pname = "wit-bindgen-go-cli";
version = "0.7.0"; # NB: Update version in dev-deps.sh
src = pkgs.fetchFromGitHub {
owner = "bytecodealliance";
repo = "go-modules";
rev = "v${version}";
hash = "sha256-bzsB0EsDNk6x1xroIQqbUy7L97JbEJHo7wASnl35X+0=";
};
modMode = "workspace";
subPackages = [ "cmd/wit-bindgen-go" ];
vendorHash = "sha256-9BLzPxLc+HoVQuUtTwLj6QZvN7BLrX5Zy4s5eWTXvwA=";
proxyVendor = true;
});
in
{
devShells.noObelisk = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cargo-edit
rustToolchain
];
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cargo-binstall
cargo-edit
cargo-expand
cargo-generate
just
obelisk.packages.${system}.default
rustToolchain
wasm-tools
# javascript support
nodejs_22
wizer
# Go
go_1_25
pkgsTinyGo.tinygo
wit-bindgen-go-cli
# Python
python314
python314.pkgs.venvShellHook
];
venvDir = "./.venv";
postShellHook = ''
workspace_path=$(realpath "$PWD")
stamp_hash=$(
{
sha256sum requirements.txt flake.lock
printf '%s\n' "$workspace_path"
} | sha256sum | cut -d' ' -f1
)
stamp=".venv/.deps.$stamp_hash"
if [ ! -f "$stamp" ]; then
rm -rf .venv
# venvShellHook will recreate on next entry; or recreate inline:
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt && touch "$stamp"
fi
'';
};
}
);
}