diff --git a/apps/update/default.nix b/apps/update/default.nix index 01797537..60fb9b03 100644 --- a/apps/update/default.nix +++ b/apps/update/default.nix @@ -15,7 +15,7 @@ in inherit (packageJSON) version; src = ./.; - npmDepsHash = "sha256-Vl27uo1cwRNjZCcSZTMqZBEwZNwwiqik0sJo4PVxg3c="; + npmDepsHash = "sha256-5miQfnSy559jVsqyZM5LqegMuIVsd+LOdsZ8FaHy24A="; runtimeInputs = [ (callPackage ../../nixosModules/docker/updateImage.nix {}) diff --git a/apps/update/package-lock.json b/apps/update/package-lock.json index 6c25adf2..57ee016c 100644 Binary files a/apps/update/package-lock.json and b/apps/update/package-lock.json differ diff --git a/apps/update/package.json b/apps/update/package.json index 0aaac7d2..3a06444e 100644 --- a/apps/update/package.json +++ b/apps/update/package.json @@ -12,7 +12,7 @@ "@types/node": "22.9.0", "esbuild": "0.24.0", "eslint": "9.14.0", - "eslint-plugin-jsdoc": "50.4.3", + "eslint-plugin-jsdoc": "50.5.0", "jiti": "2.4.0", "typescript": "5.6.3", "typescript-eslint": "8.14.0" diff --git a/apps/update/src/app.ts b/apps/update/src/app.ts index 9f107cfb..2c2c3c60 100644 --- a/apps/update/src/app.ts +++ b/apps/update/src/app.ts @@ -2,14 +2,11 @@ import { spawnSync } from 'node:child_process'; import { writeFileSync } from 'node:fs'; import { parseArgs } from './lib.ts'; -import { updateFirefoxAddons } from '././firefox.ts'; -import { - updateCustomPackage, - updateDocker, - updateFlakeInputs, - updateVuetorrent, -} from './misc.ts'; +import { updateDocker } from './docker.ts'; +import { updateFirefoxAddons } from '././firefox.ts'; +import { updateFlakeInputs } from './flake.ts'; +import { updateCustomPackage, updateVuetorrent } from './misc.ts'; /* Constants */ diff --git a/apps/update/src/docker.ts b/apps/update/src/docker.ts new file mode 100644 index 00000000..42655461 --- /dev/null +++ b/apps/update/src/docker.ts @@ -0,0 +1,33 @@ +import { readdirSync } from 'node:fs'; +import { spawnSync } from 'node:child_process'; + + +/* Constants */ +const FLAKE = process.env.FLAKE; + +export const updateDocker = () => { + const updateImages = (imagePath: string): string | undefined => { + console.log(`Updating ${imagePath.split('/').at(-1)} images`); + + const out = spawnSync('updateImages', [imagePath], { shell: true }).stdout.toString(); + + if (!out.startsWith('# Locked')) { + return out; + } + }; + + let updates = ''; + + updates += updateImages(`${FLAKE}/devices/nos/modules/jellyfin`) ?? ''; + updates += updateImages(`${FLAKE}/devices/homie/modules/home-assistant/netdaemon`) ?? ''; + + const DIR = `${FLAKE}/devices/nos/modules/docker`; + + readdirSync(DIR, { withFileTypes: true, recursive: true }).forEach((path) => { + if (path.name === 'compose.nix') { + updates += updateImages(path.parentPath) ?? ''; + } + }); + + return updates; +}; diff --git a/apps/update/src/flake.ts b/apps/update/src/flake.ts new file mode 100644 index 00000000..dced812c --- /dev/null +++ b/apps/update/src/flake.ts @@ -0,0 +1,35 @@ +import { spawnSync } from 'node:child_process'; + + +/* Constants */ +const FLAKE = process.env.FLAKE; + +export const updateFlakeInputs = () => { + const output = spawnSync( + `git restore flake.lock &> /dev/null; nix flake update --flake ${FLAKE}` + + ' |& grep -v "warning: updating lock file" |& grep -v "unpacking"', + [], + { shell: true }, + ).stdout + .toString() + // Add an extra blank line between inputs + .split('\n•') + .filter((input) => ![ + 'systems', + 'flake-utils', + 'flake-parts', + 'treefmt-nix', + 'lib-aggregate', + 'lib-aggregate/nixpkgs-lib', + 'sops-nix/nixpkgs-stable', + ].some((inputName) => input.startsWith(` Updated input '${inputName}'`))) + .join('\n\n•') + // Shorten git revs to help readability + .split('\n') + .map((l) => l + .replace(/.{33}\?narHash=sha256[^']*/, '') + .replace(/&rev=(.{7})[^'&]*/, (_, backref) => `&rev=${backref}`)) + .join('\n'); + + return output; +}; diff --git a/apps/update/src/misc.ts b/apps/update/src/misc.ts index 72a875a4..5b96c42d 100644 --- a/apps/update/src/misc.ts +++ b/apps/update/src/misc.ts @@ -1,4 +1,4 @@ -import { readdirSync, writeFileSync } from 'node:fs'; +import { writeFileSync } from 'node:fs'; import { spawnSync } from 'node:child_process'; import { parseFetchurl } from './lib.ts'; @@ -7,63 +7,6 @@ import { parseFetchurl } from './lib.ts'; /* Constants */ const FLAKE = process.env.FLAKE; -export const updateFlakeInputs = () => { - const output = spawnSync( - `git restore flake.lock &> /dev/null; nix flake update --flake ${FLAKE}` + - ' |& grep -v "warning: updating lock file" |& grep -v "unpacking"', - [], - { shell: true }, - ).stdout - .toString() - // Add an extra blank line between inputs - .split('\n•') - .filter((input) => ![ - 'systems', - 'flake-utils', - 'flake-parts', - 'treefmt-nix', - 'lib-aggregate', - 'lib-aggregate/nixpkgs-lib', - 'sops-nix/nixpkgs-stable', - ].some((inputName) => input.startsWith(` Updated input '${inputName}'`))) - .join('\n\n•') - // Shorten git revs to help readability - .split('\n') - .map((l) => l - .replace(/.{33}\?narHash=sha256[^']*/, '') - .replace(/&rev=(.{7})[^'&]*/, (_, backref) => `&rev=${backref}`)) - .join('\n'); - - return output; -}; - -export const updateDocker = () => { - const updateImages = (imagePath: string): string | undefined => { - console.log(`Updating ${imagePath.split('/').at(-1)} images`); - - const out = spawnSync('updateImages', [imagePath], { shell: true }).stdout.toString(); - - if (!out.startsWith('# Locked')) { - return out; - } - }; - - let updates = ''; - - updates += updateImages(`${FLAKE}/devices/nos/modules/jellyfin`) ?? ''; - updates += updateImages(`${FLAKE}/devices/homie/modules/home-assistant/netdaemon`) ?? ''; - - const DIR = `${FLAKE}/devices/nos/modules/docker`; - - readdirSync(DIR, { withFileTypes: true, recursive: true }).forEach((path) => { - if (path.name === 'compose.nix') { - updates += updateImages(path.parentPath) ?? ''; - } - }); - - return updates; -}; - const genVueText = ( version: string, hash: string, diff --git a/overlays/build-failures/default.nix b/overlays/build-failures/default.nix index f4756254..41e9b7af 100644 --- a/overlays/build-failures/default.nix +++ b/overlays/build-failures/default.nix @@ -8,4 +8,7 @@ final: prev: { --replace-fail 'REQUIRED_ARGS: -Icompilable' 'REQUIRED_ARGS: -Icompilable -L--no-demangle' ''; }); + + # FIXME: https://github.com/debug-js/debug/issues/975 + nodejs_latest = prev.nodejs_22; }