docs: refactor, move out of flake.nix

also filter source to limit rebuilds
This commit is contained in:
zowoq 2024-05-25 10:15:05 +10:00
parent 7294a7afc9
commit 3fcadaf275
4 changed files with 31 additions and 18 deletions

View file

@ -31,7 +31,7 @@ jobs:
uses: actions/configure-pages@v5
- name: Build Pages
run: |
nix build .#pages
nix build .#docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:

27
dev/docs.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, pkgs, ... }:
{
devShells.mkdocs = pkgs.mkShellNoCC {
inputsFrom = [
config.packages.docs
];
};
packages = {
docs = pkgs.runCommand "docs"
{
buildInputs = [
pkgs.python3.pkgs.mkdocs-material
];
files = pkgs.lib.fileset.toSource {
root = ../.;
fileset = pkgs.lib.fileset.unions [
../docs
../mkdocs.yml
];
};
}
''
cd $files
mkdocs build --strict --site-dir $out
'';
};
}

View file

@ -11,11 +11,6 @@
ssh-to-age
];
};
mkdocs = with pkgs; mkShellNoCC {
packages = [
python3.pkgs.mkdocs-material
];
};
sotp = with pkgs; mkShellNoCC {
packages = [
(buildGoModule rec {

View file

@ -55,9 +55,10 @@
inputs.treefmt-nix.flakeModule
];
perSystem = { config, inputs', lib, pkgs, self', system, ... }:
perSystem = { inputs', lib, pkgs, self', system, ... }:
{
imports = [
./dev/docs.nix
./dev/shell.nix
./terraform/shell.nix
];
@ -82,23 +83,13 @@
darwinConfigurations // devShells // { inherit (self') formatter; } // nixosConfigurations
// pkgs.lib.optionalAttrs (system == "x86_64-linux")
{
inherit (self'.packages) pages;
inherit (self'.packages) docs;
nixpkgs-update-supervisor-test = pkgs.callPackage ./hosts/build02/supervisor_test.nix { };
nixosTests-buildbot = pkgs.nixosTests.buildbot;
nixosTests-buildbot-nix-master = inputs'.buildbot-nix.checks.master;
nixosTests-buildbot-nix-worker = inputs'.buildbot-nix.checks.worker;
nixosTests-hydra = pkgs.nixosTests.hydra.hydra_unstable;
};
packages = {
pages = pkgs.runCommand "pages"
{
buildInputs = [ config.devShells.mkdocs.nativeBuildInputs ];
} ''
cd ${self}
mkdocs build --strict --site-dir $out
'';
};
};
flake.darwinConfigurations =