Compare commits

...

1 commit
main ... ds-fr

Author SHA1 Message Date
dd0865de41
fix(ds-fr): Update the way we construct the derivation
Some checks failed
lint / check (push) Successful in 23s
Check meta / check_meta (pull_request) Successful in 18s
Check meta / check_dns (pull_request) Successful in 20s
build configuration / build_storage01 (pull_request) Successful in 1m18s
build configuration / build_web02 (pull_request) Successful in 1m10s
build configuration / build_web01 (pull_request) Successful in 1m42s
build configuration / build_vault01 (pull_request) Successful in 2m9s
build configuration / build_geo01 (pull_request) Successful in 1m12s
build configuration / build_geo02 (pull_request) Successful in 1m7s
lint / check (pull_request) Successful in 24s
build configuration / build_rescue01 (pull_request) Successful in 2m21s
build configuration / build_compute01 (pull_request) Failing after 3m37s
build configuration / push_to_cache_compute01 (pull_request) Has been skipped
build configuration / build_bridge01 (pull_request) Successful in 2m1s
build configuration / push_to_cache_web02 (pull_request) Successful in 1m32s
build configuration / push_to_cache_storage01 (pull_request) Successful in 1m38s
build configuration / push_to_cache_web01 (pull_request) Successful in 1m57s
build configuration / push_to_cache_geo02 (pull_request) Successful in 1m11s
build configuration / push_to_cache_geo01 (pull_request) Successful in 2m9s
build configuration / push_to_cache_rescue01 (pull_request) Successful in 1m16s
build configuration / push_to_cache_bridge01 (pull_request) Successful in 1m12s
We no longer copy all of the node_modules, but instead use bun's cache,
which reduces the size of the deps
2024-09-22 16:34:51 +02:00
2 changed files with 42 additions and 28 deletions

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
stdenv, stdenv,
stdenvNoCC,
fetchFromGitHub, fetchFromGitHub,
git, git,
bun, bun,
@ -48,36 +49,42 @@ let
}; };
}; };
node_modules = stdenv.mkDerivation { bunOfflineCache = stdenvNoCC.mkDerivation {
pname = "${pname}-node_modules"; name = "${pname}-bun-deps";
inherit src version; inherit src;
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND"
"SOCKS_SERVER"
];
nativeBuildInputs = [ bun ]; nativeBuildInputs = [ bun ];
dontConfigure = true; configurePhase = ''
runHook preConfigure
mkdir .home
export HOME="$(pwd)/.home"
runHook postConfigure
'';
buildPhase = '' buildPhase = ''
bun install --no-progress --frozen-lockfile --ignore-scripts runHook preBuild
rm -r node_modules/.cache
# Remove inconsistent file bun install --no-progress --frozen-lockfile --ignore-scripts
rm node_modules/.bin/grunt
runHook postBuild
''; '';
installPhase = '' installPhase = ''
mv node_modules $out runHook preInstall
mv $HOME $out
runHook postInstall
''; '';
dontFixup = true; dontFixup = true;
outputHash = meta.deps-hash or lib.fakeHash;
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = meta.deps-hash;
}; };
dsModules = stdenv.mkDerivation { dsModules = stdenv.mkDerivation {
@ -91,9 +98,6 @@ let
rubyEnv.wrappedRuby rubyEnv.wrappedRuby
]; ];
RAILS_ENV = "production";
NODE_ENV = "dev";
patches = [ patches = [
# Disable functionnalities as we only precompile assets # Disable functionnalities as we only precompile assets
./patches/build.patch ./patches/build.patch
@ -103,17 +107,27 @@ let
${getExe git} apply -p1 < ${builtins.fetchurl "https://git.dgnum.eu/DGNum/demarches-normaliennes/commit/${dgn-id}.patch"} ${getExe git} apply -p1 < ${builtins.fetchurl "https://git.dgnum.eu/DGNum/demarches-normaliennes/commit/${dgn-id}.patch"}
''; '';
env = {
RAILS_ENV = "production";
NODE_ENV = "dev";
OTP_SECRET_KEY = "precompile_placeholder"; OTP_SECRET_KEY = "precompile_placeholder";
SECRET_KEY_BASE = "precompile_placeholder"; SECRET_KEY_BASE = "precompile_placeholder";
APP_HOST = "precompile_placeholder"; APP_HOST = "precompile_placeholder";
HOME = bunOfflineCache;
};
configurePhase = ''
runHook preConfigure
bun install --no-progress --frozen-lockfile --ignore-scripts
patchShebangs bin/
patchShebangs node_modules/
runHook postConfigure
'';
buildPhase = '' buildPhase = ''
cp -R ${node_modules} node_modules
chmod u+w -R node_modules
patchShebangs node_modules
patchShebangs bin/
bin/rake assets:precompile bin/rake assets:precompile
''; '';

View file

@ -1,5 +1,5 @@
{ {
version = "2024-04-24-01"; version = "2024-04-24-01";
src-hash = "sha256-+FjthJZb1KqqFttFmXr/FN5qaFcY9RGTKAqhdLGVFSg="; src-hash = "sha256-+FjthJZb1KqqFttFmXr/FN5qaFcY9RGTKAqhdLGVFSg=";
deps-hash = "sha256-Vj8WCB+LSHJM67qbsZ5CPc+jK1KWO1MXnSFp/LH0Ow8="; deps-hash = "sha256-EOvlzBYRtZnGQ4KU0k3/rgZzk/JnJzfF7bi8CmpY4V8=";
} }