Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Install man pages when building from flake
Merged did:key:z6Mkgfwr...BYQp opened 2 years ago
1 file changed +29 -2 e52ce483 fb13e5f9
modified flake.nix
@@ -54,6 +54,12 @@
        # Allow md files for testing purposes
        (lib.hasSuffix "\.md" path)
        ||
+
        # Allow adoc files
+
        (lib.hasSuffix "\.adoc" path)
+
        ||
+
        # Allow man page build script
+
        (lib.hasSuffix "build-man-pages\.sh" path)
+
        ||
        # Default filter from crane (allow .rs files)
        (craneLib.filterCargoSources path type);

@@ -84,6 +90,20 @@
      cargoArtifacts =
        craneLib.buildDepsOnly commonArgs;

+
      # Build the listed .adoc files as man pages to the package.
+
      buildManPages = pages: {
+
        nativeBuildInputs = [ pkgs.asciidoctor ];
+
        postInstall = ''
+
          for f in ${lib.escapeShellArgs pages} ; do
+
            cat=''${f%.adoc}
+
            cat=''${cat##*.}
+
            [ -d "$out/share/man/man$cat" ] || mkdir -p "$out/share/man/man$cat"
+
            scripts/build-man-pages.sh "$out/share/man/man$cat" $f
+
          done
+
        '';
+
        outputs = [ "out" "man" ];
+
      };
+

      # Build the actual crate itself, reusing the dependency
      # artifacts from above.
      radicle = craneLib.buildPackage (commonArgs
@@ -91,7 +111,12 @@
          inherit (craneLib.crateNameFromCargoToml {cargoToml = ./radicle/Cargo.toml;});
          doCheck = false;
          inherit cargoArtifacts;
-
        });
+
        } // (buildManPages [
+
          "git-remote-rad.1.adoc"
+
          "rad.1.adoc"
+
          "radicle-node.1.adoc"
+
          "rad-patch.1.adoc"
+
        ]));
    in {
      # Formatter
      formatter = pkgs.alejandra;
@@ -185,7 +210,9 @@
            inherit cargoArtifacts;
            cargoBuildCommand = "cargo build --release -p radicle-httpd";
            doCheck = false;
-
          });
+
          } // (buildManPages [
+
            "radicle-httpd.1.adoc"
+
          ]));
      };

      apps.default = flake-utils.lib.mkApp {