Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
58 lines (52 loc) · 2.09 KB
/
Copy pathflake.nix
File metadata and controls
58 lines (52 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
description = "Jekyll dev shell for tokugero.github.io";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.ruby
pkgs.bundler
pkgs.git
pkgs.zlib
pkgs.libffi
pkgs.makeWrapper
pkgs.gcc
pkgs.pkg-config
pkgs.libyaml
pkgs.openssl
pkgs.nodejs
pkgs.playwright-driver.browsers
];
shellHook = ''
export GEM_HOME="$PWD/.gems"
export PATH="$GEM_HOME/bin:$PATH"
export PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
# Auto-install bundle dependencies
if [ ! -d vendor/bundle ]; then
echo "First time setup: installing bundle dependencies..."
bundle config set --local path 'vendor/bundle'
bundle install --quiet
fi
# Auto-install playwright node module (pinned to match Nix browsers)
PLAYWRIGHT_NIX_VERSION=$(node -e "console.log(require('$(dirname $(which playwright))/../lib/node_modules/playwright-core/package.json').version)" 2>/dev/null || echo "")
if [ -n "$PLAYWRIGHT_NIX_VERSION" ]; then
CURRENT_PW_VERSION=$(node -e "try{console.log(require('playwright-core/package.json').version)}catch(e){}" 2>/dev/null || echo "")
if [ "$CURRENT_PW_VERSION" != "$PLAYWRIGHT_NIX_VERSION" ]; then
echo "Installing playwright@$PLAYWRIGHT_NIX_VERSION (matching Nix browsers)..."
npm install --no-save "playwright@$PLAYWRIGHT_NIX_VERSION" 2>/dev/null
fi
fi
echo "Dev environment ready. Run: bundle exec jekyll serve"
'';
};
}
);
}