diff --git a/.gitignore b/.gitignore index d141508..5426bf4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ dist /docs res/test/docs/slides/revealjs +res/test/result diff --git a/flake.nix b/flake.nix index c2ec3d6..50d2aad 100644 --- a/flake.nix +++ b/flake.nix @@ -4,17 +4,42 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; systems.url = "github:nix-systems/default"; + naersk.url = "github:nix-community/naersk"; }; outputs = - { nixpkgs, systems, ... }: + { + nixpkgs, + systems, + naersk, + ... + }: let eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); + build_asciidoctor_revealjs = pkgs: pkgs.buildRubyGem { + gemName = "asciidoctor-revealjs"; + version = "5.2.0"; + source = { + type = "git"; + url = "https://rubygems.org/downloads/asciidoctor-revealjs-5.2.0.gem"; + sha256 = "sha256-NQSl5+ryyR3jf5YYkxT/sea/lNrZ1kbVyaJMZpG/auI="; + }; + }; + + build_asciidoctor = pkgs: pkgs.buildRubyGem { + gemName = "asciidoctor"; + version = "2.0.25"; + source = { + type = "git"; + url = "https://rubygems.org/downloads/asciidoctor-2.0.25.gem"; + sha256 = "sha256-sG/oIrCRDU4l6g9WL+z8eUjpRuIi79lJSEnSfaQmfRk="; + }; + }; in { devShells = eachSystem (pkgs: { default = pkgs.mkShell { - name = "asist"; + name = "docki"; buildInputs = with pkgs; [ gcc openssl.dev @@ -24,12 +49,45 @@ cargo (ruby.withPackages ( p: with p; [ - asciidoctor + (build_asciidoctor_revealjs pkgs) + (build_asciidoctor pkgs) bundler ] )) ]; }; }); + + packages = eachSystem ( + pkgs: + let + naerskLib = pkgs.callPackage naersk { }; + runtimeDeps = with pkgs; [ + (ruby.withPackages ( + p: with p; [ + (build_asciidoctor_revealjs pkgs) + (build_asciidoctor pkgs) + bundler + ] + )) + ]; + in + { + default = naerskLib.buildPackage { + src = ./.; + buildInputs =[ + ]; + nativeBuildInputs = with pkgs; [ + pkg-config + openssl.dev + libiconv + makeWrapper + ]; + postInstall = '' + wrapProgram $out/bin/docki --prefix PATH : ${pkgs.lib.makeBinPath runtimeDeps} + ''; + }; + } + ); }; } diff --git a/src/app/build/asciidoctor.rs b/src/app/build/asciidoctor.rs index f3a17c5..8df079a 100644 --- a/src/app/build/asciidoctor.rs +++ b/src/app/build/asciidoctor.rs @@ -32,7 +32,7 @@ fn asciidoctor_docs(in_path: &str, out_path: &str) -> process::Command { fn asciidoctor_slides(in_path: &str, out_path: &str) -> process::Command { let mut command = process::Command::new(format!("asciidoctor-revealjs")); let out_dir = parent_path(out_path); - let revealjs_path = path_between(out_dir.to_string(), "./dist/slides/revealjs".to_string()); + let revealjs_path = "/slides/revealjs"; command .arg(format!("{in_path}"))