diff --git a/flake.nix b/flake.nix index 9e8410f..5616358 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,8 @@ system: let pkgs = nixpkgs.legacyPackages.${system}; + lib = pkgs.lib; + stdenv = pkgs.stdenv; craneLib = crane.mkLib pkgs; in { @@ -26,6 +28,9 @@ jellyfin-tui = import ./packages/jellyfin-tui.nix { inherit pkgs craneLib; }; + logseq-publish-spa = import ./packages/logseq-spa.nix { + inherit pkgs lib stdenv; + }; }; templates = { elixir-devshell = { @@ -39,6 +44,11 @@ type = "app"; program = "${self.packages.${system}.jellyfin-tui}/bin/jellyfin-tui"; }; + logseq-publish-spa = { + type = "app"; + program = "${self.packages.${system}.logseq-publish-spa}/bin/logseq-publish-spa"; + }; + }; } ); diff --git a/packages/logseq-spa.nix b/packages/logseq-spa.nix new file mode 100644 index 0000000..c84488b --- /dev/null +++ b/packages/logseq-spa.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenv, + pkgs, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "logseq-spa"; + version = "0.3.1"; + + src = pkgs.fetchFromGitHub { + owner = "logseq"; + repo = "publish-spa"; + rev = "353b3654d00d6a5df2bb7b8bfef93766cdaad01c"; + hash = "sha256-rbK6lXb7ZyWPdsSze2to0h9g+XCGqyEyLlCAMqayzOQ="; + }; + nativeBuildInputs = [ + yarn + nodejs + makeWrapper + pkg-config + ]; + + buildInputs = [ + ]; + + buildPhase = '' + runHook preBuild + npm i + runHook postBuild + ''; + + # TODO build static for logseq + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp publish_spa.mjs $out/bin/logseq-publish-spa + chmod +x $out/bin/logseq-publish-spa + runHook postInstall + ''; + + meta = { + description = "Logseq single page application exporter"; + homepage = "https://github.com/logseq/publish-spa"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + }; +})