fix(update): use my fork of nix-update to run scripts
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-02-17 16:47:32 -05:00
parent 9e2fb19146
commit 849ab8ad6c
5 changed files with 34 additions and 36 deletions

View file

@ -50,6 +50,8 @@ export const runNixUpdate = (
scope?: string,
scopeAttr?: string,
): { stdout: string, stderr: string } => {
const getJsonArray = (jsonObj: string) => Array(JSON.parse(jsonObj))[0].slice(1).join(' ');
const realAttr = scope ? `${attr}.x86_64-linux.${scope}.${scopeAttr}` : attr;
const OLD_VERSION = getAttrVersion(realAttr);
@ -60,9 +62,13 @@ export const runNixUpdate = (
);
const options = execOptions.status === 0 ?
Array(JSON.parse(execOptions.stdout.toString()))[0].slice(1).join(' ') :
execOptions.stdout.toString().startsWith('[') ?
getJsonArray(execOptions.stdout.toString()) :
'-u' :
'';
console.log(`nix-update --flake ${realAttr} ${options} --write-commit-message >(head -n 1 -) > /dev/null`);
const execution = spawnSync(
`nix-update --flake ${realAttr} ${options} --write-commit-message >(head -n 1 -) > /dev/null`,
[],

View file

@ -20,5 +20,5 @@ pin args:
nix run "$FLAKE"#pin-inputs -- "$@"
[positional-arguments]
update args:
up args:
nix run "$FLAKE"#update-sources -- "$@"

View file

@ -1 +1,11 @@
final: prev: {}
final: prev: {
# FIXME: do some other stuff and make PR
nix-update = prev.nix-update.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "matt1432";
repo = "nix-update";
rev = "21de1ebd7e7c22de03f0a9c7e1f6cd488fa96d03";
hash = "sha256-ukapzy0+mS4rorX3D22lRKX/D9TXmkq8W2YNDQIq7A8=";
};
});
}

View file

@ -3,7 +3,6 @@
lib,
buildNpmPackage,
makeWrapper,
nix-update-script,
writeShellApplication,
# update script deps
nodejs_latest,
@ -33,23 +32,15 @@ in
npmDepsHash = "sha256-BRo71A07BhrioiBFisCR01OrVFTIagVTIClZ2Tpjidk=";
passthru.updateScript = let
script = writeShellApplication {
name = "update";
runtimeInputs = [
nodejs_latest
prefetch-npm-deps
jq
];
text = import ./update.nix;
};
in
nix-update-script {
extraArgs = [
"--version=skip"
"; ${script}"
];
};
passthru.updateScript = writeShellApplication {
name = "update";
runtimeInputs = [
nodejs_latest
prefetch-npm-deps
jq
];
text = import ./update.nix;
};
meta = {
mainProgram = pname;

View file

@ -4,7 +4,6 @@
nodejs,
pnpm,
stdenv,
nix-update-script,
...
}: let
inherit (builtins) fromJSON readFile;
@ -36,18 +35,10 @@ in
hash = "sha256-II8expO942jHylgbiePr5+V+t+UVh7fenffoyVFn/8k=";
};
passthru.updateScript = let
script = "${concatTextFile {
name = "update";
files = [./update.sh];
executable = true;
destination = "/bin/update";
}}/bin/update";
in
nix-update-script {
extraArgs = [
"--version=skip"
"; ${script}"
];
};
passthru.updateScript = concatTextFile {
name = "update";
files = [./update.sh];
executable = true;
destination = "/bin/update";
};
})