Add Node.js environment
This commit is contained in:
parent
20e8cf8675
commit
4504c0f122
|
@ -10,6 +10,9 @@ nix flake init --template github:the-nix-way/dev-templates#go_1_17
|
|||
# Go 1.18
|
||||
nix flake init --template github:the-nix-way/dev-templates#go_1_18
|
||||
|
||||
# Node.js
|
||||
nix flake init --template github:the-nix-way/dev-templates#node
|
||||
|
||||
# Rust
|
||||
nix flake init --template github:the-nix-way/dev-templates#rust
|
||||
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
description = "Go 1.18 development environment";
|
||||
};
|
||||
|
||||
node = {
|
||||
path = ./node;
|
||||
description = "Node.js development environment";
|
||||
};
|
||||
|
||||
rust = {
|
||||
path = ./rust;
|
||||
description = "Rust development environment";
|
||||
|
|
1
node/.envrc
Normal file
1
node/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake .
|
42
node/flake.lock
Normal file
42
node/flake.lock
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1659041591,
|
||||
"narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
36
node/flake.nix
Normal file
36
node/flake.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
inherit (pkgs) mkShell;
|
||||
|
||||
nodejs = pkgs.nodejs;
|
||||
pnpm = pkgs.nodePackages.pnpm;
|
||||
yarn = pkgs.yarn;
|
||||
|
||||
in {
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
pnpm
|
||||
(yarn.override { inherit nodejs; })
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "node `${nodejs}/bin/node --version`"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue