diff --git a/apps/update/src/app.ts b/apps/update/src/app.ts index 074e76f2..1ee3f770 100644 --- a/apps/update/src/app.ts +++ b/apps/update/src/app.ts @@ -1,6 +1,6 @@ import { parseArgs } from './lib.ts'; import { updateFirefoxAddons } from '././firefox.ts'; -import { updateDocker, updateVuetorrent } from './misc.ts'; +import { updateDocker, updateFlakeInputs, updateVuetorrent } from './misc.ts'; const args = parseArgs(); @@ -9,6 +9,10 @@ if (args['d'] || args['docker']) { console.log(updateDocker()); } +if (args['i'] || args['inputs']) { + console.log(updateFlakeInputs()); +} + if (args['f'] || args['firefox']) { console.log(updateFirefoxAddons()); } @@ -18,7 +22,8 @@ if (args['v'] || args['vuetorrent']) { } if (args['a'] || args['all']) { - console.log(updateVuetorrent()); - console.log(updateFirefoxAddons()); console.log(updateDocker()); + console.log(updateFlakeInputs()); + console.log(updateFirefoxAddons()); + console.log(updateVuetorrent()); } diff --git a/apps/update/src/misc.ts b/apps/update/src/misc.ts index b00afd62..7f3d4ace 100644 --- a/apps/update/src/misc.ts +++ b/apps/update/src/misc.ts @@ -7,6 +7,24 @@ import { parseFetchurl } from './lib.ts'; /* Constants */ const FLAKE = process.env.FLAKE; +export const updateFlakeInputs = () => { + const output = spawnSync( + `nix flake update --flake ${FLAKE} |& grep -v "warning: updating lock file"`, + [], + { shell: true }, + ).stdout + .toString() + .split('\n•') + .join('\n\n•') + .split('\n') + .map((l) => l + .replace(/.{33}\?narHash=sha256[^']*/, '') + .replace(/&rev=(.{7})[^'&]*/, (_, backref) => `&rev=${backref}`)) + .join('\n'); + + return output; +}; + export const updateDocker = () => { let updates = '';