From 38f00f2a1ed68d93d0e19415607d8d61a4eef0ce Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:16:38 +0900 Subject: [PATCH 1/8] rebase nixpkgs to release-24.11 --- flake.lock | 8 ++++---- flake.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 478bad12..cebc8ad4 100644 --- a/flake.lock +++ b/flake.lock @@ -60,16 +60,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1731974111, - "narHash": "sha256-sq5EjHYtnJu9uF7qmadiMAw/EkI94JPW/bwMUWKUKs4=", + "lastModified": 1736157590, + "narHash": "sha256-g+ZmD2im7YQ9TVW7xSWSdXuwVAtzhEZ7MdyKnOaqOrk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ff377cce50a8af30c173382a166e6c74802ed9ae", + "rev": "08d50bdd3757fc50f05130a85ff91a901a5e5205", "type": "github" }, "original": { "owner": "NixOS", - "ref": "master", + "ref": "release-24.11", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index dc8ac134..208e89d9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "CourseMate"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/master"; + nixpkgs.url = "github:NixOS/nixpkgs/release-24.11"; flake-utils.url = "github:numtide/flake-utils"; prisma-utils.url = "github:VanCoding/nix-prisma-utils"; fenix = { From a1160438e4e853d9fbb816a7369bad098548269d Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:20:27 +0900 Subject: [PATCH 2/8] fix flake.nix and update flake.lock --- flake.lock | 18 +++++++++--------- flake.nix | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index cebc8ad4..71004da4 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1730442928, - "narHash": "sha256-U1DWb5c3EfkA7pqx5V1H4AWRA+EaE6UJ0lIRvK1RxgM=", + "lastModified": 1735713283, + "narHash": "sha256-xC6X49L55xo7AV+pAYclOj5UNWtBo/xx5aB5IehJD0M=", "owner": "nix-community", "repo": "fenix", - "rev": "87b4d20f896c99018dde4702a9c6157b516f2a76", + "rev": "bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c", "type": "github" }, "original": { @@ -96,11 +96,11 @@ "pkgs": "pkgs" }, "locked": { - "lastModified": 1719301942, - "narHash": "sha256-qKvcOVKoZqCfkR7Mt+7LCrsXMCNysY6JSy6QY/vXP4g=", + "lastModified": 1734558246, + "narHash": "sha256-XX7mKzz6yKEfB06OgqJ3ml8ST/IzQklfsR2/o0Pksgc=", "owner": "VanCoding", "repo": "nix-prisma-utils", - "rev": "3bf92853b6986daca112b7e07fc33f976f48ffe7", + "rev": "f21d11cec47b1747ed44d912682e8f8edcc7d859", "type": "github" }, "original": { @@ -120,11 +120,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1730386175, - "narHash": "sha256-0Uq+/B8eu7pw8B8pxuGdFYKjcVLwNMcHfDxU9sXh7rg=", + "lastModified": 1735659655, + "narHash": "sha256-DQgwi3pwaasWWDfNtXIX0lW5KvxQ+qVhxO1J7l68Qcc=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "0ba893e1a00d92557ac91efb771d72eee36ca687", + "rev": "085ad107943996c344633d58f26467b05f8e2ff0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 208e89d9..e4af00e6 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,8 @@ rust-pkgs ]; shellHook = '' - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib + # no longer necessary + # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib '' + prisma.shellHook; }; }); From c9ac018fda52a21568fc3e2f129d83b17d3e7fd3 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:21:36 +0900 Subject: [PATCH 3/8] fix(flake): remove bashInteractive from nativeBuildInputs --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index e4af00e6..2ff378c4 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,6 @@ { devShell = pkgs.mkShell { src = ./.; - nativeBuildInputs = with pkgs; [ bashInteractive ]; buildInputs = with pkgs; [ gnumake bun From 2a5f346c855c1ed3aaf9a2acb4f17593b0425e16 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:45:52 +0900 Subject: [PATCH 4/8] use prisma from unstable instead of from prisma-utils --- flake.lock | 72 +++++++------------------------------------------- flake.nix | 39 ++++++++++++++++----------- nix/prisma.nix | 12 --------- 3 files changed, 34 insertions(+), 89 deletions(-) delete mode 100644 nix/prisma.nix diff --git a/flake.lock b/flake.lock index 71004da4..af8e6561 100644 --- a/flake.lock +++ b/flake.lock @@ -40,24 +40,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1736157590, @@ -74,47 +56,12 @@ "type": "github" } }, - "pkgs": { - "locked": { - "lastModified": 1718870667, - "narHash": "sha256-jab3Kpc8O1z3qxwVsCMHL4+18n5Wy/HHKyu1fcsF7gs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9b10b8f00cb5494795e5f51b39210fed4d2b0748", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "prisma-utils": { - "inputs": { - "flake-utils": "flake-utils_2", - "pkgs": "pkgs" - }, - "locked": { - "lastModified": 1734558246, - "narHash": "sha256-XX7mKzz6yKEfB06OgqJ3ml8ST/IzQklfsR2/o0Pksgc=", - "owner": "VanCoding", - "repo": "nix-prisma-utils", - "rev": "f21d11cec47b1747ed44d912682e8f8edcc7d859", - "type": "github" - }, - "original": { - "owner": "VanCoding", - "repo": "nix-prisma-utils", - "type": "github" - } - }, "root": { "inputs": { "fenix": "fenix", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "prisma-utils": "prisma-utils" + "unstable": "unstable" } }, "rust-analyzer-src": { @@ -149,18 +96,19 @@ "type": "github" } }, - "systems_2": { + "unstable": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1736042175, + "narHash": "sha256-jdd5UWtLVrNEW8K6u5sy5upNAFmF3S4Y+OIeToqJ1X8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bf689c40d035239a489de5997a4da5352434632e", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", "type": "github" } } diff --git a/flake.nix b/flake.nix index 2ff378c4..91959974 100644 --- a/flake.nix +++ b/flake.nix @@ -2,40 +2,49 @@ description = "CourseMate"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/release-24.11"; + unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; - prisma-utils.url = "github:VanCoding/nix-prisma-utils"; fenix = { url = "github:nix-community/fenix/monthly"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, flake-utils, prisma-utils, fenix, ... }: + outputs = { nixpkgs, unstable, flake-utils, fenix, ... }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; - prisma = import ./nix/prisma.nix { inherit prisma-utils pkgs; }; + pkgs = nixpkgs.legacyPackages.${system}; + unstable-pkgs = unstable.legacyPackages.${system}; rust-pkgs = import ./nix/rust-toolchain.nix { inherit fenix system; }; in - { - devShell = pkgs.mkShell { - src = ./.; + rec { + devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ gnumake bun biome - pkg-config - openssl lefthook - pkgs.prisma dotenv-cli - ] ++ [ - rust-pkgs + unstable-pkgs.prisma ]; + shellHook = '' - # no longer necessary - # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib - '' + prisma.shellHook; + # requird by prisma + export PRISMA_QUERY_ENGINE_BINARY="${unstable-pkgs.prisma-engines}/bin/query-engine"; + export PRISMA_QUERY_ENGINE_LIBRARY="${unstable-pkgs.prisma-engines}/lib/libquery_engine.node"; + export PRISMA_INTROSPECTION_ENGINE_BINARY="${unstable-pkgs.prisma-engines}/bin/introspection-engine"; + export PRISMA_FMT_BINARY="${unstable-pkgs.prisma-engines}/bin/prisma-fmt"; + ''; + }; + devShells.scraper = pkgs.mkShell { + buildInputs = devShells.default.buildInputs ++ (with pkgs; [ + pkg-config + openssl + rust-pkgs + ]); + shellHook = devShells.default.shellHook; }; }); } + diff --git a/nix/prisma.nix b/nix/prisma.nix deleted file mode 100644 index 563d59d3..00000000 --- a/nix/prisma.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ prisma-utils, pkgs }: rec { - prisma = (prisma-utils.lib.prisma-factory { - nixpkgs = pkgs; - prisma-fmt-hash = "sha256-atD5GZfmeU86mF1V6flAshxg4fFR2ews7EwaJWZZzbc="; # just copy these hashes for now, and then change them when nix complains about the mismatch - query-engine-hash = "sha256-8FTZaKmQCf9lrDQvkF5yWPeZ7TSVfFjTbjdbWWEHgq4="; - libquery-engine-hash = "sha256-USIdaum87ekGY6F6DaL/tKH0BAZvHBDK7zjmCLo//kM="; - schema-engine-hash = "sha256-k5MkxXViEqojbkkcW/4iBFNdfhb9PlMEF1M2dyhfOok="; - }).fromNpmLock - ./../server/package-lock.json; # <--- path to our package-lock.json file that contains the version of prisma-engines - - shellHook = (if pkgs.system == "x86_64-linux" then prisma.shellHook else ""); -} From 1aeba751e8de24dcc772e5cd544a9cbe6bb113f7 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:48:22 +0900 Subject: [PATCH 5/8] rename var + update input --- flake.lock | 6 +++--- flake.nix | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index af8e6561..8fad52b4 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1736157590, - "narHash": "sha256-g+ZmD2im7YQ9TVW7xSWSdXuwVAtzhEZ7MdyKnOaqOrk=", + "lastModified": 1736200483, + "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "08d50bdd3757fc50f05130a85ff91a901a5e5205", + "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 91959974..f1190aa9 100644 --- a/flake.nix +++ b/flake.nix @@ -17,9 +17,8 @@ pkgs = nixpkgs.legacyPackages.${system}; unstable-pkgs = unstable.legacyPackages.${system}; rust-pkgs = import ./nix/rust-toolchain.nix { inherit fenix system; }; - in - rec { - devShells.default = pkgs.mkShell { + + common = { buildInputs = with pkgs; [ gnumake bun @@ -37,13 +36,16 @@ export PRISMA_FMT_BINARY="${unstable-pkgs.prisma-engines}/bin/prisma-fmt"; ''; }; + in + { + devShells.default = pkgs.mkShell common; devShells.scraper = pkgs.mkShell { - buildInputs = devShells.default.buildInputs ++ (with pkgs; [ + buildInputs = common.buildInputs ++ (with pkgs; [ pkg-config openssl rust-pkgs ]); - shellHook = devShells.default.shellHook; + shellHook = common.shellHook; }; }); } From ee1cb487be44da6978fed144d88f0f73a5c983da Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:52:24 +0900 Subject: [PATCH 6/8] doc: add comment why we need unstable --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index f1190aa9..9703f093 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,7 @@ description = "CourseMate"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/release-24.11"; + # prisma v6 is only out on unstable. can be removed when 25.05 channel is released unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; From e1c6a0cca7fe965b4e45b59269c2a96c0f0afece Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:54:22 +0900 Subject: [PATCH 7/8] refac: rename rust-pkgs to rust-toolchain, and delete suspicious with pkgs; --- flake.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 9703f093..6abb8d5b 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ let pkgs = nixpkgs.legacyPackages.${system}; unstable-pkgs = unstable.legacyPackages.${system}; - rust-pkgs = import ./nix/rust-toolchain.nix { inherit fenix system; }; + rust-toolchain = import ./nix/rust-toolchain.nix { inherit fenix system; }; common = { buildInputs = with pkgs; [ @@ -41,11 +41,11 @@ { devShells.default = pkgs.mkShell common; devShells.scraper = pkgs.mkShell { - buildInputs = common.buildInputs ++ (with pkgs; [ - pkg-config - openssl - rust-pkgs - ]); + buildInputs = common.buildInputs ++ [ + pkgs.pkg-config + pkgs.openssl + rust-toolchain + ]; shellHook = common.shellHook; }; }); From b7843c641d6da74233b40caa2df787d02b6b90c1 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:13:12 +0900 Subject: [PATCH 8/8] remove unstable, because we not prisma v6 yet --- flake.lock | 19 +------------------ flake.nix | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/flake.lock b/flake.lock index 8fad52b4..1ea31523 100644 --- a/flake.lock +++ b/flake.lock @@ -60,8 +60,7 @@ "inputs": { "fenix": "fenix", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "unstable": "unstable" + "nixpkgs": "nixpkgs" } }, "rust-analyzer-src": { @@ -95,22 +94,6 @@ "repo": "default", "type": "github" } - }, - "unstable": { - "locked": { - "lastModified": 1736042175, - "narHash": "sha256-jdd5UWtLVrNEW8K6u5sy5upNAFmF3S4Y+OIeToqJ1X8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "bf689c40d035239a489de5997a4da5352434632e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6abb8d5b..50ed1c3d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,8 @@ description = "CourseMate"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/release-24.11"; - # prisma v6 is only out on unstable. can be removed when 25.05 channel is released - unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + # 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"; flake-utils.url = "github:numtide/flake-utils"; fenix = { @@ -12,11 +12,11 @@ }; }; - outputs = { nixpkgs, unstable, flake-utils, fenix, ... }: + outputs = { nixpkgs, flake-utils, fenix, /* unstable, */ ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - unstable-pkgs = unstable.legacyPackages.${system}; + # unstable-pkgs = unstable.legacyPackages.${system}; rust-toolchain = import ./nix/rust-toolchain.nix { inherit fenix system; }; common = { @@ -26,15 +26,16 @@ biome lefthook dotenv-cli - unstable-pkgs.prisma + prisma + prisma-engines ]; - shellHook = '' + shellHook = with pkgs; '' # requird by prisma - export PRISMA_QUERY_ENGINE_BINARY="${unstable-pkgs.prisma-engines}/bin/query-engine"; - export PRISMA_QUERY_ENGINE_LIBRARY="${unstable-pkgs.prisma-engines}/lib/libquery_engine.node"; - export PRISMA_INTROSPECTION_ENGINE_BINARY="${unstable-pkgs.prisma-engines}/bin/introspection-engine"; - export PRISMA_FMT_BINARY="${unstable-pkgs.prisma-engines}/bin/prisma-fmt"; + export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine"; + export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node"; + export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine"; + export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt"; ''; }; in