Skip to content

Commit 0b00cf3

Browse files
authored
bun.lock に移行と flake のアップデート、あと nix-prisma-utils を使う (#634)
差分: - prisma を NixOS にロードするのに、 nix-prisma-utils を使うようにした。 - flake をアップデート (と `inputs` のリベース) して、 Bun v1.2 をインストール。 - server/package-lock.json の削除。 - nix-prisma-utils が `bun.lock` に対応したため。 VanCoding/nix-prisma-utils#12
1 parent 63309a0 commit 0b00cf3

14 files changed

Lines changed: 2144 additions & 2792 deletions

File tree

.cspell.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
"swiper",
2323
"lefthook",
2424
"stdenv",
25-
"rustc"
25+
"rustc",
26+
"pkgs",
27+
"nixpkgs",
28+
"libquery"
2629
],
2730
"dictionaries": [
2831
"softwareTerms",

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
watch_file ./server/prisma.nix
12
# I recommend using nix-direnv: https://github.com/nix-community/nix-direnv
23
if command -v nix;
34
then

bun.lock

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

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[install]
2+
saveTextLockfile = true

common/bun.lock

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

common/bun.lockb

-3.38 KB
Binary file not shown.

flake.lock

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

flake.nix

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,63 @@
22
description = "CourseMate";
33
inputs = {
44
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
5-
# prisma v6 is only out on unstable uncomment this on updating prisma to v6. can be removed when 25.05 channel is released
6-
# unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
6+
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
77

88
flake-utils.url = "github:numtide/flake-utils";
99
rust-overlay = {
1010
url = "github:oxalica/rust-overlay";
1111
inputs.nixpkgs.follows = "nixpkgs";
1212
};
13+
14+
prisma-utils = {
15+
url = "github:VanCoding/nix-prisma-utils";
16+
# HACK: they have named nixpkgs pkgs. I'm submitting a fix PR soon, rename this to `inputs.nixpkgs.follows` when that gets merged.
17+
inputs.pkgs.follows = "nixpkgs";
18+
};
1319
};
1420

1521
outputs = {
1622
nixpkgs,
1723
flake-utils,
1824
rust-overlay,
19-
/*
20-
unstable,
21-
*/
25+
prisma-utils,
26+
nixpkgs-unstable,
2227
...
2328
}:
2429
flake-utils.lib.eachDefaultSystem (system: let
2530
overlays = [(import rust-overlay)];
2631
pkgs = import nixpkgs {
2732
inherit system overlays;
2833
};
29-
# unstable-pkgs = unstable.legacyPackages.${system};
34+
unstable = nixpkgs-unstable.legacyPackages.${system};
35+
3036
rust-bin = pkgs.rust-bin.fromRustupToolchainFile ./scraper/rust-toolchain.toml;
37+
prisma = pkgs.callPackage ./server/prisma.nix {inherit prisma-utils;};
3138

3239
common = {
33-
packages = with pkgs; [
34-
nix # HACK: to fix the side effect of the hack below, installing two instances of nix
35-
gnumake
36-
bun
37-
nodejs-slim
38-
biome
39-
lefthook
40-
dotenv-cli
41-
prisma
42-
stdenv.cc.cc.lib
43-
];
44-
45-
env = with pkgs; {
46-
# requird by prisma
47-
PRISMA_QUERY_ENGINE_BINARY = "${prisma-engines}/bin/query-engine";
48-
PRISMA_QUERY_ENGINE_LIBRARY = "${prisma-engines}/lib/libquery_engine.node";
49-
PRISMA_INTROSPECTION_ENGINE_BINARY = "${prisma-engines}/bin/introspection-engine";
50-
PRISMA_FMT_BINARY = "${prisma-engines}/bin/prisma-fmt";
40+
packages =
41+
(with pkgs; [
42+
nix # HACK: to fix the side effect of the hack below, installing two instances of nix
43+
gnumake
44+
nodejs
45+
biome
46+
lefthook
47+
dotenv-cli
48+
])
49+
++ (with unstable; [
50+
bun
51+
]);
5152

52-
# HACK: sharp can't find libstdc++.so.6 on bun without this
53-
# - hack because: setting this may break other packages
54-
# - info: it can find libstdc++.so.6 on Node.js
55-
# - info: NobbZ says it's because "We can not set an rpath for a scripting language"
56-
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
57-
};
53+
env =
54+
prisma.env
55+
// {
56+
# HACK: sharp can't find libstdc++.so.6 on bun without this
57+
# - hack because: setting this may break other packages
58+
# - info: it can find libstdc++.so.6 on Node.js
59+
# - info: NobbZ says it's because "We can not set an rpath for a scripting language"
60+
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
61+
};
5862
};
5963
in {
6064
packages.scraper = pkgs.callPackage ./scraper {toolchain = rust-bin;};

0 commit comments

Comments
 (0)