Skip to content

Instantly share code, notes, and snippets.

@PierreR
Last active October 29, 2019 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PierreR/bbc4a6003aa8257cc22c30df016b9162 to your computer and use it in GitHub Desktop.
Save PierreR/bbc4a6003aa8257cc22c30df016b9162 to your computer and use it in GitHub Desktop.
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.profiles.doc;
homeDir = config.home.homeDirectory;
in
{
options = {
profiles.doc = {
enable = mkEnableOption "doc";
srcPath = mkOption {
# default = homeDir + "/bootstrap/docs"; # <- why is this failing to do string context ?
default = /home/vagrant/boostrap/docs; # works
type = types.path;
};
};
};
config = mkIf cfg.enable {
home.file.".local/share/devbox".source =
let
indexFile = "${cfg.srcPath}/modules/ROOT/pages/index.adoc";
in
pkgs.runCommand "doc"
{
preferLocalBuild = true;
allowSubstitutes = false;
buildInputs = [ pkgs.asciidoctor ];
}
''
mkdir $out
cp -r ${cfg.srcPath}/modules/ROOT/assets/images $out
asciidoctor ${indexFile} -a docinfodir=${cfg.srcPath} -a imagesdir=$out/images -o $out/devbox.html
asciidoctor ${indexFile} -r asciidoctor-pdf -b pdf -a imagesdir=${cfg.srcPath}/modules/ROOT/assets/images -o $out/devbox.pdf
'';
};
}
@PierreR
Copy link
Author

PierreR commented Oct 29, 2019

I need to use ./, the root path literal:

srcPath = /. + config.home.homeDirectory + /bootstrap/docs;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment