Make it so that parallel doesn't create .parallel

This commit is contained in:
Emi Simpson 2023-03-15 21:17:38 -04:00
parent d9214d4379
commit 4a2201069c
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
2 changed files with 36 additions and 1 deletions

View File

@ -1,4 +1,5 @@
{pkgs, lib, ...}: {
imports = [ ../modules/parallel.nix ];
home.sessionVariables = {
NNN_FIFO = "/tmp/nnn.fifo";
LANG = "en_US.UTF-8";
@ -14,7 +15,6 @@
git-annex
git-annex-remote-rclone
qrencode
parallel
libwebp
bat
] ++ (import ../system/home-manager.nix).extraPackages pkgs;
@ -101,6 +101,10 @@
shell = "${pkgs.fish}/bin/fish";
shortcut = "Space";
};
programs.parallel = {
enable = true;
willCite = true;
};
programs.ssh = import programs/ssh/settings.nix;
home.file.allowedKeys = {

31
modules/parallel.nix Normal file
View File

@ -0,0 +1,31 @@
{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
'';
}
)
];
};
}