Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"swiper",
"lefthook",
"stdenv",
"rustc"
"rustc",
"pkgs",
"nixpkgs",
"libquery"
],
"dictionaries": [
"softwareTerms",
Expand Down
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
watch_file ./server/prisma.nix
# I recommend using nix-direnv: https://github.com/nix-community/nix-direnv
if command -v nix;
then
Expand Down
423 changes: 423 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[install]
saveTextLockfile = true
32 changes: 32 additions & 0 deletions common/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed common/bun.lockb
Binary file not shown.
84 changes: 78 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 34 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,63 @@
description = "CourseMate";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
# prisma v6 is only out on unstable uncomment this on updating prisma to v6. can be removed when 25.05 channel is released
# unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};

prisma-utils = {
url = "github:VanCoding/nix-prisma-utils";
# HACK: they have named nixpkgs pkgs. I'm submitting a fix PR soon, rename this to `inputs.nixpkgs.follows` when that gets merged.
inputs.pkgs.follows = "nixpkgs";
};
};

outputs = {
nixpkgs,
flake-utils,
rust-overlay,
/*
unstable,
*/
prisma-utils,
nixpkgs-unstable,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
# unstable-pkgs = unstable.legacyPackages.${system};
unstable = nixpkgs-unstable.legacyPackages.${system};

rust-bin = pkgs.rust-bin.fromRustupToolchainFile ./scraper/rust-toolchain.toml;
prisma = pkgs.callPackage ./server/prisma.nix {inherit prisma-utils;};

common = {
packages = with pkgs; [
nix # HACK: to fix the side effect of the hack below, installing two instances of nix
gnumake
bun
nodejs-slim
biome
lefthook
dotenv-cli
prisma
stdenv.cc.cc.lib
];

env = with pkgs; {
# requird by prisma
PRISMA_QUERY_ENGINE_BINARY = "${prisma-engines}/bin/query-engine";
PRISMA_QUERY_ENGINE_LIBRARY = "${prisma-engines}/lib/libquery_engine.node";
PRISMA_INTROSPECTION_ENGINE_BINARY = "${prisma-engines}/bin/introspection-engine";
PRISMA_FMT_BINARY = "${prisma-engines}/bin/prisma-fmt";
packages =
(with pkgs; [
nix # HACK: to fix the side effect of the hack below, installing two instances of nix
gnumake
nodejs
biome
lefthook
dotenv-cli
])
++ (with unstable; [
bun
]);

# HACK: sharp can't find libstdc++.so.6 on bun without this
# - hack because: setting this may break other packages
# - info: it can find libstdc++.so.6 on Node.js
# - info: NobbZ says it's because "We can not set an rpath for a scripting language"
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
};
env =
prisma.env
// {
# HACK: sharp can't find libstdc++.so.6 on bun without this
# - hack because: setting this may break other packages
# - info: it can find libstdc++.so.6 on Node.js
# - info: NobbZ says it's because "We can not set an rpath for a scripting language"
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
};
};
in {
packages.scraper = pkgs.callPackage ./scraper {toolchain = rust-bin;};
Expand Down
Loading