summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix35
1 files changed, 34 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 7c9f2e9..d88cbe6 100644
--- a/flake.nix
+++ b/flake.nix
@@ -6,13 +6,46 @@
   let
     system = "x86_64-linux";
     pkgs = import nixpkgs { inherit system; overlays = [ nur.overlay ]; };
+
+    kronika = pkgs.fetchFromGitHub {
+      repo = "kronika";
+      owner = "19pdh";
+      rev = "master";
+      sha256 = "1pafahvq8xhpba2hgpipkbnhjr3j9zchnxfq4pnxqvidwz5rqr51";
+    };
+
+    md2saait = pkgs.stdenv.mkDerivation {
+      name = "md2saait";
+      src = ./md2saait;
+      installPhase = ''
+        mkdir -p $out/bin
+        cp ./* $out/bin
+        sed -i 's:yq:${pkgs.yq}/bin/yq:g' $out/bin/frontmatter2cfg
+      '';
+    };
+
   in {
     defaultPackage.${system} = self.packages.${system}.low-puszcza;
 
     packages.${system}.low-puszcza = pkgs.stdenv.mkDerivation {
       name = "low-puszcza";
       src = self;
-      nativeBuildInputs = [ pkgs.zip pkgs.nur.repos.pn.saait ];
+      nativeBuildInputs = with pkgs; [
+        md2saait
+        zip
+        pandoc
+        nur.repos.pn.saait
+      ];
+
+      buildPhase = ''
+        cp ${kronika}/wpisy wpisy -r
+        for f in `find wpisy -name *.md`; do
+          name=$(basename $f .md)
+          date=$(getdate $f)
+          frontmatter2cfg $f > pages/$date_$name.cfg
+          pandoc $f > pages/$date_$name.html
+        make
+      '';
 
       installPhase = ''
         cp -r output $out