feat(ds-fr): Switch to new upstream packaging.....

This commit is contained in:
Tom Hubrecht 2024-04-17 14:47:51 +02:00
parent 0c45a88561
commit c6691cf9f1
6 changed files with 65 additions and 29 deletions

View file

@ -3,9 +3,7 @@
stdenv,
fetchFromGitHub,
git,
fetchYarnDeps,
yarn,
prefetch-yarn-deps,
bun,
nodejs,
ruby_3_2,
bundlerEnv,
@ -18,7 +16,7 @@ let
inherit (lib) getExe;
# Head of the DGNum repo
dgn-id = "12e4a32ca5d909a90ca6f7e53081cc6b6b14c416";
dgn-id = "1b6a2a23331398f46f3c292cd9631c163390916b";
pname = "ds-fr";
meta = import ./meta.nix;
@ -50,20 +48,42 @@ let
};
};
node_modules = stdenv.mkDerivation {
pname = "${pname}-node_modules";
inherit src version;
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND"
"SOCKS_SERVER"
];
nativeBuildInputs = [ bun ];
dontConfigure = true;
buildPhase = ''
bun install --no-progress --frozen-lockfile --ignore-scripts
'';
installPhase = ''
mv node_modules $out
'';
dontFixup = true;
outputHash = meta.deps-hash or lib.fakeHash;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
dsModules = stdenv.mkDerivation {
pname = "${pname}-modules";
inherit src version;
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = meta.deps-hash;
};
buildInputs = [ rubyEnv ];
nativeBuildInputs = [
prefetch-yarn-deps
bun
nodejs
yarn
rubyEnv.wrappedRuby
];
@ -84,18 +104,13 @@ let
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
cp -R ${node_modules} node_modules
chmod u+w -R node_modules
patchShebangs node_modules/
patchShebangs node_modules
patchShebangs bin/
bin/rake assets:precompile
yarn cache clean --offline
rm -rf node_modules/
'';
installPhase = ''

View file

@ -1,5 +1,5 @@
{
version = "2024-04-02-03";
src-hash = "sha256-32FXEoQb1W1Bqf7lNpt6ljEU9QIDZkE/+njsu4DKFFY=";
deps-hash = "sha256-ZtZ1iqKHWGPR5+BDOtOvrpgdndfP5IiqrLkju96YAM4=";
version = "2024-04-16-03";
src-hash = "sha256-fZICNAQPmmo3wp9dQ/YDHZgSxN0llGJJvI9mkAHnjgA=";
deps-hash = "sha256-vKBx8rFvJ2fGAzTgSZa3BU+tkw48JTyf4KeiwciuRds=";
}

View file

@ -23,7 +23,7 @@ gem 'chunky_png'
gem 'clamav-client', require: 'clamav/client'
gem 'daemons'
gem 'deep_cloneable' # Enable deep clone of active record models
gem 'delayed_cron_job' # Cron jobs
gem 'delayed_cron_job', require: false # Cron jobs
gem 'delayed_job_active_record'
gem 'delayed_job_web'
gem 'devise', git: 'https://github.com/heartcombo/devise.git', ref: "edffc79bf05d7f1c58ba50ffeda645e2e4ae0cb1" # Gestion des comptes utilisateurs, drop ref on next release: 4.9.4
@ -91,6 +91,7 @@ gem 'sentry-ruby'
gem 'sentry-sidekiq'
gem 'sib-api-v3-sdk'
gem 'sidekiq'
gem 'sidekiq-cron'
gem 'skylight'
gem 'spreadsheet_architect'
gem 'strong_migrations' # lint database migrations

View file

@ -721,6 +721,10 @@ GEM
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
redis-client (>= 0.19.0)
sidekiq-cron (1.12.0)
fugit (~> 1.8)
globalid (>= 1.0.1)
sidekiq (>= 6)
simple_xlsx_reader (1.0.4)
nokogiri
rubyzip
@ -973,6 +977,7 @@ DEPENDENCIES
shoulda-matchers
sib-api-v3-sdk
sidekiq
sidekiq-cron
simple_xlsx_reader
skylight
spreadsheet_architect

View file

@ -3587,6 +3587,21 @@
};
version = "7.2.1";
};
sidekiq-cron = {
dependencies = [
"fugit"
"globalid"
"sidekiq"
];
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0v09lg8kza19jmigqv5hx2ibhm75j6pa639sfy4bv2208l50hqv6";
type = "gem";
};
version = "1.12.0";
};
simple_xlsx_reader = {
dependencies = [
"nokogiri"

View file

@ -26,13 +26,13 @@ done
CWD=$(pwd)
TMP=$(mktemp -d)
cd "$TMP"
cd "$TMP" || exit 1
# Fetch the latest source or the required version
gitUrl="https://github.com/demarches-simplifiees/demarches-simplifiees.fr.git"
if [ -n "$version" ]; then
git clone --depth 1 --branch $version $gitUrl .
git clone --depth 1 --branch "$version" $gitUrl .
else
git clone --depth 1 $gitUrl .
@ -48,10 +48,10 @@ cp gemset.nix Gemfile Gemfile.lock "$CWD/rubyEnv/"
# Print the new source details
SRC_HASH=$(nix-shell -p nurl --run "nurl --hash $gitUrl $version")
# Print Yarn deps hash
hash=$(nix-shell -p prefetch-yarn-deps --run "prefetch-yarn-deps yarn.lock")
# Switch to bun
nix-shell -p bun --run "bun install --frozen-lockfile --no-cache --no-progress --ignore-scripts"
DEPS_HASH=$(nix-hash --to-sri --type sha256 "$hash")
DEPS_HASH=$(nix-hash --sri --type sha256 node_modules)
cat <<EOF >"$CWD/meta.nix"
{
@ -61,6 +61,6 @@ cat <<EOF >"$CWD/meta.nix"
}
EOF
nixfmt "$CWD"
nix-shell -p nixfmt-rfc-style --run "nixfmt $CWD"
rm -rf "$TMP"