update dev runtime

This commit is contained in:
Yan Lin 2026-01-27 17:06:14 +01:00
parent 258efe1481
commit 2148c540ee
5 changed files with 52 additions and 27 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
dist/*.html
dist/*/index.html
dist/.nojekyll
.direnv/

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1769170682,
"narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c5296fdd05cfa2c187990dd909864da9658df755",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View file

@ -0,0 +1,23 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in {
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
uv python312
(writeShellScriptBin "serve" ''
python generate.py && python watch.py
'')
];
shellHook = ''
uv sync
source .venv/bin/activate
'';
};
});
};
}

View file

@ -1,27 +0,0 @@
{ pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
packages = with pkgs; [
python312
uv
];
shellHook = let
venvPath = "$HOME/.venv/homepage";
in ''
# Set uv to use specific virtual environment path
export UV_PROJECT_ENVIRONMENT=${venvPath}
# Install dependencies with uv
uv sync
# Activate the virtual environment
source ${venvPath}/bin/activate
# Define aliases
alias serve="python generate.py && python watch.py"
echo "Available commands:"
echo " serve - Watch and rebuild on changes"
'';
}