Compare commits

...

2 commits

Author SHA1 Message Date
Valentin Gagarin d0534612f3 add note on using direnv 2024-11-08 19:36:33 +01:00
Valentin Gagarin ff9a0768bf add devmode for live preview 2024-11-08 19:36:19 +01:00
3 changed files with 28 additions and 7 deletions

View file

@ -15,18 +15,20 @@ 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
> **Note**
>
> This is a security boundary, and allows automatically running code from this repository on your machine.
- 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

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