Add initial draft of flake.nix

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
2026-01-19 15:18:53 -08:00
parent 69783ca88a
commit 9781695929
3 changed files with 14 additions and 12 deletions

View File

@@ -2,16 +2,21 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
blog.url = "git+https://dev.danilafe.com/Nix-Configs/blog-static-flake.git";
blog.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, nixpkgs, flake-utils, }: outputs = { self, nixpkgs, flake-utils, blog, }:
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};
in { in {
default = pkgs.mkShell { devShell = pkgs.mkShell {
packages = [ packages = [
pkgs.nodejs pkgs.nodejs
pkgs.yarn pkgs.yarn
pkgs.chromium
builtBlog
]; ];
nativeBuildInputs = [ pkgs.yarnConfigHook ]; nativeBuildInputs = [ pkgs.yarnConfigHook ];
@@ -19,10 +24,15 @@
# Must be named this for pkgs.yarnConfigHook # Must be named this for pkgs.yarnConfigHook
yarnOfflineCache = pkgs.fetchYarnDeps { yarnOfflineCache = pkgs.fetchYarnDeps {
yarnLock = ./yarn.lock; yarnLock = ./yarn.lock;
hash = "sha256-jUa1XkxJ2dS6nTyH/gRrTkEedSUgcl7k6wd3OiCkj6A=";
}; };
# PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers; # Configure to use system Chromium
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"; PLAYWRIGHT_CHROMIUM_PATH = "${pkgs.chromium}/bin/chromium";
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
# Expose the built blog package, which we'll be testing
builtBlog = builtBlog;
# Optional but often needed in Nix sandboxes: # Optional but often needed in Nix sandboxes:
# XDG_CACHE_HOME = "$TMPDIR/xdg-cache"; # XDG_CACHE_HOME = "$TMPDIR/xdg-cache";

View File

@@ -1,8 +0,0 @@
function cleanurls { for result in $(find . -name "result-*"); do; (cd $result; python3 ../chatgpt-fix-root-URLs.py); done; }
function htmls { find -s result-$1/blog -name "*.html" | sed "s|^result-$1/|http://localhost:8081/|" | awk 'BEGIN { print "export const pages = [" } { printf(" \"%s\",\n", $0); } END { print "]" }'; }
function commonhtmls { comm -12 <(htmls $1) <(htmls $2); }
function compare {
commonhtmls $1 $2 > e2e/pages.ts;
# (cd result-$1 && python -m http.server 8081 & SERVER_PID=$! && trap "kill $SERVER_PID" EXIT && sleep 1 && cd .. && npx playwright test);
(cd result-$2 && python -m http.server 8081 & SERVER_PID=$! && trap "kill $SERVER_PID" EXIT && sleep 1 && cd .. && npx playwright test);
}