about summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
authorAlan Pearce2023-09-12 10:55:15 +0200
committerAlan Pearce2023-09-12 10:55:15 +0200
commit7fc8048d3104cf9e129920326b30aaefaaaeb89b (patch)
treebfd093932e8f5332877d9fd2a189b27ee044e8f5 /flake.nix
parent51cc4389f6dc7947ee34d1b3367876941e8a8fbc (diff)
downloadwebsite-7fc8048d3104cf9e129920326b30aaefaaaeb89b.tar.lz
website-7fc8048d3104cf9e129920326b30aaefaaaeb89b.tar.zst
website-7fc8048d3104cf9e129920326b30aaefaaaeb89b.zip
Init flake
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..04bef10
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,31 @@
+{
+  description = "A Nix-flake-based Node.js development environment";
+
+  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+  outputs = { self, nixpkgs }:
+    let
+      overlays = [
+        (final: prev: rec {
+          nodejs = prev.nodejs-18_x;
+          bun = (prev.bun.override { inherit nodejs; });
+        })
+      ];
+      supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
+      forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
+        pkgs = import nixpkgs { inherit overlays system; };
+      });
+    in
+    {
+      devShells = forEachSupportedSystem ({ pkgs }: {
+        default = pkgs.mkShell {
+          packages = with pkgs; [
+            node2nix
+            nodejs
+          ] ++ (with pkgs.nodePackages; [
+            prettier
+          ]);
+        };
+      });
+    };
+}