diff --git a/website/README.md b/website/README.md index 845d52f8..64e781b8 100644 --- a/website/README.md +++ b/website/README.md @@ -15,18 +15,15 @@ Structured content is managed through Nix expressions, and copy is written in [C - [Install Nix](https://nix.dev/install-nix) - [Set up `direnv`](https://github.com/nix-community/nix-direnv#installation) - Run `direnv allow` in the directory where repository is stored on your machine -- Edit any of the files, see [repository layout](#repository-layout) for guidance -- Build and view the web site +- Start a live preview in a different terminal: ```bash - xdg-open $(nix-build -A build --no-out-link)/index.html + devmode ``` - or + This will open your default web browser and automatically reload the page when the source changes. - ```fish - open (nix-build -A build --no-out-link)/index.html - ``` +- Edit any of the files, see [repository layout](#repository-layout) for guidance # Repository layout diff --git a/website/default.nix b/website/default.nix index daad6a00..fba35ba5 100644 --- a/website/default.nix +++ b/website/default.nix @@ -14,6 +14,12 @@ let in new // { types = prev.recursiveUpdate prev.types new.types; }; lib'' = lib.extend lib'; + # TODO: update when the PR to expose `pkgs.devmode` is merged + # https://github.com/NixOS/nixpkgs/pull/354556 + devmode = pkgs.callPackage "${sources.devmode-reusable}/pkgs/by-name/de/devmode/package.nix" { + buildArgs = "${toString ./.} -A build"; + open = "/index.html"; + }; in rec { lib = import ./lib.nix { inherit lib; }; @@ -36,6 +42,7 @@ rec { packages = with pkgs; [ cmark npins + devmode ]; }; } diff --git a/website/npins/sources.json b/website/npins/sources.json index ea60a220..ebb34b2e 100644 --- a/website/npins/sources.json +++ b/website/npins/sources.json @@ -1,5 +1,17 @@ { "pins": { + "devmode-reusable": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "fricklerhandwerk", + "repo": "nixpkgs" + }, + "branch": "refactor-devmode", + "revision": "f0746a6690939987734d6519a2e3daf28ed36d87", + "url": "https://github.com/fricklerhandwerk/nixpkgs/archive/f0746a6690939987734d6519a2e3daf28ed36d87.tar.gz", + "hash": "011kg3c2mfy7y808llpmq3hf6vv6rlazx8m11w41pnym4kwr3ivz" + }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable",