Tom Hubrecht
db6d3cef1b
All checks were successful
lint / check (push) Successful in 31s
build configuration / build_vault01 (push) Successful in 1m0s
build configuration / build_web02 (push) Successful in 59s
build configuration / build_storage01 (push) Successful in 1m5s
build configuration / build_web01 (push) Successful in 1m20s
build configuration / build_compute01 (push) Successful in 6m16s
npins update / npins_update (push) Successful in 1m38s
ds-fr update / npins_update (push) Successful in 1m53s
161 lines
3.6 KiB
Nix
161 lines
3.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
git,
|
|
fetchYarnDeps,
|
|
yarn,
|
|
fixup_yarn_lock,
|
|
nodejs,
|
|
ruby_3_2,
|
|
bundlerEnv,
|
|
logDir ? "/var/log/ds-fr",
|
|
dataDir ? "/var/lib/ds-fr",
|
|
initialDeploymentDate ? "17941030",
|
|
}:
|
|
|
|
let
|
|
inherit (lib) getExe;
|
|
|
|
# Head of the DGNum repo
|
|
dgn-id = "640e75577059ded6f2eac4daf10941f573cb83c2";
|
|
|
|
pname = "ds-fr";
|
|
meta = import ./meta.nix;
|
|
|
|
inherit (meta) version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "demarches-simplifiees";
|
|
repo = "demarches-simplifiees.fr";
|
|
rev = version;
|
|
hash = meta.src-hash;
|
|
};
|
|
|
|
rubyEnv = bundlerEnv {
|
|
name = "env-${pname}";
|
|
gemdir = ./rubyEnv;
|
|
ruby = ruby_3_2;
|
|
gemset = (import ./rubyEnv/gemset.nix) // {
|
|
bundler = {
|
|
groups = [ "default" ];
|
|
platforms = [ ];
|
|
source = {
|
|
remotes = [ "https://rubygems.org" ];
|
|
sha256 = "deeQ3fNwcSiGSO/yeB2yoTniRq2gHW8WueprXoPX6Jk=";
|
|
type = "gem";
|
|
};
|
|
version = "2.3.11";
|
|
};
|
|
};
|
|
};
|
|
|
|
dsModules = stdenv.mkDerivation {
|
|
pname = "${pname}-modules";
|
|
inherit src version;
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
yarnLock = "${src}/yarn.lock";
|
|
hash = meta.deps-hash;
|
|
};
|
|
|
|
buildInputs = [ rubyEnv ];
|
|
nativeBuildInputs = [
|
|
fixup_yarn_lock
|
|
nodejs
|
|
yarn
|
|
rubyEnv.wrappedRuby
|
|
];
|
|
|
|
RAILS_ENV = "production";
|
|
NODE_ENV = "dev";
|
|
|
|
patches = [
|
|
# Disable functionnalities as we only precompile assets
|
|
./patches/build.patch
|
|
];
|
|
|
|
postPatch = ''
|
|
${getExe git} apply -p1 < ${builtins.fetchurl "https://git.dgnum.eu/DGNum/demarches-normaliennes/commit/${dgn-id}.patch"}
|
|
'';
|
|
|
|
OTP_SECRET_KEY = "precompile_placeholder";
|
|
SECRET_KEY_BASE = "precompile_placeholder";
|
|
APP_HOST = "precompile_placeholder";
|
|
|
|
buildPhase = ''
|
|
export HOME=$(mktemp -d)
|
|
yarn config --offline set yarn-offline-mirror $offlineCache
|
|
fixup_yarn_lock yarn.lock
|
|
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
|
|
|
patchShebangs node_modules/
|
|
patchShebangs bin/
|
|
|
|
bin/rake assets:precompile
|
|
|
|
yarn cache clean --offline
|
|
rm -rf node_modules/
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/public
|
|
cp -r public/* $out/public
|
|
'';
|
|
};
|
|
in
|
|
stdenv.mkDerivation {
|
|
name = "demarches-simplifiees.fr-${version}";
|
|
|
|
inherit src;
|
|
|
|
buildInputs = [ rubyEnv ];
|
|
propagatedBuildInputs = [ rubyEnv.wrappedRuby ];
|
|
|
|
patches = [
|
|
./patches/replay_routing_engine_for_a_cloned_procedure.patch
|
|
./patches/smtp_settings.patch
|
|
./patches/garage.patch
|
|
./patches/secrets-fc.patch
|
|
];
|
|
|
|
postPatch = ''
|
|
${getExe git} apply -p1 < ${builtins.fetchurl "https://git.dgnum.eu/DGNum/demarches-normaliennes/commit/${dgn-id}.patch"}
|
|
'';
|
|
|
|
buildPhase = ''
|
|
rm -rf public
|
|
ln -s ${dsModules}/public/ public
|
|
|
|
patchShebangs bin/
|
|
|
|
rm -rf log storage
|
|
ln -s ${logDir} log
|
|
ln -s ${dataDir}/tmp tmp
|
|
ln -s ${dataDir}/storage storage
|
|
|
|
for f in $(ls lib/tasks/deployment/); do
|
|
[[ ! ${initialDeploymentDate} < $f ]] \
|
|
&& rm lib/tasks/deployment/$f;
|
|
done;
|
|
|
|
echo "Removed unused data migrations"
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -r * $out/
|
|
'';
|
|
|
|
passthru = {
|
|
inherit rubyEnv;
|
|
ruby = rubyEnv.wrappedRuby;
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Dématérialiser et simplifier les démarches administratives";
|
|
homepage = "https://github.com/demarches-simplifiees/demarches-simplifiees.fr";
|
|
license = licenses.agpl3Only;
|
|
maintainers = with maintainers; [ thubrecht ];
|
|
};
|
|
}
|