diff --git a/apps/update-sources/src/app.ts b/apps/update-sources/src/app.ts index af0a2dee..78cf2511 100644 --- a/apps/update-sources/src/app.ts +++ b/apps/update-sources/src/app.ts @@ -148,11 +148,11 @@ const main = async() => { updatePackage('scopedPackages', 'lovelace-components', 'material-rounded-theme'); - spawnSync('alejandra', ['-q', FLAKE], { shell: true }); + spawnSync(`alejandra -q ${FLAKE}`, [], { shell: true }); spawnSync('nixFastBuild', [], { shell: true, - stdio: [process.stdin, process.stdout, process.stderr], + stdio: 'inherit', }); const indentOutput = (output: string): string => { @@ -198,7 +198,7 @@ const main = async() => { } } else { - spawnSync('alejandra', ['-q', FLAKE], { shell: true }); + spawnSync(`alejandra -q ${FLAKE}`, [], { shell: true }); } }; diff --git a/apps/update-sources/src/caddy.ts b/apps/update-sources/src/caddy.ts index ca84f9f6..d6ed6078 100644 --- a/apps/update-sources/src/caddy.ts +++ b/apps/update-sources/src/caddy.ts @@ -52,9 +52,9 @@ export default (): string | null => { { shell: true, cwd: '/tmp' }, ); - const plugins = JSON.parse(spawnSync('nix', - ['eval', '-f', `${dir}/plugins.nix`, '--json'], - { shell: true }).stdout.toString()).plugins as Record<string, Plugin>; + const plugins = JSON.parse(spawnSync( + ['nix', 'eval', '-f', `${dir}/plugins.nix`, '--json'].join(' '), [], { shell: true }, + ).stdout.toString()).plugins as Record<string, Plugin>; // Get most recent versions of plugins Object.entries(plugins).forEach(([key, value]) => { diff --git a/apps/update-sources/src/docker.ts b/apps/update-sources/src/docker.ts index fbc78009..d0dfe091 100644 --- a/apps/update-sources/src/docker.ts +++ b/apps/update-sources/src/docker.ts @@ -9,7 +9,7 @@ const FLAKE = process.env.FLAKE; const updateImages = (imagePath: string): string | undefined => { console.log(`Updating ${imagePath.split('/').at(-1)} images`); - const out = spawnSync('updateImages', [imagePath], { shell: true }).stdout.toString(); + const out = spawnSync(`updateImages ${imagePath}`, [], { shell: true }).stdout.toString(); if (out.length > 1) { return out; diff --git a/apps/update-sources/src/firefox.ts b/apps/update-sources/src/firefox.ts index 8531404c..1f4137c7 100644 --- a/apps/update-sources/src/firefox.ts +++ b/apps/update-sources/src/firefox.ts @@ -26,13 +26,14 @@ export default (): string | null => { y.type == "derivation") (attrValues x)) '`; - const OLD_VERS = Object.fromEntries([...JSON.parse(spawnSync('nix', [ + const OLD_VERS = Object.fromEntries([...JSON.parse(spawnSync([ + 'nix', 'eval', '.#scopedPackages.x86_64-linux.firefoxAddons', '--apply', nixExpr, '--json', - ], { shell: true }).stdout.toString())] + ].join(' '), [], { shell: true }).stdout.toString())] .map((p) => { const pname = p.replace(/-[0-9].*$/, ''); @@ -40,12 +41,9 @@ export default (): string | null => { }) .filter((pinfo) => pinfo[0] !== 'frankerfacez')); - const NEW_VERS = Object.fromEntries(spawnSync( - 'nix', - ['run', 'sourcehut:~rycee/mozilla-addons-to-nix', - SLUGS, GENERATED_FILE], - { shell: true }, - ).stdout + const NEW_VERS = Object.fromEntries(spawnSync([ + 'nix', 'run', 'sourcehut:~rycee/mozilla-addons-to-nix', SLUGS, GENERATED_FILE, + ].join(' '), [], { shell: true }).stdout .toString() .split('\n') .map((p) => { diff --git a/apps/update-sources/src/lib.ts b/apps/update-sources/src/lib.ts index 78642ad6..cbc97c5a 100644 --- a/apps/update-sources/src/lib.ts +++ b/apps/update-sources/src/lib.ts @@ -32,8 +32,8 @@ export const parseArgs = (): Args => { }; export const parseFetchurl = (url: string): string => JSON.parse(spawnSync( - 'nix', ['store', 'prefetch-file', '--refresh', '--json', - '--hash-type', 'sha256', url, '--name', '"escaped"'], { shell: true }, + ['nix', 'store', 'prefetch-file', '--refresh', '--json', + '--hash-type', 'sha256', url, '--name', '"escaped"'].join(' '), [], { shell: true }, ).stdout.toString()).hash; export const replaceInFile = (replace: RegExp, replacement: string, file: string): void => { diff --git a/apps/update-sources/src/netdaemon.ts b/apps/update-sources/src/netdaemon.ts index 0067c750..231a1e99 100644 --- a/apps/update-sources/src/netdaemon.ts +++ b/apps/update-sources/src/netdaemon.ts @@ -13,9 +13,9 @@ export default (): string | null => { const OLD_VERSION = readFileSync(`${FOLDER}/.version`).toString().replace('\n', ''); - const VERSION = JSON.parse(spawnSync('curl', - ['-s', 'https://api.github.com/repos/net-daemon/netdaemon/releases/latest'], - { shell: true }).stdout.toString()).tag_name.replace('v', ''); + const VERSION = JSON.parse(spawnSync([ + 'curl', '-s', 'https://api.github.com/repos/net-daemon/netdaemon/releases/latest', + ].join(' '), [], { shell: true }).stdout.toString()).tag_name.replace('v', ''); if (OLD_VERSION !== VERSION) { writeFileSync(`${FOLDER}/.version`, `${VERSION}\n`); diff --git a/apps/update-sources/src/nix-update.ts b/apps/update-sources/src/nix-update.ts index 4e1288e9..6966e95e 100644 --- a/apps/update-sources/src/nix-update.ts +++ b/apps/update-sources/src/nix-update.ts @@ -5,9 +5,9 @@ import { styleText } from 'node:util'; /* Constants */ const FLAKE = process.env.FLAKE; -const getAttrVersion = (attr: string): string => spawnSync('nix', - ['eval', '--raw', `${FLAKE}#${attr}.version`], - { shell: true }).stdout.toString(); +const getAttrVersion = (attr: string): string => spawnSync( + ['nix', 'eval', '--raw', `${FLAKE}#${attr}.version`].join(' '), [], { shell: true }, +).stdout.toString(); export default ( attr: string, diff --git a/apps/update-sources/src/node-modules.ts b/apps/update-sources/src/node-modules.ts index 18264d02..a5af6b7c 100644 --- a/apps/update-sources/src/node-modules.ts +++ b/apps/update-sources/src/node-modules.ts @@ -19,9 +19,9 @@ const updatePackageJson = async(workspaceDir: string, updates: object) => { const updateDeps = (deps: string) => { Object.keys(currentPackageJson[deps]).forEach(async(dep) => { if (dep === 'astal') { - const latestCommit = JSON.parse(spawnSync('curl', - ['-s', 'https://api.github.com/repos/Aylur/astal/commits/main'], - { shell: true }).stdout.toString()).sha; + const latestCommit = JSON.parse(spawnSync( + ['curl', '-s', 'https://api.github.com/repos/Aylur/astal/commits/main'].join(' '), [], { shell: true }, + ).stdout.toString()).sha; currentPackageJson[deps][dep] = `https://gitpkg.vercel.app/Aylur/astal/lang/gjs/src?${latestCommit}`; diff --git a/apps/update-sources/src/vuetorrent.ts b/apps/update-sources/src/vuetorrent.ts index fa1d23c5..48241150 100644 --- a/apps/update-sources/src/vuetorrent.ts +++ b/apps/update-sources/src/vuetorrent.ts @@ -25,13 +25,13 @@ export default (): string | null => { const FILE = `${FLAKE}/configurations/nos/modules/qbittorrent/vuetorrent.nix`; - const OLD_VERSION = JSON.parse(spawnSync('nix', - ['eval', '-f', FILE, '--json'], - { shell: true }).stdout.toString()).version; + const OLD_VERSION = JSON.parse(spawnSync( + ['nix', 'eval', '-f', FILE, '--json'].join(' '), [], { shell: true }, + ).stdout.toString()).version; - const VERSION = JSON.parse(spawnSync('curl', - ['-s', 'https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest'], - { shell: true }).stdout.toString()).tag_name.replace('v', ''); + const VERSION = JSON.parse(spawnSync( + ['curl', '-s', 'https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest'].join(' '), [], { shell: true }, + ).stdout.toString()).tag_name.replace('v', ''); const URL = `https://github.com/VueTorrent/VueTorrent/releases/download/v${VERSION}/vuetorrent.zip`; const HASH = parseFetchurl(URL);