39 lines
969 B
Nix
39 lines
969 B
Nix
{
|
|
description = "A flake to build my website";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
...
|
|
}: let
|
|
system = "x86_64-linux";
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in {
|
|
packages.${system} = {
|
|
website = pkgs.callPackage ./package.nix {};
|
|
serve = pkgs.writeShellScriptBin "serveSite" ''
|
|
echo "Running server: visit http://localhost:8000/index.html"
|
|
exec ${pkgs.webfs}/bin/webfsd -F -p 8000 -r ${self.packages.${system}.website}
|
|
'';
|
|
};
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
packages = [
|
|
pkgs.watchexec
|
|
pkgs.nix
|
|
];
|
|
|
|
shellHook = ''
|
|
echo "Starting auto-reload dev shell..."
|
|
echo "Watching for file changes in $(pwd)"
|
|
echo "When something changes, we'll restart: nix run .#serve"
|
|
|
|
watchexec -r -e nix,html,css,js,org -- nix run .#serve
|
|
'';
|
|
};
|
|
};
|
|
}
|