add flake output for the website root

This commit is contained in:
Charles Hall 2024-11-22 11:16:33 -08:00
parent af15f0c596
commit 2bf1975e75
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
4 changed files with 34 additions and 2 deletions

View file

@ -57,7 +57,8 @@ pages:
stage: deploy stage: deploy
image: nixos/nix:2.18.2 image: nixos/nix:2.18.2
script: script:
- direnv exec . mdbook build - nix build .#website-root
- cp --recursive --dereference result public
artifacts: artifacts:
paths: paths:
- public - public

View file

@ -5,7 +5,7 @@ multilingual = false
src = "book" src = "book"
[build] [build]
build-dir = "public" build-dir = "target/book"
[output.html] [output.html]
git-repository-icon = "fa-git-square" git-repository-icon = "fa-git-square"

View file

@ -65,6 +65,8 @@
(fenix.targets.${target}.fromManifestFile inputs.rust-manifest) (fenix.targets.${target}.fromManifestFile inputs.rust-manifest)
.withComponents components) .withComponents components)
targets); targets);
website-root = self.callPackage ./nix/pkgs/website-root {};
}); });
in in
inputs.flake-utils.lib.eachDefaultSystem (system: inputs.flake-utils.lib.eachDefaultSystem (system:
@ -81,6 +83,7 @@
{ {
packages = { packages = {
default = (mkScope pkgs).default; default = (mkScope pkgs).default;
website-root = (mkScope pkgs).website-root;
} }
// //
builtins.listToAttrs builtins.listToAttrs

View file

@ -0,0 +1,28 @@
# Keep sorted
{ inputs
, lib
, mdbook
, stdenv
}:
stdenv.mkDerivation {
name = "website-root";
src = let filter = inputs.nix-filter.lib; in filter {
root = inputs.self;
# Keep sorted
include = [
"book"
"book.toml"
];
};
buildPhase = ''
${lib.getExe mdbook} build
'';
installPhase = ''
mv target/book $out
'';
}