fix(nix): pin pnpm bits to flake's own nixpkgs #99
1 changed files with 20 additions and 12 deletions
32
flake.nix
32
flake.nix
|
|
@ -10,24 +10,32 @@
|
||||||
let
|
let
|
||||||
apps = [ "main" "events" "wallet" "chat" "market" "forum" "tasks" "restaurant" "libra" ];
|
apps = [ "main" "events" "wallet" "chat" "market" "forum" "tasks" "restaurant" "libra" ];
|
||||||
|
|
||||||
|
# Use this flake's pinned nixpkgs for the build, regardless of which
|
||||||
|
# nixpkgs the consumer's `pkgs` is from. Without this, the pnpmDeps
|
||||||
|
# hash drifts as soon as a consumer's nixpkgs has a different
|
||||||
|
# pnpm_10 minor version (snapshots are byte-for-byte different per
|
||||||
|
# pnpm version). Only `pkgs`'s system attribute is honored.
|
||||||
|
flakePkgsFor = pkgs: import nixpkgs {
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
|
};
|
||||||
|
|
||||||
mkWebapp = { pkgs, brandDir ? ./branding/default, app ? "main" }:
|
mkWebapp = { pkgs, brandDir ? ./branding/default, app ? "main" }:
|
||||||
let
|
let
|
||||||
buildScript = if app == "main" then "build" else "build:${app}";
|
buildScript = if app == "main" then "build" else "build:${app}";
|
||||||
outDir = if app == "main" then "dist" else "dist-${app}";
|
outDir = if app == "main" then "dist" else "dist-${app}";
|
||||||
|
flakePkgs = flakePkgsFor pkgs;
|
||||||
in
|
in
|
||||||
pkgs.stdenv.mkDerivation (finalAttrs: {
|
flakePkgs.stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "aio-webapp-${app}";
|
pname = "aio-webapp-${app}";
|
||||||
version = "0.0.0";
|
version = "0.0.0";
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
# Pin pnpm major version (10.x) regardless of consumer's nixpkgs
|
# pnpm comes from THIS flake's pinned nixpkgs (via flakePkgs),
|
||||||
# so the pnpmDeps hash stays stable for downstream callers that
|
# never the consumer's, so the pnpmDeps snapshot is stable.
|
||||||
# bring their own pkgs. package.json's packageManager field
|
pnpm = flakePkgs.pnpm_10;
|
||||||
# declares pnpm@10.33.0; pnpm_10 satisfies that.
|
|
||||||
pnpm = pkgs.pnpm_10;
|
|
||||||
|
|
||||||
pnpmDeps = pkgs.fetchPnpmDeps {
|
pnpmDeps = flakePkgs.fetchPnpmDeps {
|
||||||
inherit (finalAttrs) pname version src;
|
inherit (finalAttrs) pname version src;
|
||||||
inherit (finalAttrs) pnpm;
|
inherit (finalAttrs) pnpm;
|
||||||
fetcherVersion = 3;
|
fetcherVersion = 3;
|
||||||
|
|
@ -35,16 +43,16 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkgs.nodejs
|
flakePkgs.nodejs
|
||||||
finalAttrs.pnpm
|
finalAttrs.pnpm
|
||||||
pkgs.pnpmConfigHook
|
flakePkgs.pnpmConfigHook
|
||||||
pkgs.autoPatchelfHook
|
flakePkgs.autoPatchelfHook
|
||||||
];
|
];
|
||||||
|
|
||||||
# sharp's prebuilt libvips binaries (under @img/sharp-libvips-*)
|
# sharp's prebuilt libvips binaries (under @img/sharp-libvips-*)
|
||||||
# are dynamically linked; autoPatchelfHook needs the runtime libs.
|
# are dynamically linked; autoPatchelfHook needs the runtime libs.
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.stdenv.cc.cc.lib
|
flakePkgs.stdenv.cc.cc.lib
|
||||||
];
|
];
|
||||||
|
|
||||||
# Brand kit env knobs read by vite-branding.ts and
|
# Brand kit env knobs read by vite-branding.ts and
|
||||||
|
|
@ -72,7 +80,7 @@
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
meta = with flakePkgs.lib; {
|
||||||
description = "AIO webapp${if app == "main" then "" else " (${app} standalone)"}";
|
description = "AIO webapp${if app == "main" then "" else " (${app} standalone)"}";
|
||||||
homepage = "https://git.atitlan.io/aiolabs/webapp";
|
homepage = "https://git.atitlan.io/aiolabs/webapp";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue