update with script

This commit is contained in:
nora 2025-07-03 20:00:12 +02:00
parent cc78321417
commit 4631ff2a1d
4 changed files with 50 additions and 9 deletions

View file

@ -1,6 +1,9 @@
{ {
meta = meta =
let nixpkgs-path = (fetchTarball "https://github.com/NixOS/nixpkgs/archive/7105ae3957700a9646cc4b766f5815b23ed0c682.tar.gz"); in let
my-projects-versions = builtins.fromJSON (builtins.readFile ./my-projects.json);
nixpkgs-path = (fetchTarball "https://github.com/NixOS/nixpkgs/archive/7105ae3957700a9646cc4b766f5815b23ed0c682.tar.gz");
in
{ {
# Override to pin the Nixpkgs version (recommended). This option # Override to pin the Nixpkgs version (recommended). This option
# accepts one of the following: # accepts one of the following:
@ -10,14 +13,12 @@
nixpkgs = import nixpkgs-path; # nixos-24.11 2025-03-21 nixpkgs = import nixpkgs-path; # nixos-24.11 2025-03-21
specialArgs = { specialArgs = {
website = import (fetchTarball "https://github.com/Noratrieb/website/archive/57c4a239da5d17eafde4ade165f3c6706639a9b4.tar.gz"); website = import (fetchTarball "https://github.com/Noratrieb/website/archive/${my-projects-versions.website}.tar.gz");
blog = fetchTarball "https://github.com/Noratrieb/blog/archive/04f7cf7d27db359cbf9fac2e9e3e677a7e76abd9.tar.gz"; blog = fetchTarball "https://github.com/Noratrieb/blog/archive/${my-projects-versions.blog}.tar.gz";
slides = fetchTarball "https://github.com/Noratrieb/slides/archive/0401f35c22b124b69447655f0c537badae9e223c.tar.gz"; slides = fetchTarball "https://github.com/Noratrieb/slides/archive/${my-projects-versions.slides}.tar.gz";
pretense = import (fetchTarball "https://github.com/Noratrieb/pretense/archive/${my-projects-versions.pretense}.tar.gz");
pretense = import (fetchTarball "https://github.com/Noratrieb/pretense/archive/270b01fc1118dfd713c1c41530d1a7d98f04527d.tar.gz"); quotdd = import (fetchTarball "https://github.com/Noratrieb/quotdd/archive/${my-projects-versions.quotdd}.tar.gz");
quotdd = import (fetchTarball "https://github.com/Noratrieb/quotdd/archive/9c37b3e2093020771ee7c9da6200f95d4269b4e4.tar.gz"); does-it-build = import (fetchTarball "https://github.com/Noratrieb/does-it-build/archive/${my-projects-versions.does-it-build}.tar.gz");
does-it-build = import (fetchTarball "https://github.com/Noratrieb/does-it-build/archive/79bb6d1eb06d47db7d59829cd6cce247d223a960.tar.gz");
inherit nixpkgs-path; inherit nixpkgs-path;

View file

@ -0,0 +1,8 @@
{
"website": "57c4a239da5d17eafde4ade165f3c6706639a9b4",
"blog": "ea2758dd10f29e8d66ca3f54d7303f2ac20005d2",
"slides": "0401f35c22b124b69447655f0c537badae9e223c",
"pretense": "270b01fc1118dfd713c1c41530d1a7d98f04527d",
"quotdd": "e922229e1d9e055be35dabd112bafc87a0686548",
"does-it-build": "79bb6d1eb06d47db7d59829cd6cce247d223a960"
}

View file

@ -0,0 +1,31 @@
import fs from "node:fs/promises";
const path = `${import.meta.dirname}/nix/my-projects.json`;
const projects = JSON.parse(await fs.readFile(path));
let hasChanges = false;
for (const [name, commit] of Object.entries(projects)) {
const res = await fetch(
`https://api.github.com/repos/Noratrieb/${name}/commits/HEAD`
);
if (!res.ok) {
throw new Error(
`get commit for ${name}: ${res.status} - ${await res.text()}`
);
}
const body = await res.json();
const latestCommit = body.sha;
if (commit !== latestCommit) {
console.log(
`${name} changed from ${commit} -> ${latestCommit} (${body.commit.message})`
);
projects[name] = latestCommit;
hasChanges = true;
}
}
if (hasChanges) {
await fs.writeFile(path, JSON.stringify(projects, null, 2) + "\n");
}

View file

@ -14,6 +14,7 @@
wireguard-tools wireguard-tools
python311Packages.zstandard python311Packages.zstandard
python311Packages.brotli python311Packages.brotli
nodejs
(import (builtins.fetchTarball "https://github.com/ryantm/agenix/archive/531beac616433bac6f9e2a19feb8e99a22a66baf.tar.gz") { }).agenix (import (builtins.fetchTarball "https://github.com/ryantm/agenix/archive/531beac616433bac6f9e2a19feb8e99a22a66baf.tar.gz") { }).agenix
]; ];
} }