diff --git a/flake.lock b/flake.lock index 478bad12..1ea31523 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": { @@ -40,91 +40,37 @@ "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": 1731974111, - "narHash": "sha256-sq5EjHYtnJu9uF7qmadiMAw/EkI94JPW/bwMUWKUKs4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ff377cce50a8af30c173382a166e6c74802ed9ae", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, - "pkgs": { - "locked": { - "lastModified": 1718870667, - "narHash": "sha256-jab3Kpc8O1z3qxwVsCMHL4+18n5Wy/HHKyu1fcsF7gs=", + "lastModified": 1736200483, + "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b10b8f00cb5494795e5f51b39210fed4d2b0748", + "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "release-24.11", "repo": "nixpkgs", "type": "github" } }, - "prisma-utils": { - "inputs": { - "flake-utils": "flake-utils_2", - "pkgs": "pkgs" - }, - "locked": { - "lastModified": 1719301942, - "narHash": "sha256-qKvcOVKoZqCfkR7Mt+7LCrsXMCNysY6JSy6QY/vXP4g=", - "owner": "VanCoding", - "repo": "nix-prisma-utils", - "rev": "3bf92853b6986daca112b7e07fc33f976f48ffe7", - "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" + "nixpkgs": "nixpkgs" } }, "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": { @@ -148,21 +94,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index dc8ac134..50ed1c3d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,41 +1,54 @@ { description = "CourseMate"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/master"; + 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"; + 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, flake-utils, fenix, /* unstable, */ ... }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; - prisma = import ./nix/prisma.nix { inherit prisma-utils pkgs; }; - rust-pkgs = import ./nix/rust-toolchain.nix { inherit fenix system; }; - in - { - devShell = pkgs.mkShell { - src = ./.; - nativeBuildInputs = with pkgs; [ bashInteractive ]; + pkgs = nixpkgs.legacyPackages.${system}; + # unstable-pkgs = unstable.legacyPackages.${system}; + rust-toolchain = import ./nix/rust-toolchain.nix { inherit fenix system; }; + + common = { buildInputs = with pkgs; [ gnumake bun biome - pkg-config - openssl lefthook - pkgs.prisma dotenv-cli - ] ++ [ - rust-pkgs + prisma + prisma-engines + ]; + + shellHook = with pkgs; '' + # requird by prisma + 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 + { + devShells.default = pkgs.mkShell common; + devShells.scraper = pkgs.mkShell { + buildInputs = common.buildInputs ++ [ + pkgs.pkg-config + pkgs.openssl + rust-toolchain ]; - shellHook = '' - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib - '' + prisma.shellHook; + shellHook = common.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 ""); -}