From 441702b5e5d74e81f539a2f94fedb34e60164d8f Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 30 Nov 2023 19:59:19 +0100 Subject: [PATCH] feat(ds-fr): Correctly apply patches --- machines/compute01/ds-fr/default.nix | 7 --- machines/compute01/ds-fr/package/default.nix | 17 ++--- machines/compute01/ds-fr/package/dgnum.nix | 65 +++++--------------- 3 files changed, 27 insertions(+), 62 deletions(-) diff --git a/machines/compute01/ds-fr/default.nix b/machines/compute01/ds-fr/default.nix index 61739ab..18bcbec 100644 --- a/machines/compute01/ds-fr/default.nix +++ b/machines/compute01/ds-fr/default.nix @@ -20,13 +20,6 @@ in { # S3 storage setup ACTIVE_STORAGE_SERVICE = "local"; - S3_ENDPOINT = "https://s3.dgnum.eu"; - S3_BUCKET = "demarches-dgnum"; - S3_REGION = "garage"; - S3_FORCE_PATH_STYLE = "true"; - S3_ACCESS_KEY_ID = "GK4d244118eac2336ae0ab2dd9"; - S3_SECRET_ACCESS_KEY = - "61100261fb0a0c861371596f9ffcd1e83134301a6d0c665a077135af04ba18c3"; # SAML_IDP_ENABLED = "enabled"; diff --git a/machines/compute01/ds-fr/package/default.nix b/machines/compute01/ds-fr/package/default.nix index efd4be6..b1ccbd4 100644 --- a/machines/compute01/ds-fr/package/default.nix +++ b/machines/compute01/ds-fr/package/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchpatch, fetchFromGitHub, fetchYarnDeps, yarn, fixup_yarn_lock +{ 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" }: @@ -51,7 +51,10 @@ let patches = [ # Disable functionnalities as we only precompile assets ./patches/build.patch - ] ++ dgn-patches; + ]; + + postPatch = builtins.concatStringsSep "\n" + (builtins.map (p: "${git}/bin/git apply -p1 < ${p}") dgn-patches); OTP_SECRET_KEY = "precompile_placeholder"; SECRET_KEY_BASE = "precompile_placeholder"; @@ -78,10 +81,7 @@ let ''; }; - dgn-patches = import ./dgnum.nix { - inherit fetchpatch; - inherit (lib) fakeHash; - }; + dgn-patches = import ./dgnum.nix { }; in stdenv.mkDerivation { name = "demarches-simplifiees.fr-${version}"; @@ -97,7 +97,10 @@ in stdenv.mkDerivation { ./patches/garage.patch ./patches/secrets-fc.patch ./patches/uninterlace_png.patch - ] ++ dgn-patches; + ]; + + postPatch = builtins.concatStringsSep "\n" + (builtins.map (p: "${git}/bin/git apply -p1 < ${p}") dgn-patches); buildPhase = '' rm -rf public diff --git a/machines/compute01/ds-fr/package/dgnum.nix b/machines/compute01/ds-fr/package/dgnum.nix index 9f2514e..e05aae7 100644 --- a/machines/compute01/ds-fr/package/dgnum.nix +++ b/machines/compute01/ds-fr/package/dgnum.nix @@ -1,59 +1,28 @@ -{ fetchpatch, fakeHash }: +_: -builtins.map ({ id, hash ? fakeHash }: - fetchpatch { - url = - "https://git.dgnum.eu/DGNum/demarches-normaliennes/commit/${id}.patch"; - inherit hash; - }) [ +builtins.map (id: + builtins.fetchurl + "https://git.dgnum.eu/DGNum/demarches-normaliennes/commit/${id}.patch") [ # remplacement l'arrache de quelques logos vers versions DGNum - { - id = "05d34a880ebb34265ebbcac0a83625b3a976c348"; - hash = "sha256-3VTBom8Lz6F/NXvjLzdhBddXS5FerV5eNHUkDPBDeD8="; - } + "05d34a880ebb34265ebbcac0a83625b3a976c348" # ajout des NDD usuels ENS et DGNum pour autoriser les changements d'adresse mail - { - id = "bc4742aaacb174a55a08baae5f354ada3fba4577"; - hash = "sha256-LShcRzj/lnFQyJtc9+RxNQq8tsCcdYrwhe2BjqLr1pQ="; - } + "bc4742aaacb174a55a08baae5f354ada3fba4577" # correction des svg des logos DGNum et DN - { - id = "ee474712a3e50d186acd8bbb52f60c1e4fee2f81"; - hash = "sha256-yoPCZOPPOk84n2oAISzjzJ8n3eWtsYqPglayRKcJGII="; - } + "ee474712a3e50d186acd8bbb52f60c1e4fee2f81" + # remplacement Marianne - pour l'instant à l'arrache uniquement, logo sera repris et affiné plus tard + "1965a47fda2bc50fe4ddb2fbac63deb36b933c6f" # modifs Mariannes - { - id = "222ae5abee8a255cb1fe4e19f6a7769b2df1cafb"; - hash = "sha256-26+RKT87c1sbpt/No6f6qLGzTU/UC/3+SQVVUd8dtfk="; - } + "222ae5abee8a255cb1fe4e19f6a7769b2df1cafb" # commenter quelques bouts de code inutiles dans l'usage DGNum de DS - { - id = "ab8b515e3dbd340741a4562ab4f87c520ac99434"; - hash = "sha256-0yWAgLq5O1A6Rf4j/W/iKerX5f7ZlKE/tbCZ69Us2jo="; - } + "ab8b515e3dbd340741a4562ab4f87c520ac99434" # Update logo-ds.svg and delete commented lines - { - id = "ff36c4ad62f87086781743e843ec2ccde5eab8b6"; - hash = "sha256-XRTZXD0j7Uk9fVKRMnYdGhNZ5yk85LNeg6IVotgw840="; - } - # correction logo DN pour les pages d'erreur - { - id = "bbe8e7d421466eea2b2ea56abf004bf91e29224c"; - hash = "sha256-lo0giMktGn9vNBtn31EGSevEK/FXz6+crJNhVGexJec="; - } + "ff36c4ad62f87086781743e843ec2ccde5eab8b6" + # correction logo DN pour pages d'erreur + "bbe8e7d421466eea2b2ea56abf004bf91e29224c" # normalianisation de DN, texte - { - id = "0a630f87e214027e6b49073840fd4e1c1074ed2a"; - hash = "sha256-zu/FtAa/B2eJnpxzZJs1CeA5/Btm25LOjfeHnLLHtmI="; - } + "0a630f87e214027e6b49073840fd4e1c1074ed2a" # modifs sur le fichier en anglais - { - id = "e9e644a4d86b44cfad339d9e6af4ae4938e13f75"; - hash = "sha256-LoHzac2lC5YozlXOB4pqIkWPbJk2tq3326Sa+HsHGB8="; - } + "e9e644a4d86b44cfad339d9e6af4ae4938e13f75" # Use our logo in the header - { - id = "e755b13183da2ea94d8d91de45eae71a1a9fb5b9"; - hash = "sha256-tt9vlsI6St1XeLe1c6xa2LTlKHHWMGP+pv1Kv2Q9hFU="; - } + "e755b13183da2ea94d8d91de45eae71a1a9fb5b9" ]