yadm: allow omitting some dependencies (#516675)

This commit is contained in:
Sandro
2026-05-26 16:17:15 +00:00
committed by GitHub
3 changed files with 51 additions and 19 deletions
+40 -17
View File
@@ -26,12 +26,26 @@
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";
strictDeps = true;
__structuredAttrs = true;
nativeBuildInputs = [ installShellFiles ];
src = fetchFromGitHub {
@@ -62,32 +76,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 +114,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;
@@ -135,7 +155,10 @@ resholve.mkDerivation (finalAttrs: {
'';
changelog = "https://github.com/yadm-dev/yadm/blob/${finalAttrs.version}/CHANGES";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ abathur ];
maintainers = with lib.maintainers; [
abathur
sandarukasa
];
platforms = lib.platforms.unix;
mainProgram = "yadm";
};
+10
View File
@@ -0,0 +1,10 @@
{
yadm,
}:
yadm.override {
withAwk = false;
withEsh = false;
withJ2 = false;
withGpg = false;
withOpenssl = false;
}
@@ -287,8 +287,7 @@ rec {
postFixup = unresholved.postResholve;
# don't break the metadata...
meta = unresholved.meta;
inherit (unresholved) meta strictDeps __structuredAttrs;
};
};
}