Skip to content

Commit 6eab301

Browse files
authored
Merge pull request #2184 from johnalotoski/jl/2024-10-nix-fixups
Nix build fixes
2 parents 9c17879 + 9ee5650 commit 6eab301

File tree

5 files changed

+794
-5412
lines changed

5 files changed

+794
-5412
lines changed

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "GovTool and utilities monorepo.";
33
inputs = {
44
default_nixpkgs.url = "github:nixos/nixpkgs/c9ece0059f42e0ab53ac870104ca4049df41b133";
5-
node_nixpkgs.url = "github:nixos/nixpkgs/9957cd48326fe8dbd52fdc50dd2502307f188b0d";
5+
node_nixpkgs.url = "github:nixos/nixpkgs/23aa9e2f958310c69a94d21f6523240841a02d58";
66
flake-utils.url = "github:numtide/flake-utils";
77
nix-inclusive.url = "github:input-output-hk/nix-inclusive";
88
};

govtool/backend/default.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs ? import <nixpkgs> { }, incl }:
1+
{ pkgs ? import <nixpkgs> { }, incl, returnShellEnv ? null }:
22
let
33
inherit (pkgs.lib.trivial) pipe;
44
inherit (pkgs) haskell;
@@ -21,17 +21,16 @@ let
2121

2222
modifier = drv: pipe drv [ appendLibraries appendTools ];
2323

24-
project = ghcPackages.developPackage {
24+
project = ghcPackages.developPackage ({
2525
root = incl ./. [
2626
./vva-be.cabal
2727
./app
2828
./src
29-
./CHANGELOG.md
3029
./sql
3130
];
3231
modifier = modifier;
3332
overrides = self: super: { openapi3 = useBroken super.openapi3; };
34-
};
33+
} // pkgs.lib.optionalAttrs (returnShellEnv != null) { inherit returnShellEnv; });
3534
in project.overrideAttrs (oldAttrs: {
3635
shellHook = ''
3736
function warn() { tput setaf $2; echo "$1"; tput sgr0; }

govtool/frontend/default.nix

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ let
3030
staticSite = pkgs.stdenv.mkDerivation {
3131
name = "govtool-website";
3232
src = frontendSrc;
33-
buildInputs = [pkgs.yarn nodeModules];
33+
buildInputs = [(pkgs.yarn.override { nodejs = pkgs.nodejs_18;}) nodeModules];
3434
inherit VITE_BASE_URL VITE_IS_DEV VITE_GTM_ID VITE_SENTRY_DSN VITE_NETWORK_FLAG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED VITE_PDF_API_URL;
3535
buildPhase = ''
36-
ln -s ${nodeModules}/libexec/voltaire-voting-app/node_modules node_modules
36+
cp -R ${nodeModules}/libexec/@govtool/frontend/node_modules node_modules
37+
38+
# Yarn links a vite transitive dependency version to
39+
# `node_modules/.bin` rather than the dev declared vite version which then breaks
40+
# the build if we don't do this.
41+
chmod +w node_modules/.bin
42+
ln -sf ../vite/bin/vite.js node_modules/.bin/vite
43+
3744
yarn build
3845
'';
3946
installPhase = ''
@@ -75,7 +82,7 @@ let
7582
warn "This is a frontend development shell." 4
7683
warn "Read the ${./README.md} to get more info about this module." 8
7784
rm -rf ./node_modules
78-
ln -s ${nodeModules.out}/libexec/voltaire-voting-app/node_modules ./node_modules
85+
ln -s ${nodeModules.out}/libexec/@govtool/frontend/node_modules ./node_modules
7986
'';
8087
};
8188
in staticSite // { inherit nodeModules devShell staticSite webserver; }

0 commit comments

Comments
 (0)