~misterio/misterio.me

ba77298c8737d7eae0b0894353d5e591e060f37c — Gabriel Fontes a month ago b8371e7
go back to old way of running through flake
1 files changed, 21 insertions(+), 19 deletions(-)

M flake.nix
M flake.nix => flake.nix +21 -19
@@ 24,38 24,40 @@
        default = misterio-me;
      };

      # Serve website
      apps = rec {
        serve = {
          type = "app";
          program = "${pkgs.writeShellScriptBin "serve" ''
            echo "Serving on: http://localhost:8080 and gemini://localhost:1965"
            ${pkgs.webfs}/bin/webfsd -f index.html -d -F -p 4000 -r ${packages.default}/public & \
            ${pkgs.agate}/bin/agate --content ${packages.default}/public --hostname localhost --certs /tmp/agate-certs & \

            jobs=$(jobs -p)
            trap 'kill $jobs' EXIT
            wait
          ''}/bin/serve";
        };
        default = serve;
      };

      devShells.default = pkgs.mkShell {
        inputsFrom = [ packages.misterio-me ];
        buildInputs = with pkgs; [ yq openring ];
        shellHook = ''
          cleanup() {
            rm _main/_includes/scheme-datalist.html 2> /dev/null
            rm _main/{assets,_sass}/themes/* 2> /dev/null
            rm -r _site 2> /dev/null

          }

          while [ ! -f flake.nix ]; do
            echo "Looking for flake.nix, going one directory up"
            cd ..
          done

          cleanup
          rm _main/_includes/scheme-datalist.html 2> /dev/null
          rm _main/{assets,_sass}/themes/* 2> /dev/null
          rm -r _site 2> /dev/null

          mkdir _main/{assets,_sass}/themes -p
          ln -s ${packages.css-themes}/list.html -T _main/_includes/scheme-datalist.html
          ln -s ${packages.css-themes}/partials/*.scss -t _main/_sass/themes/
          ln -s ${packages.css-themes}/themes/*.scss -t _main/assets/themes/

          jekyll build &> /dev/null
          jekyll serve --port 8080 --watch --incremental --trace & \
          ${pkgs.agate}/bin/agate --content _site --hostname localhost --certs /tmp/agate-certs & \

          jobs=$(jobs -p)
          trap 'kill $jobs && cleanup' EXIT
          wait

          cleanup
          exit
        '';
      };
    }