Skip to content

Commit

Permalink
nix: fix garnix checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Jan 7, 2025
1 parent 788a20c commit 7cb4238
Show file tree
Hide file tree
Showing 5 changed files with 10,471 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
frontend = frontend.devShell;
# shell with js dependencies only if yarn.lock is broken and needs fixed
js = defaultPkgs.mkShell {
buildInputs = [ nodePkgs.nodejs_18 nodePkgs.yarn ];
buildInputs = [ nodePkgs.nodejs_20 nodePkgs.yarn ];
};
};
});
Expand Down
12 changes: 10 additions & 2 deletions govtool/frontend/.envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

source_up
watch_file default.nix yarn.lock
env_vars_required CARDANO_NETWORK GTM_ID SENTRY_DSN
env_vars_required CARDANO_NETWORK GTM_ID SENTRY_DSN USERSNAP_SPACE_API_KEY PDF_API_URL IPFS_PROJECT_ID

if [[ "${CARDANO_NETWORK}" = "mainnet" ]]; then
export VITE_NETWORK_FLAG=1
else
export VITE_NETWORK_FLAG=0
fi
export VITE_APP_ENV=local
export VITE_BASE_URL=http://localhost:9999
export VITE_METADATA_API_URL=http://localhost:3000
export VITE_IS_DEV=true
export VITE_GTM_ID="${GTM_ID}"
export VITE_SENTRY_DSN="${SENTRY_DSN}"
export VITE_GTM_ID="${GTM_ID}"
export VITE_IS_DEV=true
export VITE_USERSNAP_SPACE_API_KEY=${USERSNAP_SPACE_API_KEY}
export VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED=true
export VITE_PDF_API_URL=${PDF_API_URL}
export VITE_IPFS_GATEWAY="https://ipfs.io/ipfs"
export VITE_IPFS_PROJECT_ID=${IPFS_PROJECT_ID}

use flake --extra-experimental-features nix-command --extra-experimental-features flakes ../..#frontend
13 changes: 9 additions & 4 deletions govtool/frontend/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{ pkgs ? import <nixpkgs> {}
, incl
, VITE_BASE_URL ? "http://localhost"
, VITE_BASE_URL ? "http://localhost:9999"
, VITE_IS_DEV ? "true"
, VITE_GTM_ID ? ""
, VITE_SENTRY_DSN ? ""
, VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED ? ""
, VITE_PDF_API_URL ? ""
, VITE_APP_ENV ? "development"
, VITE_METADATA_API_URL ? "http://localhost:3000"
, VITE_USERSNAP_SPACE_API_KEY ? ""
, VITE_IPFS_GATEWAY ? "https://ipfs.io/ipfs"
, VITE_IPFS_PROJECT_ID ? ""
, CARDANO_NETWORK ? "sanchonet"
}:
let
Expand All @@ -25,12 +30,12 @@ let
src = frontendSrc;
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
nodejs = pkgs.nodejs_18;
nodejs = pkgs.nodejs_20;
};
staticSite = pkgs.stdenv.mkDerivation {
name = "govtool-website";
src = frontendSrc;
buildInputs = [(pkgs.yarn.override { nodejs = pkgs.nodejs_18;}) nodeModules];
buildInputs = [(pkgs.yarn.override { nodejs = pkgs.nodejs_20;}) nodeModules];
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;
buildPhase = ''
cp -R ${nodeModules}/libexec/@govtool/frontend/node_modules node_modules
Expand Down Expand Up @@ -73,7 +78,7 @@ let
${pkgs.nginx}/bin/nginx -c ${nginxConfig} -e /dev/stderr
'';
devShell = pkgs.mkShell {
buildInputs = [pkgs.nodejs_18 pkgs.yarn];
buildInputs = [pkgs.nodejs_20 pkgs.yarn];
shellHook = ''
function warn() { tput setaf $2; echo "$1"; tput sgr0; }
Expand Down
3 changes: 1 addition & 2 deletions govtool/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,5 @@
"typescript": "^5.0.2",
"nth-check": "^2.0.1",
"postcss": "^8.4.31"
},
"_id": "[email protected]"
}
}
Loading

0 comments on commit 7cb4238

Please sign in to comment.