add devmode for live preview

This commit is contained in:
Valentin Gagarin 2024-11-08 19:28:45 +01:00
parent 561b6cae27
commit c5d4e6a4aa
3 changed files with 22 additions and 9 deletions

View file

@ -15,18 +15,12 @@ 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
- View the web site with live updates as you change the source
```bash
xdg-open $(nix-build -A build --no-out-link)/index.html
```
or
```fish
open (nix-build -A build --no-out-link)/index.html
devmode
```
- Edit any of the files, see [repository layout](#repository-layout) for guidance
# Repository layout

View file

@ -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
];
};
}

View file

@ -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",