From 9c1545b0ab0694b1cde8e651c69afc833f53a67b Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Mon, 28 Aug 2023 14:21:56 +1000
Subject: [PATCH] refactor mkdocs

- use devshell instead of package

- build pages with hercules-ci.github-pages

- drop unnecessary packages restriction
---
 dev/shell.nix | 5 +++++
 flake.nix     | 7 ++-----
 tasks.py      | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dev/shell.nix b/dev/shell.nix
index 2efa02b..a67e769 100644
--- a/dev/shell.nix
+++ b/dev/shell.nix
@@ -11,5 +11,10 @@
         ssh-to-age
       ];
     };
+    mkdocs = with pkgs; mkShellNoCC {
+      packages = [
+        python3.pkgs.mkdocs-material
+      ];
+    };
   };
 }
diff --git a/flake.nix b/flake.nix
index 096966a..a434dbc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -55,7 +55,6 @@
           ciSystems = [ "x86_64-linux" "aarch64-linux" ];
           onPush.default.outputs = {
             checks = lib.mkForce self.outputs.checks.x86_64-linux;
-            packages = lib.mkForce self.outputs.packages.x86_64-linux;
           };
         };
 
@@ -87,15 +86,13 @@
             nixosTests-pict-rs = pkgs.nixosTests.pict-rs;
           };
 
-          packages.pages = pkgs.runCommand "pages"
+          hercules-ci.github-pages.settings.contents = pkgs.runCommand "pages"
             {
-              buildInputs = [ pkgs.python3.pkgs.mkdocs-material ];
+              buildInputs = [ config.devShells.mkdocs.nativeBuildInputs ];
             } ''
             cd ${self}
             mkdocs build --strict --site-dir $out
           '';
-
-          hercules-ci.github-pages.settings.contents = config.packages.pages;
         };
 
         flake.darwinConfigurations =
diff --git a/tasks.py b/tasks.py
index 83499fd..8966183 100644
--- a/tasks.py
+++ b/tasks.py
@@ -117,7 +117,7 @@ def mkdocs(c):
     """
     Serve docs (mkdoc serve)
     """
-    c.run("nix develop .#pages -c mkdocs serve")
+    c.run("nix develop .#mkdocs -c mkdocs serve")
 
 
 def get_hosts(hosts: str) -> List[DeployHost]: