podman-desktop: refine updateScript to bump electron and pnpm version
This commit is contained in:
@@ -10,6 +10,11 @@
|
||||
makeDesktopItem,
|
||||
darwin,
|
||||
nix-update-script,
|
||||
_experimental-update-script-combinators,
|
||||
writeShellApplication,
|
||||
nix,
|
||||
jq,
|
||||
gnugrep,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -19,7 +24,32 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "podman-desktop";
|
||||
version = "1.18.1";
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
passthru.updateScript = _experimental-update-script-combinators.sequence [
|
||||
(nix-update-script { })
|
||||
(lib.getExe (writeShellApplication {
|
||||
name = "${finalAttrs.pname}-dependencies-updater";
|
||||
runtimeInputs = [
|
||||
nix
|
||||
jq
|
||||
gnugrep
|
||||
];
|
||||
runtimeEnv = {
|
||||
PNAME = finalAttrs.pname;
|
||||
PKG_FILE = builtins.toString ./package.nix;
|
||||
};
|
||||
text = ''
|
||||
new_src="$(nix-build --attr "pkgs.$PNAME.src" --no-out-link)"
|
||||
new_electron_major="$(jq '.devDependencies.electron' "$new_src/package.json" | grep --perl-regexp --only-matching '\d+' | head -n 1)"
|
||||
new_pnpm_major="$(jq '.packageManager' "$new_src/package.json" | grep --perl-regexp --only-matching '\d+' | head -n 1)"
|
||||
sed -i -E "s/electron_[0-9]+/electron_$new_electron_major/g" "$PKG_FILE"
|
||||
sed -i -E "s/pnpm_[0-9]+/pnpm_$new_pnpm_major/g" "$PKG_FILE"
|
||||
'';
|
||||
}))
|
||||
(nix-update-script {
|
||||
# Changing the pnpm version requires updating `pnpmDeps.hash`.
|
||||
extraArgs = [ "--version=skip" ];
|
||||
})
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "containers";
|
||||
|
||||
Reference in New Issue
Block a user