yadm: allow omitting some dependencies

This commit is contained in:
SandaruKasa
2026-05-16 18:45:42 +03:00
parent 12d73fb387
commit ddeae20607
+33 -16
View File
@@ -26,8 +26,19 @@
installShellFiles,
runCommand,
yadm,
}:
# Templates:
withAwk ? true,
withEsh ? true,
withJ2 ? true,
# Encryption:
withGpg ? true,
withOpenssl ? true,
}:
let
withTar = withGpg || withOpenssl;
in
resholve.mkDerivation (finalAttrs: {
pname = "yadm";
version = "3.5.0";
@@ -62,32 +73,32 @@ resholve.mkDerivation (finalAttrs: {
scripts = [ "bin/yadm" ];
interpreter = "${bash}/bin/sh";
inputs = [
bash
coreutils
git
gnupg
openssl
gawk
# see head comment
# git-crypt
# transcrypt
j2cli
esh
bash
coreutils
gnutar
];
]
++ lib.optional withGpg gnupg
++ lib.optional withOpenssl openssl
++ lib.optional withAwk gawk
++ lib.optional withJ2 j2cli
++ lib.optional withEsh esh
++ lib.optional withTar gnutar;
fake = {
external = if stdenv.hostPlatform.isCygwin then [ ] else [ "cygpath" ];
external = lib.optional (!stdenv.hostPlatform.isCygwin) "cygpath" ++ lib.optional (!withTar) "tar";
};
fix = {
"$GPG_PROGRAM" = [ "gpg" ];
"$OPENSSL_PROGRAM" = [ "openssl" ];
"$GIT_PROGRAM" = [ "git" ];
"$AWK_PROGRAM" = [ "awk" ];
"$GPG_PROGRAM" = lib.optional withGpg "gpg";
"$OPENSSL_PROGRAM" = lib.optional withOpenssl "openssl";
"$AWK_PROGRAM" = lib.optional withAwk "awk";
# see head comment
# "$GIT_CRYPT_PROGRAM" = [ "git-crypt" ];
# "$TRANSCRYPT_PROGRAM" = [ "transcrypt" ];
"$J2CLI_PROGRAM" = [ "j2" ];
"$ESH_PROGRAM" = [ "esh" ];
"$J2CLI_PROGRAM" = lib.optional withJ2 "j2";
"$ESH_PROGRAM" = lib.optional withEsh "esh";
# not in nixpkgs (yet)
# "$ENVTPL_PROGRAM" = [ "envtpl" ];
# "$LSB_RELEASE_PROGRAM" = [ "lsb_release" ];
@@ -100,6 +111,12 @@ resholve.mkDerivation (finalAttrs: {
"$hook_command" = true; # ~git hooks?
"exec" = [ "$YADM_BOOTSTRAP" ]; # yadm bootstrap script
"$GPG_PROGRAM" = !withGpg;
"$OPENSSL_PROGRAM" = !withOpenssl;
"$AWK_PROGRAM" = !withAwk;
"$J2CLI_PROGRAM" = !withJ2;
"$ESH_PROGRAM" = !withEsh;
# not in nixpkgs
"$ENVTPL_PROGRAM" = true;
"$LSB_RELEASE_PROGRAM" = true;