chore(shell.nix): resort to new prepare-env script instead of shellHook and use in gitlab-ci

This commit is contained in:
Sarah Vaupel 2024-06-20 14:38:12 +02:00
parent 951078114a
commit f90a244cd4
2 changed files with 16 additions and 11 deletions

View File

@ -127,7 +127,7 @@ backend lint:
- *stack-cache
script:
- "ls -a ." # TODO: debug only
- "nix shell .#gnumake .#stack --command make backend-lint-prod"
- "nix shell .#gnumake .#stack .#tzdata --command \"prepare-env && make backend-lint-prod\""
before_script: *nix-before
needs:
- job: backend dependencies
@ -164,7 +164,7 @@ backend build:
cache:
- *stack-cache
script:
- "nix shell .#gnumake .#coreutils .#stack --command make backend-build-prod"
- "nix shell .#gnumake .#coreutils .#stack .#tzdata --command \"prepare-env && make backend-build-prod\""
- cp $(stack path --dist-dir)/build/hlint/hlint bin/test-hlint
- cp $(stack path --dist-dir)/build/yesod/yesod bin/test-yesod
before_script: *nix-before
@ -249,7 +249,7 @@ uniworx:exe:uniworxload:
frontend test:
stage: test
script:
- "nix shell .#gnumake .#nodejs-14_x --command make frontend-test"
- "nix shell .#gnumake .#nodejs-14_x .#chromium .#tzdata --command \"prepare-env && make frontend-test\""
before_script: *nix-before
cache: *frontend-cache
needs:

View File

@ -262,21 +262,26 @@ let
git diff $(cut -d '-' -f 1 <(curl -sH 'Accept: text/plain' https://uni2work.ifi.lmu.de/version))
'';
prepareEnv = pkgs.writeScriptBin "prepare-env" ''
#!${pkgs.zsh}/bin/zsh
export TZDIR=${pkgs.tzdata}/share/zoneinfo
export CHROME_BIN=${pkgs.chromium}/bin/chromium
echo "prepareEnv has been executed"
echo "TZDIR: $TZDIR"
echo "CHROME_BIN: $CHROME_BIN"
'';
in pkgs.mkShell {
name = "fradrive";
shellHook = ''
${pkgs.lib.optionalString (nixpkgsPath != null) ''
export NIX_PATH=nixpkgs=${nixpkgsPath}
''}
export TZDIR=${pkgs.tzdata}/share/zoneinfo
export CHROME_BIN=${pkgs.chromium}/bin/chromium
echo "shellHook has been executed"
echo "TZDIR: $TZDIR"
echo "CHROME_BIN: $CHROME_BIN"
prepare-env
'';
nativeBuildInputs = [develop inDevelop killallUni2work diffRunning]
nativeBuildInputs = [develop inDevelop killallUni2work diffRunning prepareEnv]
++ (with pkgs;
[ stdenv coreutils stack nodejs-14_x postgresql_12 openldap exiftool memcached minio minio-client
gup reuse pre-commit