diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 992c0ea..fd057e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist/*.html dist/*/index.html dist/.nojekyll +.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..20a470c --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bf4f33d --- /dev/null +++ b/flake.nix @@ -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 + ''; + }; + }); + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 3e53187..0000000 --- a/shell.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ pkgs ? import {}}: - -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" - ''; -}