feat(update): get rid of updateCustomPackage func
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-02-16 20:40:18 -05:00
parent d5db4c4e88
commit 018a5aee9e
4 changed files with 37 additions and 33 deletions

View file

@ -11,7 +11,6 @@ import updateNodeModules from './node-modules';
import { import {
runNixUpdate, runNixUpdate,
updateCaddyPlugins, updateCaddyPlugins,
updateCustomPackage,
updateVuetorrent, updateVuetorrent,
} from './misc'; } from './misc';
@ -28,9 +27,7 @@ const args = parseArgs();
const main = async() => { const main = async() => {
if (args['c'] || args['custom-sidebar']) { if (args['c'] || args['custom-sidebar']) {
console.log(updateCustomPackage( console.log(runNixUpdate('scopedPackages', 'lovelace-components', 'custom-sidebar'));
'scopedPackages.x86_64-linux.lovelace-components.custom-sidebar',
));
} }
if (args['cp'] || args['caddy-plugins']) { if (args['cp'] || args['caddy-plugins']) {
@ -74,7 +71,7 @@ const main = async() => {
} }
if (args['s'] || args['some-sass-language-server']) { if (args['s'] || args['some-sass-language-server']) {
console.log(updateCustomPackage('some-sass-language-server')); console.log(runNixUpdate('some-sass-language-server'));
} }
if (args['t'] || args['trash-d']) { if (args['t'] || args['trash-d']) {
@ -117,12 +114,6 @@ const main = async() => {
console.log(caddyPluginsOutput); console.log(caddyPluginsOutput);
// These don't need to be added to commit message
console.log(updateCustomPackage(
'scopedPackages.x86_64-linux.lovelace-components.custom-sidebar',
));
console.log(updateCustomPackage('some-sass-language-server'));
// nix-update executions // nix-update executions
let nixUpdateOutputs = ''; let nixUpdateOutputs = '';
@ -142,7 +133,9 @@ const main = async() => {
updatePackage('jmusicbot'); updatePackage('jmusicbot');
updatePackage('pam-fprint-grosshack'); updatePackage('pam-fprint-grosshack');
updatePackage('protonhax'); updatePackage('protonhax');
updatePackage('some-sass-language-server');
updatePackage('trash-d'); updatePackage('trash-d');
updatePackage('scopedPackages', 'lovelace-components', 'custom-sidebar');
updatePackage('scopedPackages', 'lovelace-components', 'material-rounded-theme'); updatePackage('scopedPackages', 'lovelace-components', 'material-rounded-theme');

View file

@ -41,13 +41,6 @@ export const updateVuetorrent = () => {
}; };
export const updateCustomPackage = (pkg: string) => spawnSync(
`nix run ${FLAKE}#${pkg}.update`,
[],
{ shell: true },
).stderr.toString();
const getAttrVersion = (attr: string): string => spawnSync('nix', const getAttrVersion = (attr: string): string => spawnSync('nix',
['eval', '--raw', `${FLAKE}#${attr}.version`], ['eval', '--raw', `${FLAKE}#${attr}.version`],
{ shell: true }).stdout.toString(); { shell: true }).stdout.toString();

View file

@ -3,6 +3,7 @@
lib, lib,
buildNpmPackage, buildNpmPackage,
makeWrapper, makeWrapper,
nix-update-script,
writeShellApplication, writeShellApplication,
# update script deps # update script deps
nodejs_latest, nodejs_latest,
@ -32,15 +33,23 @@ in
npmDepsHash = "sha256-BRo71A07BhrioiBFisCR01OrVFTIagVTIClZ2Tpjidk="; npmDepsHash = "sha256-BRo71A07BhrioiBFisCR01OrVFTIagVTIClZ2Tpjidk=";
passthru.update = writeShellApplication { passthru.updateScript = let
name = "update"; script = writeShellApplication {
runtimeInputs = [ name = "update";
nodejs_latest runtimeInputs = [
prefetch-npm-deps nodejs_latest
jq prefetch-npm-deps
]; jq
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,6 +4,7 @@
nodejs, nodejs,
pnpm, pnpm,
stdenv, stdenv,
nix-update-script,
... ...
}: let }: let
inherit (builtins) fromJSON readFile; inherit (builtins) fromJSON readFile;
@ -35,10 +36,18 @@ in
hash = "sha256-II8expO942jHylgbiePr5+V+t+UVh7fenffoyVFn/8k="; hash = "sha256-II8expO942jHylgbiePr5+V+t+UVh7fenffoyVFn/8k=";
}; };
passthru.update = concatTextFile { passthru.updateScript = let
name = "update"; script = "${concatTextFile {
files = [./update.sh]; name = "update";
executable = true; files = [./update.sh];
destination = "/bin/update"; executable = true;
}; destination = "/bin/update";
}}/bin/update";
in
nix-update-script {
extraArgs = [
"--version=skip"
"; ${script}"
];
};
}) })