Configure NixOS development environment for Lichess

* Read Node version from .node-version for single source of truth
* Use dart-sass instead of embedded to avoid NixOS dynamic linking issues
* Add Redis to dev dependencies
* Set SASS_PATH to use system dart-sass via SASS_PATH env var
* Update shellHook with LD_LIBRARY_PATH for NixOS compatibility
This commit is contained in:
Alexei Pastuchov
2026-04-08 21:42:26 +02:00
parent aa08de13e3
commit 8fe4f4e342
2 changed files with 22 additions and 9 deletions
Generated
+5 -5
View File
@@ -2,12 +2,12 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1771848320, "lastModified": 1775423009,
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
"rev": "2fc6539b481e1d2569f25f8799236694180c0993", "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
"revCount": 953160, "revCount": 975402,
"type": "tarball", "type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.953160%2Brev-2fc6539b481e1d2569f25f8799236694180c0993/019c8e05-d2f6-7c7e-9ead-612154b18bfb/source.tar.gz" "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.975402%2Brev-68d8aa3d661f0e6bd5862291b5bb263b2a6595c9/019d657b-b3b7-7288-b3c0-42d420df206b/source.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
+17 -4
View File
@@ -8,6 +8,9 @@
let let
javaVersion = 21; javaVersion = 21;
# Source of truth for Node version is .node-version
nodeVersionFile = builtins.readFile ./.node-version;
nodeMajorVersion = builtins.elemAt (inputs.nixpkgs.lib.strings.split "\\." (builtins.replaceStrings [ "v" ] [ "" ] nodeVersionFile)) 0;
supportedSystems = [ supportedSystems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
@@ -37,8 +40,8 @@
sbt = prev.sbt.override { jre = jdk; }; sbt = prev.sbt.override { jre = jdk; };
scala = prev.scala_3.override { jre = jdk; }; scala = prev.scala_3.override { jre = jdk; };
nodejs_24 = prev.nodejs_24; nodejs = prev."nodejs_${nodeMajorVersion}";
pnpm = (prev.pnpm.override { nodejs = prev.nodejs_24; }); pnpm = (prev.pnpm.override { inherit nodejs; });
esbuild = prev.esbuild.overrideAttrs (previousAttrs: rec { esbuild = prev.esbuild.overrideAttrs (previousAttrs: rec {
version = "0.25.11"; version = "0.25.11";
@@ -56,9 +59,10 @@
{ {
default = pkgs.mkShellNoCC { default = pkgs.mkShellNoCC {
packages = with pkgs; [ packages = with pkgs; [
nodejs_24 nodejs
nodePackages.pnpm pnpm
esbuild esbuild
dart-sass
oxlint oxlint
oxfmt oxfmt
stylelint stylelint
@@ -67,7 +71,16 @@
scala scala
sbt sbt
coursier coursier
mongosh
redis
]; ];
# Required for NixOS to run prebuilt binaries from npm packages
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ]}:$LD_LIBRARY_PATH
# Use dart-sass instead of npm's sass-embedded
export SASS_PATH=${pkgs.dart-sass}/bin/sass
'';
}; };
} }
); );