From 1459250ea7a38ab3c8ee763b94dc5af818cc9d1d Mon Sep 17 00:00:00 2001 From: winston Date: Mon, 27 Nov 2023 19:13:15 +0100 Subject: [PATCH] ci(nix): try nixPreload as a strategy for faster builds --- .github/workflows/nix.yml | 8 ++++++++ .yarnrc.yml | 1 + nix/default.nix | 23 ----------------------- nix/yarn-project.nix | 4 ++-- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 8078d61e7..43469eceb 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -19,6 +19,14 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + - run: corepack enable + - name: Install dependencies + run: yarn install --immutable + - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main diff --git a/.yarnrc.yml b/.yarnrc.yml index 020e50e8e..a67b3bf0f 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -13,6 +13,7 @@ plugins: spec: "https://raw.githubusercontent.com/stephank/yarn-plugin-nixify/main/dist/yarn-plugin-nixify.js" # yarn-plugin-nixify options +enableNixPreload: true generateDefaultNix: false nixExprPath: nix/yarn-project.nix diff --git a/nix/default.nix b/nix/default.nix index 672412d8e..73dbf0fd1 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -29,29 +29,6 @@ overrideAttrs = { pname = "${pname}-builder"; - # get rid of all dependencies not needed for building - preConfigure = '' - yarn remove \ - @storybook/addon-essentials \ - @storybook/addon-styling \ - @storybook/addon-themes \ - @storybook/blocks \ - @storybook/react \ - @storybook/react-vite \ - chromatic \ - husky \ - json-schema-to-typescript \ - node-fetch \ - lint-staged \ - prettier \ - react \ - react-dom \ - shikiji \ - storybook \ - tsx \ - vite - ''; - buildPhase = '' runHook preBuild yarn compile diff --git a/nix/yarn-project.nix b/nix/yarn-project.nix index 6c731a2d8..68d815ca5 100644 --- a/nix/yarn-project.nix +++ b/nix/yarn-project.nix @@ -6,10 +6,10 @@ let - yarnBin = ../.yarn/releases/yarn-4.0.2.cjs; + yarnBin = ./../.yarn/releases/yarn-4.0.2.cjs; cacheFolder = ".yarn/cache"; - lockfile = ../yarn.lock; + lockfile = ./../yarn.lock; # Call overrideAttrs on a derivation if a function is provided. optionalOverride = fn: drv: