diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 748aac2..09f234b 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,6 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# NixOS +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..55e11a8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1674236650, + "narHash": "sha256-B4GKL1YdJnII6DQNNJ4wDW1ySJVx2suB1h/v4Ql8J0Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "cfb43ad7b941d9c3606fb35d91228da7ebddbfc5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ab6f638 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "A Nix-flake-based Node.js development environment for Xyter"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + }; + + outputs = { self, flake-utils, nixpkgs }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (self: super: rec { nodejs = super.nodejs-19_x; }) ]; + pkgs = import nixpkgs { inherit overlays system; }; + in { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + node2nix + docker + nodejs + + # Node Packages + nodePackages.typescript + nodePackages.prisma + ]; + shellHook = with pkgs; '' + export PRISMA_MIGRATION_ENGINE_BINARY="${prisma-engines}/bin/migration-engine" + 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" + ''; + }; + }); +}