Add initial draft of flake.nix
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
18
flake.nix
18
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";
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user