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, scope?: string,
scopeAttr?: string, scopeAttr?: string,
): { stdout: string, stderr: 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 realAttr = scope ? `${attr}.x86_64-linux.${scope}.${scopeAttr}` : attr;
const OLD_VERSION = getAttrVersion(realAttr); const OLD_VERSION = getAttrVersion(realAttr);
@ -60,9 +62,13 @@ export const runNixUpdate = (
); );
const options = execOptions.status === 0 ? 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( const execution = spawnSync(
`nix-update --flake ${realAttr} ${options} --write-commit-message >(head -n 1 -) > /dev/null`, `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 -- "$@" nix run "$FLAKE"#pin-inputs -- "$@"
[positional-arguments] [positional-arguments]
update args: up args:
nix run "$FLAKE"#update-sources -- "$@" 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, lib,
buildNpmPackage, buildNpmPackage,
makeWrapper, makeWrapper,
nix-update-script,
writeShellApplication, writeShellApplication,
# update script deps # update script deps
nodejs_latest, nodejs_latest,
@ -33,8 +32,7 @@ in
npmDepsHash = "sha256-BRo71A07BhrioiBFisCR01OrVFTIagVTIClZ2Tpjidk="; npmDepsHash = "sha256-BRo71A07BhrioiBFisCR01OrVFTIagVTIClZ2Tpjidk=";
passthru.updateScript = let passthru.updateScript = writeShellApplication {
script = writeShellApplication {
name = "update"; name = "update";
runtimeInputs = [ runtimeInputs = [
nodejs_latest nodejs_latest
@ -43,13 +41,6 @@ in
]; ];
text = import ./update.nix; text = import ./update.nix;
}; };
in
nix-update-script {
extraArgs = [
"--version=skip"
"; ${script}"
];
};
meta = { meta = {
mainProgram = pname; mainProgram = pname;

View file

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