Skip to content

Commit

Permalink
[nix,devenv] make use of corepack for installing pnpn in nix devenv
Browse files Browse the repository at this point in the history
  • Loading branch information
nxmatic committed Jul 2, 2024
1 parent d4f2670 commit 5548a56
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Setup pnpm
run: |
npm install -g pnpm
corepack enable pnpm
- name: Cache pnpm store
uses: actions/cache@v4
Expand Down
67 changes: 59 additions & 8 deletions .nix/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 21 additions & 13 deletions .nix/flake.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
description = "Description for the project";
description = "Nuxeo Browser Extension (development environment)";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
corepack.url = "github:SnO2WMaN/corepack-flake";
nix2container.url = "github:nlewo/nix2container";
nix2container.inputs.nixpkgs.follows = "nixpkgs";
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
Expand All @@ -21,16 +22,18 @@
];
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];

perSystem = { config, self', inputs', pkgs, system, ... }: {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.

# Equivalent to inputs'.nixpkgs.legacyPackages.hello;
# packages.default = [ pkgs.nodejs_20 pkgs.nodePackages.pnpm ];

perSystem = { config, self', inputs', pkgs, system, ... }:
let
corepackOverlay = inputs.corepack.overlays.default;
pkgsWithOverlay = import inputs.nixpkgs {
inherit system;
overlays = [ corepackOverlay ];
};
mkCorepack = corepackOverlay pkgs pkgs;
in
{
devenv.shells.default = {
name = "nixeo-browser-extension";
name = "nuxeo-browser-extension";

imports = [
# This is just like the imports in devenv.nix.
Expand All @@ -39,21 +42,26 @@
];

# https://devenv.sh/reference/options/
packages = [ pkgs.nodejs_20 pkgs.nodePackages.pnpm ];
packages = [
pkgsWithOverlay.nodejs
(mkCorepack.mkCorepack {
nodejs = pkgsWithOverlay.nodejs;
pm = "pnpm";
})
];

enterShell = ''
echo "You're running pnpm in nodejs (stable version)"
echo "Node version: $(node -v)"
echo "pnpm version: $(pnpm -v)"
'';
};

};

flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.

};
};
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22

0 comments on commit 5548a56

Please sign in to comment.