Get stuff building on NixOS proper

This commit is contained in:
2026-01-20 04:17:32 +00:00
parent 9ef4de75cc
commit f90838df73
2 changed files with 23 additions and 16 deletions

View File

@@ -26,6 +26,6 @@ for (const pageUrl of pages) {
await page.evaluate(() => new Promise(requestAnimationFrame)); await page.evaluate(() => new Promise(requestAnimationFrame));
await expect(page).toHaveScreenshot({ fullPage: true }); await expect(page).toHaveScreenshot({ fullPage: true, timeout: 20_000 });
}); });
} }

View File

@@ -10,34 +10,41 @@
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; }; let pkgs = import nixpkgs { inherit system; };
builtBlog = blog.defaultPackage.${system}; builtBlog = blog.defaultPackage.${system};
blogWithRelativeLinks = pkgs.stdenv.mkDerivation {
name = "blogWithRelativeLinks";
version = "1.0";
buildInputs = [
(pkgs.python3.withPackages (ps: [
ps.beautifulsoup4
ps.lxml
]))
];
builtBlog = builtBlog;
urlScript = pkgs.writeTextFile { name = "chatgpt-fix-root-URLs.py"; text = builtins.readFile ./scripts/chatgpt-fix-root-URLs.py; };
builder = builtins.toFile "builder.sh" "
source $stdenv/setup
mkdir -p code $out
cp -r $builtBlog/* code
chmod -R u+w code
(cd code && python3 $urlScript)
cp -r code/* $out
";
};
in { in {
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
packages = [ packages = [
pkgs.nodejs pkgs.nodejs
pkgs.yarn pkgs.yarn
pkgs.chromium pkgs.chromium
builtBlog pkgs.python3
]; ];
nativeBuildInputs = [ pkgs.yarnConfigHook ];
# Must be named this for pkgs.yarnConfigHook
yarnOfflineCache = pkgs.fetchYarnDeps {
yarnLock = ./yarn.lock;
hash = "sha256-jUa1XkxJ2dS6nTyH/gRrTkEedSUgcl7k6wd3OiCkj6A=";
};
# Configure to use system Chromium # Configure to use system Chromium
PLAYWRIGHT_CHROMIUM_PATH = "${pkgs.chromium}/bin/chromium"; PLAYWRIGHT_CHROMIUM_PATH = "${pkgs.chromium}/bin/chromium";
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"; PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
# Expose the built blog package, which we'll be testing # Expose the built blog package, which we'll be testing
builtBlog = builtBlog; blogWithRelativeLinks = blogWithRelativeLinks;
# Optional but often needed in Nix sandboxes:
# XDG_CACHE_HOME = "$TMPDIR/xdg-cache";
# XDG_CONFIG_HOME = "$TMPDIR/xdg-config";
# XDG_DATA_HOME = "$TMPDIR/xdg-data";
}; };
} }
); );