From e1171fc2820af5aaed1a495e624294fa177cb033 Mon Sep 17 00:00:00 2001 From: davidnbr Date: Sat, 31 Jan 2026 21:03:50 -0500 Subject: [PATCH 1/5] feat: add nodejs_X_Y aliases for better nix ergonomics --- README.md | 4 +++- flake.nix | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01606cf..73cf121 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,9 @@ Inspired by [nixpkgs-terraform](https://github.com/stackbuilders/nixpkgs-terrafo ### Ad-hoc Shell ```bash -nix shell github:davidnbr/nixpkgs-nodejs#"20.11.0" +nix shell github:davidnbr/nixpkgs-nodejs#"20.11" +# Or using the alias (friendly for Nix expressions) +nix shell github:davidnbr/nixpkgs-nodejs#nodejs_20_11 ``` ### List Available Versions diff --git a/flake.nix b/flake.nix index 6347cd8..7e73239 100644 --- a/flake.nix +++ b/flake.nix @@ -53,9 +53,20 @@ # Generate all packages for a given system packagesForSystem = system: - builtins.mapAttrs - (version: versionInfo: lib.getNodejs { inherit system version; }) - versionMap; + let + basePackages = builtins.mapAttrs + (version: versionInfo: lib.getNodejs { inherit system version; }) + versionMap; + + # Create aliases like nodejs_20_18 for 20.18 + aliases = nixpkgs.lib.mapAttrs' + (version: pkg: nixpkgs.lib.nameValuePair + ("nodejs_" + (builtins.replaceStrings ["."] ["_"] version)) + pkg + ) + basePackages; + in + basePackages // aliases; in { # Packages for all systems From 00b54bd21756a02a0165bd060bae8ff09292f66f Mon Sep 17 00:00:00 2001 From: davidnbr Date: Sat, 31 Jan 2026 21:05:41 -0500 Subject: [PATCH 2/5] chore: update readme with new aliases --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73cf121..ff83a04 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Inspired by [nixpkgs-terraform](https://github.com/stackbuilders/nixpkgs-terrafo in { devShells.${system}.default = pkgs.mkShell { packages = [ - nixpkgs-nodejs.packages.${system}."20.11.0" + nixpkgs-nodejs.packages.${system}.'"20.11.0"' ]; }; }; @@ -39,7 +39,7 @@ Inspired by [nixpkgs-terraform](https://github.com/stackbuilders/nixpkgs-terrafo ### Ad-hoc Shell ```bash -nix shell github:davidnbr/nixpkgs-nodejs#"20.11" +nix shell github:davidnbr/nixpkgs-nodejs#'"20.11"' # Or using the alias (friendly for Nix expressions) nix shell github:davidnbr/nixpkgs-nodejs#nodejs_20_11 ``` From 20055a2c3af53c02f76ff2631c363236c1186f72 Mon Sep 17 00:00:00 2001 From: davidnbr Date: Sat, 31 Jan 2026 21:10:48 -0500 Subject: [PATCH 3/5] ci: use nodejs_X_Y aliases and refine build/verify steps --- .github/workflows/update-versions.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index 5cfc6c5..0182021 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -120,19 +120,27 @@ jobs: - name: Build ${{ matrix.version }} version run: | TARGET_SYSTEM=${{ matrix.runner.system }} + # Convert version (e.g., "20.20") to alias (e.g., "nodejs_20_20") + VERSION_ALIAS="nodejs_${{ matrix.version }}" + VERSION_ALIAS=${VERSION_ALIAS//./_} + cachix watch-store nixpkgs-nodejs & WATCH_PID=$! - nix build .#packages.$TARGET_SYSTEM.\"${{ matrix.version }}\" -L + echo "Building $VERSION_ALIAS for $TARGET_SYSTEM..." + nix build .#packages.$TARGET_SYSTEM.$VERSION_ALIAS -L sleep 5 kill $WATCH_PID 2>/dev/null || true - - name: Verify Cachix upload + - name: Verify Build Path run: | TARGET_SYSTEM=${{ matrix.runner.system }} + VERSION_ALIAS="nodejs_${{ matrix.version }}" + VERSION_ALIAS=${VERSION_ALIAS//./_} - OUT_PATH=$(nix build .#packages.$TARGET_SYSTEM.\"${{ matrix.version }}\" --print-out-paths --no-link) + OUT_PATH=$(nix path-info .#packages.$TARGET_SYSTEM.$VERSION_ALIAS) echo "Built package at: $OUT_PATH" - - nix path-info "$OUT_PATH" --store https://nixpkgs-nodejs.cachix.org || echo "Warning: Package may not be in cache yet" + + # Optional: Check if it's valid locally + nix path-info "$OUT_PATH" > /dev/null From 20d75b69109ef2a8e4c8b50e8d9ff84ce494a6be Mon Sep 17 00:00:00 2001 From: davidnbr Date: Sat, 31 Jan 2026 21:12:26 -0500 Subject: [PATCH 4/5] ci: use version keys for build/verify output --- .github/workflows/update-versions.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index 0182021..cc9ed0d 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -120,15 +120,11 @@ jobs: - name: Build ${{ matrix.version }} version run: | TARGET_SYSTEM=${{ matrix.runner.system }} - # Convert version (e.g., "20.20") to alias (e.g., "nodejs_20_20") - VERSION_ALIAS="nodejs_${{ matrix.version }}" - VERSION_ALIAS=${VERSION_ALIAS//./_} - cachix watch-store nixpkgs-nodejs & WATCH_PID=$! - echo "Building $VERSION_ALIAS for $TARGET_SYSTEM..." - nix build .#packages.$TARGET_SYSTEM.$VERSION_ALIAS -L + echo "Building ${{ matrix.version }} for $TARGET_SYSTEM..." + nix build .#packages.$TARGET_SYSTEM.\"${{ matrix.version }}\" -L sleep 5 kill $WATCH_PID 2>/dev/null || true @@ -136,11 +132,8 @@ jobs: - name: Verify Build Path run: | TARGET_SYSTEM=${{ matrix.runner.system }} - VERSION_ALIAS="nodejs_${{ matrix.version }}" - VERSION_ALIAS=${VERSION_ALIAS//./_} - - OUT_PATH=$(nix path-info .#packages.$TARGET_SYSTEM.$VERSION_ALIAS) + OUT_PATH=$(nix path-info .#packages.$TARGET_SYSTEM.\"${{ matrix.version }}\") echo "Built package at: $OUT_PATH" - # Optional: Check if it's valid locally + # Check if it's valid locally nix path-info "$OUT_PATH" > /dev/null From 112aeca1cc7804bebd2a58514a13f725fa2a01ac Mon Sep 17 00:00:00 2001 From: davidnbr Date: Sat, 31 Jan 2026 21:13:36 -0500 Subject: [PATCH 5/5] docs: change flake call in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff83a04..ed02b31 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Inspired by [nixpkgs-terraform](https://github.com/stackbuilders/nixpkgs-terrafo in { devShells.${system}.default = pkgs.mkShell { packages = [ - nixpkgs-nodejs.packages.${system}.'"20.11.0"' + nixpkgs-nodejs.packages.${system}."20.11" ]; }; };