nixos-configs/apps/update/src/misc.ts

75 lines
2.2 KiB
TypeScript
Raw Normal View History

import { readdirSync, writeFileSync } from 'node:fs';
import { spawnSync } from 'node:child_process';
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()
// Add an extra blank line between inputs
.split('\n•')
.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 = () => {
let updates = '';
2024-07-24 15:49:31 -04:00
const FILE = `${FLAKE}/devices/nos/modules/docker`;
readdirSync(FILE, { withFileTypes: true, recursive: true }).forEach((path) => {
if (path.name === 'compose.nix') {
chore: update flake.lock Flake Inputs: • Updated input 'discord-overlay': 'github:matt1432/discord-nightly-overlay/798e83f' (2024-07-27) → 'github:matt1432/discord-nightly-overlay/4df152b' (2024-07-29) • Updated input 'gpu-screen-recorder-src': 'git+https://repo.dec05eba.com/gpu-screen-recorder?ref=refs/heads/master&rev=5e2a233' (2024-07-26) → 'git+https://repo.dec05eba.com/gpu-screen-recorder?ref=refs/heads/master&rev=ddf3fa5' (2024-07-28) • Updated input 'gtk-theme-src': 'github:dracula/gtk/c9896cb' (2024-07-21) → 'github:dracula/gtk/100310f' (2024-07-29) • Updated input 'headscale': 'github:juanfont/headscale/4ad3f3c' (2024-07-22) → 'github:juanfont/headscale/06f0705' (2024-07-28) • Updated input 'home-manager': 'github:nix-community/home-manager/975b83c' (2024-07-27) → 'github:nix-community/home-manager/89670e2' (2024-07-29) • Updated input 'hyprland': 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=729b47d46d0c749efbffe01ea863a124fad562b4&submodules=1' (2024-07-27) → 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=e67322034037fef22079c8e480be38c1d04b5a4a&submodules=1' (2024-07-29) • Updated input 'hyprland/aquamarine': 'github:hyprwm/aquamarine/f95d1509370b7f40ef356ff69a332bd0356ab044?narHash=sha256-GFDSPWxOqEkNrbuSfyoQHGIaRhJNapn2Rv0EEmBGR9A%3D' (2024-07-26) → 'github:hyprwm/aquamarine/4918e57979bbdbd05aabb20f63e1cb5dc289bcbd?narHash=sha256-75Hcx5Zu0f%2BBeCkZxN1frkYacjbkwgCq%2Bz3doVgr4Hw%3D' (2024-07-27) • Updated input 'hyprland/hyprutils': 'github:hyprwm/hyprutils/962582a090bc233c4de9d9897f46794280288989?narHash=sha256-WAZ0X6yJW1hFG6otkHBfyJDKRpNP5stsRqdEuHrFRpk%3D' (2024-07-18) → 'github:hyprwm/hyprutils/5dcbbc1e3de40b2cecfd2007434d86e924468f1f?narHash=sha256-D3wIZlBNh7LuZ0NaoCpY/Pvu%2BxHxIVtSN%2BKkWZYvvVs%3D' (2024-07-27) • Updated input 'hyprland/xdph': 'github:hyprwm/xdg-desktop-portal-hyprland/5555f467f68ce7cdf1060991c24263073b95e9da?narHash=sha256-O17b38bQnmfxv7It3OnVYx7fp1seEdI7xxnw5vJFv30%3D' (2024-07-23) → 'github:hyprwm/xdg-desktop-portal-hyprland/0e2f3b9c85f7bab3983098a01366876d34daf383?narHash=sha256-Lj/g1UzrsTZUixtveQix6eB3pon2j23qv5/5pzTx0LQ%3D' (2024-07-28) • Updated input 'hyprland/xdph/hyprland-protocols': 'github:hyprwm/hyprland-protocols/1b61f0093afff20ab44d88ad707aed8bf2215290?narHash=sha256-HUklK5u86w2Yh9dOkk4FdsL8eehcOZ95jPhLixGDRQY%3D' (2024-06-18) → 'github:hyprwm/hyprland-protocols/5a11232266bf1a1f5952d5b179c3f4b2facaaa84?narHash=sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg%3D' (2024-07-18) • Updated input 'hyprgrass': 'github:horriblename/hyprgrass/736119f' (2024-06-14) → 'github:horriblename/hyprgrass/5c93341' (2024-07-28) • Updated input 'nix-gaming': 'github:fufexan/nix-gaming/dc966ed' (2024-07-27) → 'github:fufexan/nix-gaming/7a07614' (2024-07-29) • Updated input 'nix-gaming/umu': 'git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix&ref=refs/heads/main&rev=abbdeed&submodules=1' (2024-07-20) → 'git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix&ref=refs/heads/main&rev=7e00027&submodules=1' (2024-07-26) • Updated input 'nix-index-db': 'github:Mic92/nix-index-database/b6db9fd' (2024-07-21) → 'github:Mic92/nix-index-database/c0ca47e' (2024-07-28) • Updated input 'nixpkgs-wayland': 'github:nix-community/nixpkgs-wayland/9cf33b4' (2024-07-27) → 'github:nix-community/nixpkgs-wayland/6642ef6' (2024-07-28) • Updated input 'nixpkgs-wayland/lib-aggregate': 'github:nix-community/lib-aggregate/e0ea775' (2024-07-21) → 'github:nix-community/lib-aggregate/4ce8efe' (2024-07-28) • Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib': 'github:nix-community/nixpkgs.lib/31a9902' (2024-07-21) → 'github:nix-community/nixpkgs.lib/d15f6f6' (2024-07-28) Docker Images: • rssbridge/rss-bridge latest: sha256:94480c924f35512e81ad846fd9968591c63d20221484b7774083055b990ab31f → sha256:5d8906da7276396e077e054eb7e646f4f02d639be60a0b3bded97ec751fc0700 • ghcr.io/linuxserver/calibre-web latest: sha256:604ae903f520bd5485bcbdb2f70ea460c90a559bca3d4ac3fc05b93da2737a0a → sha256:49660a8890e2e4356cbc4b8874ff5ad1ebc40f647fdb2419fc289700affebcf0 • ghcr.io/linuxserver/radarr latest: sha256:2a02b311cefb344cd0caf74a443b9d6318daf15bda5280a3bc732381db983dc3 → sha256:9d6f0548fd805edb30108fdd06d0fc5a4436c9bd708b57bd4119d7aefa815fe4 • ghcr.io/fallenbagel/jellyseerr develop: sha256:4faf2f19c7a2be559354821e7da57477c236a22afb78e17a40dd40a75a120435 → sha256:788f508bdb33812a77acc8281e1299ff95ddebd07aee40d452e4f0c74bb15dc9
2024-07-30 01:45:01 -04:00
console.log(`Updating ${path.parentPath.split('/').at(-1)} images`);
updates += spawnSync('updateImages', [path.parentPath], { shell: true })
.stdout.toString();
}
});
return updates;
};
const genVueText = (version: string, hash: string, url: string) =>
`# This file was autogenerated. DO NOT EDIT!
{
version = "${version}";
url = "${url}";
hash = "${hash}";
}
`;
export const updateVuetorrent = () => {
const FILE = `${FLAKE}/devices/nos/modules/qbittorrent/vuetorrent.nix`;
const OLD_VERSION = JSON.parse(spawnSync('nix',
['eval', '-f', FILE, '--json'],
{ 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 URL = `https://github.com/VueTorrent/VueTorrent/releases/download/v${VERSION}/vuetorrent.zip`;
const HASH = parseFetchurl(URL);
const fileText = genVueText(VERSION, HASH, URL);
writeFileSync(FILE, fileText);
chore: update flake.lock Flake Inputs: • Updated input 'gpu-screen-recorder-src': 'git+https://repo.dec05eba.com/gpu-screen-recorder?ref=refs/heads/master&rev=9ca5847' (2024-07-21) → 'git+https://repo.dec05eba.com/gpu-screen-recorder?ref=refs/heads/master&rev=da73b3a' (2024-07-22) • Updated input 'gtk-theme-src': 'github:dracula/gtk/25dc510' (2024-07-14) → 'github:dracula/gtk/c9896cb' (2024-07-21) • Updated input 'headscale': 'github:juanfont/headscale/ca47d6f' (2024-07-19) → 'github:juanfont/headscale/4ad3f3c' (2024-07-22) • Updated input 'home-manager': 'github:nix-community/home-manager/afd2021' (2024-07-16) → 'github:nix-community/home-manager/635563f' (2024-07-21) • Updated input 'hyprland': 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=f642fb9&submodules=1' (2024-07-20) → 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=3c758db&submodules=1' (2024-07-22) • Added input 'hyprland/aquamarine': 'github:hyprwm/aquamarine/601f6cf' (2024-07-21) • Added input 'hyprland/aquamarine/hyprutils': follows 'hyprland/hyprutils' • Added input 'hyprland/aquamarine/hyprwayland-scanner': follows 'hyprland/hyprwayland-scanner' • Added input 'hyprland/aquamarine/nixpkgs': follows 'hyprland/nixpkgs' • Added input 'hyprland/aquamarine/systems': follows 'hyprland/systems' • Updated input 'hyprland/hyprcursor': 'github:hyprwm/hyprcursor/a5c0d57' (2024-07-04) → 'github:hyprwm/hyprcursor/4493a97' (2024-07-18) • Updated input 'hyprland/hyprlang': 'github:hyprwm/hyprlang/5df0174' (2024-07-07) → 'github:hyprwm/hyprlang/adbefbf' (2024-07-18) • Updated input 'hyprland/hyprutils': 'github:hyprwm/hyprutils/eb1ceff' (2024-07-15) → 'github:hyprwm/hyprutils/962582a' (2024-07-18) • Updated input 'hyprland/hyprwayland-scanner': 'github:hyprwm/hyprwayland-scanner/d5fa094' (2024-07-05) → 'github:hyprwm/hyprwayland-scanner/a048a6c' (2024-07-18) • Updated input 'hyprland/xdph': 'github:hyprwm/xdg-desktop-portal-hyprland/b9b97e5' (2024-07-05) → 'github:hyprwm/xdg-desktop-portal-hyprland/663be9c' (2024-07-22) • Updated input 'hyprland-plugins': 'github:hyprwm/hyprland-plugins/f23d3eb' (2024-07-19) → 'github:hyprwm/hyprland-plugins/4c2cef8' (2024-07-22) • Updated input 'neovim-nightly': 'github:nix-community/neovim-nightly-overlay/d9fcc47' (2024-07-19) → 'github:nix-community/neovim-nightly-overlay/464172e' (2024-07-22) • Updated input 'neovim-nightly/neovim-src': 'github:neovim/neovim/f61efe3' (2024-07-18) → 'github:neovim/neovim/7381f0a' (2024-07-21) • Updated input 'nix-on-droid': 'github:nix-community/nix-on-droid/c00333e' (2024-07-14) → 'github:nix-community/nix-on-droid/248cc08' (2024-07-22) • Updated input 'nixd': 'github:nix-community/nixd/334da32' (2024-07-16) → 'github:nix-community/nixd/87135e0' (2024-07-21) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/1d9c2c9' (2024-07-19) → 'github:NixOS/nixpkgs/68c9ed8' (2024-07-21) • Updated input 'nixpkgs-wayland': 'github:nix-community/nixpkgs-wayland/ae7066a' (2024-07-20) → 'github:nix-community/nixpkgs-wayland/79e1f9e' (2024-07-22) • Updated input 'nixpkgs-wayland/lib-aggregate': 'github:nix-community/lib-aggregate/6e56a6f' (2024-07-14) → 'github:nix-community/lib-aggregate/e0ea775' (2024-07-21) • Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib': 'github:nix-community/nixpkgs.lib/3b0b176' (2024-07-14) → 'github:nix-community/nixpkgs.lib/31a9902' (2024-07-21) • Updated input 'sops-nix': 'github:Mic92/sops-nix/909e8cf' (2024-07-21) → 'github:Mic92/sops-nix/aff2f88' (2024-07-22) • Updated input 'ts-for-gir-src': 'github:gjsify/ts-for-gir/199bb13' (2024-07-19) → 'github:gjsify/ts-for-gir/8b3ec80' (2024-07-22) Docker Images: • ghcr.io/linuxserver/radarr latest: sha256:1eaf9e83fca2b9170d4f49f6c0e55ba38693718e7815743a9ec297d199ab1e73 → sha256:2a02b311cefb344cd0caf74a443b9d6318daf15bda5280a3bc732381db983dc3 • ghcr.io/fallenbagel/jellyseerr develop: sha256:743fa4f6d66d2e558abc35239c4edeeaed74493728b0717111dea7f003bf262f → sha256:15e7464dd1a2997d9398b1f2161c7e8fff8518cf71c1b20b8fb1b5e354b31ece Misc Sources: Vuetorrent: 2.10.2 -> 2.11.0
2024-07-22 20:16:03 -04:00
return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : '';
};