Skip to content

Commit 5dfcbec

Browse files
committed
ignore: add flake
1 parent 8f6a728 commit 5dfcbec

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

flake.lock

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
description = "suzuri";
3+
inputs = {
4+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
flake-utils.url = "github:numtide/flake-utils";
6+
crane.url = "github:ipetkov/crane";
7+
crane.inputs.nixpkgs.follows = "nixpkgs";
8+
rust-overlay = {
9+
url = "github:oxalica/rust-overlay";
10+
inputs = {
11+
nixpkgs.follows = "nixpkgs";
12+
flake-utils.follows = "flake-utils";
13+
};
14+
};
15+
};
16+
outputs = inputs@{ flake-utils, crane, rust-overlay, nixpkgs, ... }:
17+
flake-utils.lib.eachDefaultSystem (system:
18+
let
19+
pkgs = import nixpkgs {
20+
inherit system;
21+
config.allowUnfree = true;
22+
overlays = [ (import rust-overlay) ];
23+
};
24+
25+
rustToolchain = pkgs.rust-bin.nightly.latest.default;
26+
27+
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
28+
29+
watch-script = name: body:
30+
pkgs.writeShellScriptBin name ''
31+
while sleep 1; do
32+
echo "File list changed; restarting entr."
33+
echo "$(fd -p 'Cargo.toml|Cargo.lock|\.rs$' . -E 'legacy/' --no-ignore -E 'target/')" | \
34+
entr -scrd 'echo "$(date): files changed; rerunning command\n" && ${body}'
35+
done
36+
'';
37+
in {
38+
devShells.default = craneLib.devShell rec {
39+
name = "suzuri";
40+
LD_LIBRARY_PATH =
41+
"${nixpkgs.lib.strings.makeLibraryPath buildInputs}";
42+
buildInputs = with pkgs; [
43+
(watch-script "watch-run" ''
44+
cargo run --release
45+
'')
46+
(watch-script "watch-test" ''
47+
sleep 0.2
48+
cargo nextest run --release
49+
'')
50+
entr
51+
cargo-nextest
52+
pgformatter
53+
sqlx-cli
54+
gcc
55+
nixfmt
56+
nodejs
57+
nodePackages.npm
58+
nodePackages.sass
59+
openssl
60+
pkg-config
61+
postgresql_16
62+
python3
63+
rlwrap
64+
rust-analyzer
65+
tailwindcss
66+
taplo
67+
];
68+
};
69+
});
70+
}

0 commit comments

Comments
 (0)