Nix-Configs/modules/parallel.nix

31 lines
941 B
Nix

{pkgs, lib, config, writeTextDir, ...}: with lib; {
options.programs.parallel = {
enable = mkEnableOption "parallel";
package = mkPackageOption pkgs "parallel" { };
willCite = mkOption {
default = false;
defaultText = literalExpression "false";
example = literalExpression "true";
description = "Indicate that you will cite parallel if you use it in an academic paper";
type = types.bool;
};
};
config = mkIf config.programs.parallel.enable {
home.packages = [
(
pkgs.symlinkJoin {
name = "parallel";
paths = [ config.programs.parallel.package ];
buildInputs = [ pkgs.makeWrapper ];
parallelHome = if config.programs.parallel.willCite
then pkgs.writeTextDir "will-cite" ""
else pkgs.runCommand "parallel-home-nocite" {} "mkdir $out";
postBuild = ''
wrapProgram $out/bin/parallel \
--set-default PARALLEL_HOME $parallelHome
'';
}
)
];
};
}