diff --git a/flake.nix b/flake.nix index 46ecd0c..d473292 100644 --- a/flake.nix +++ b/flake.nix @@ -2,16 +2,21 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; 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: let pkgs = import nixpkgs { inherit system; }; + builtBlog = blog.defaultPackage.${system}; in { - default = pkgs.mkShell { + devShell = pkgs.mkShell { packages = [ pkgs.nodejs pkgs.yarn + pkgs.chromium + builtBlog ]; nativeBuildInputs = [ pkgs.yarnConfigHook ]; @@ -19,10 +24,15 @@ # Must be named this for pkgs.yarnConfigHook yarnOfflineCache = pkgs.fetchYarnDeps { yarnLock = ./yarn.lock; + hash = "sha256-jUa1XkxJ2dS6nTyH/gRrTkEedSUgcl7k6wd3OiCkj6A="; }; - # PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers; - # PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"; + # Configure to use system Chromium + 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: # XDG_CACHE_HOME = "$TMPDIR/xdg-cache"; diff --git a/functions.bash b/functions.bash deleted file mode 100644 index f23d297..0000000 --- a/functions.bash +++ /dev/null @@ -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); -} diff --git a/chatgpt-fix-root-URLs.py b/scripts/chatgpt-fix-root-URLs.py similarity index 100% rename from chatgpt-fix-root-URLs.py rename to scripts/chatgpt-fix-root-URLs.py