Skip to content

Commit 8185c73

Browse files
committed
use rust-overlay, refac, and set rust version to stable
1 parent eab1f49 commit 8185c73

File tree

3 files changed

+63
-73
lines changed

3 files changed

+63
-73
lines changed

flake.lock

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

flake.nix

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,60 @@
66
# unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
77

88
flake-utils.url = "github:numtide/flake-utils";
9-
fenix = {
10-
url = "github:nix-community/fenix/monthly";
9+
rust-overlay = {
10+
url = "github:oxalica/rust-overlay";
1111
inputs.nixpkgs.follows = "nixpkgs";
1212
};
1313
};
1414

15-
outputs = { nixpkgs, flake-utils, fenix, /* unstable, */ ... }:
16-
flake-utils.lib.eachDefaultSystem (system:
17-
let
18-
pkgs = nixpkgs.legacyPackages.${system};
19-
# unstable-pkgs = unstable.legacyPackages.${system};
20-
rust-toolchain = import ./nix/rust-toolchain.nix { inherit fenix system; };
15+
outputs = {
16+
nixpkgs,
17+
flake-utils,
18+
rust-overlay,
19+
/*
20+
unstable,
21+
*/
22+
...
23+
}:
24+
flake-utils.lib.eachDefaultSystem (system: let
25+
overlays = [(import rust-overlay)];
26+
pkgs = import nixpkgs {
27+
inherit system overlays;
28+
};
29+
# unstable-pkgs = unstable.legacyPackages.${system};
30+
rust-bin = pkgs.rust-bin.fromRustupToolchainFile ./scraper/rust-toolchain.toml;
2131

22-
common = {
23-
buildInputs = with pkgs; [
24-
gnumake
25-
bun
26-
biome
27-
lefthook
28-
dotenv-cli
29-
prisma
30-
prisma-engines
31-
];
32-
33-
shellHook = with pkgs; ''
34-
# requird by prisma
35-
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine";
36-
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node";
37-
export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine";
38-
export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt";
32+
common = {
33+
packages = with pkgs; [
34+
gnumake
35+
bun
36+
biome
37+
lefthook
38+
dotenv-cli
39+
prisma
40+
prisma-engines
41+
stdenv.cc.cc.lib
42+
];
3943

40-
export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib
41-
'';
44+
env = with pkgs; {
45+
# requird by prisma
46+
PRISMA_QUERY_ENGINE_BINARY = "${prisma-engines}/bin/query-engine";
47+
PRISMA_QUERY_ENGINE_LIBRARY = "${prisma-engines}/lib/libquery_engine.node";
48+
PRISMA_INTROSPECTION_ENGINE_BINARY = "${prisma-engines}/bin/introspection-engine";
49+
PRISMA_FMT_BINARY = "${prisma-engines}/bin/prisma-fmt";
4250
};
43-
in
44-
{
45-
devShells.default = pkgs.mkShell common;
46-
devShells.scraper = pkgs.mkShell {
47-
buildInputs = common.buildInputs ++ [
51+
};
52+
in {
53+
devShells.default = pkgs.mkShell common;
54+
devShells.scraper = pkgs.mkShell {
55+
inherit (common) env;
56+
packages =
57+
common.packages
58+
++ [
4859
pkgs.pkg-config
4960
pkgs.openssl
50-
rust-toolchain
61+
rust-bin
5162
];
52-
shellHook = common.shellHook;
53-
};
54-
});
63+
};
64+
});
5565
}
56-

scraper/rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.82.0"
3-
targets = ["aarch64-apple-darwin", "x86_64-unknown-linux-gnu"]
2+
channel = "stable"
43
components = ["rustc", "cargo", "rustfmt", "clippy"]
4+
targets = []

0 commit comments

Comments
 (0)