Skip to content

Commit

Permalink
treewide: use optionalString
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Feb 13, 2023
1 parent 7f610b4 commit cdb39a8
Show file tree
Hide file tree
Showing 118 changed files with 225 additions and 281 deletions.
2 changes: 1 addition & 1 deletion nixos/tests/predictable-interface-names.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ in pkgs.lib.listToAttrs (builtins.map ({ predictable, withNetworkd }: {
name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
+ pkgs.lib.optionalString withNetworkd "Networkd";
value = makeTest {
name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
name = "${lib.optionalString (!predictable) "un"}predictableInterfaceNames${lib.optionalString withNetworkd "-with-networkd"}";
meta = {};

nodes.machine = { lib, ... }: {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/audio/espeak/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ stdenv.mkDerivation rec {
prePatch = ''
sed -e s,/bin/ln,ln,g -i src/Makefile
sed -e 's,^CXXFLAGS=-O2,CXXFLAGS=-O2 -D PATH_ESPEAK_DATA=\\\"$(DATADIR)\\\",' -i src/Makefile
'' + (if portaudio.api_version == 19 then ''
'' + (lib.optionalString (portaudio.api_version == 19) ''
cp src/portaudio19.h src/portaudio.h
'' else "");
'');

configurePhase = ''
cd src
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/audio/musly/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ stdenv.mkDerivation {
};
nativeBuildInputs = [ cmake ];
buildInputs = [ eigen ffmpeg ];
fixupPhase = if stdenv.isDarwin then ''
fixupPhase = lib.optionalString stdenv.isDarwin ''
install_name_tool -change libmusly.dylib $out/lib/libmusly.dylib $out/bin/musly
install_name_tool -change libmusly_resample.dylib $out/lib/libmusly_resample.dylib $out/bin/musly
install_name_tool -change libmusly_resample.dylib $out/lib/libmusly_resample.dylib $out/lib/libmusly.dylib
'' else "";
'';

meta = with lib; {
homepage = "https://www.musly.org";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config wrapGAppsHook ];
buildInputs = [ lightdm gtk3 glib ];

postUnpack = if conf != "" then ''
postUnpack = lib.optionalString (conf != "") ''
cp ${builtins.toFile "config.h" conf} source/config.h
'' else "";
'';

buildPhase = ''
mkdir -p $out/bin $out/share/xgreeters
Expand Down
16 changes: 8 additions & 8 deletions pkgs/applications/editors/texmacs/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ rec {

postPatch = (if tex == null then ''
gunzip < ${fullFontsSrc} | (cd TeXmacs && tar xvf -)
'' else if extraFonts then ''
'' else lib.optionalString extraFonts ''
gunzip < ${extraFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "") +
(if chineseFonts then ''
'') +
(lib.optionalString chineseFonts ''
gunzip < ${chineseFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "") +
(if japaneseFonts then ''
'') +
(lib.optionalString japaneseFonts ''
gunzip < ${japaneseFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "") +
(if koreanFonts then ''
'') +
(lib.optionalString koreanFonts ''
gunzip < ${koreanFontsSrc} | (cd TeXmacs && tar xvf -)
'' else "");
'');


meta = {
Expand Down
6 changes: 3 additions & 3 deletions pkgs/applications/editors/vim/plugins/vim-utils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ rec {
lib.warnIf (wrapManual != null) ''
vim.customize: wrapManual is deprecated: the manual is now included by default if `name == "vim"`.
${if wrapManual == true && name != "vim" then "Set `standalone = false` to include the manual."
else if wrapManual == false && name == "vim" then "Set `standalone = true` to get the *vim wrappers only."
else ""}''
else lib.optionalString (wrapManual == false && name == "vim") "Set `standalone = true` to get the *vim wrappers only."
}''
lib.warnIf (wrapGui != null)
"vim.customize: wrapGui is deprecated: gvim is now automatically included if present"
lib.throwIfNot (vimExecutableName == null && gvimExecutableName == null)
Expand All @@ -330,7 +330,7 @@ rec {
else throw "at least one of vimrcConfig and vimrcFile must be specified";
bin = runCommand "${name}-bin" { nativeBuildInputs = [ makeWrapper ]; } ''
vimrc=${lib.escapeShellArg vimrc}
gvimrc=${if gvimrcFile != null then lib.escapeShellArg gvimrcFile else ""}
gvimrc=${lib.optionalString (gvimrcFile != null) (lib.escapeShellArg gvimrcFile)}
mkdir -p "$out/bin"
for exe in ${
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/file-managers/vifm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ in stdenv.mkDerivation rec {

wrapVifmMedia = "wrapProgram $out/share/vifm/vifm-media --prefix PATH : ${path}";
in ''
${if mediaSupport then wrapVifmMedia else ""}
${lib.optionalString mediaSupport wrapVifmMedia}
'';

meta = with lib; {
description = "A vi-like file manager${if isFullPackage then "; Includes support for optional features" else ""}";
description = "A vi-like file manager${lib.optionalString isFullPackage "; Includes support for optional features"}";
maintainers = with maintainers; [ raskin ];
platforms = if mediaSupport then platforms.linux else platforms.unix;
license = licenses.gpl2;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/blender/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ stdenv.mkDerivation rec {
'' else ''
substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"'
'') +
(if hipSupport then ''
(lib.optionalString hipSupport ''
substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${hip}/lib/libamdhip64.so"'
substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${hip}/bin"'
'' else "");
'');

cmakeFlags =
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ in writeScript "update-${pname}" ''
grep "^[0-9]" | \
sort --version-sort | \
grep -v "funnelcake" | \
grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \
grep -e "${lib.optionalString isBeta "b"}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${lib.optionalString (not isBeta) "grep -v \"b\" |"} \
tail -1`
curl --silent -o $HOME/shasums "$url$version/SHA256SUMS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ let
++ lib.optional libvaSupport libva
++ [ gtk3 ];

suffix = if channel != "stable" then "-" + channel else "";
suffix = lib.optionalString (channel != "stable") "-${channel}";

crashpadHandlerBinary = if lib.versionAtLeast version "94"
then "chrome_crashpad_handler"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/biology/plink-ng/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ stdenv.mkDerivation rec {

preBuild = ''
sed -i 's|zlib-1.2.8/zlib.h|zlib.h|g' *.c *.h
${if stdenv.cc.isClang then "sed -i 's|g++|clang++|g' Makefile.std" else ""}
${lib.optionalString stdenv.cc.isClang "sed -i 's|g++|clang++|g' Makefile.std"}
makeFlagsArray+=(
ZLIB=-lz
Expand Down
5 changes: 2 additions & 3 deletions pkgs/applications/science/electronics/kicad/base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ stdenv.mkDerivation rec {
# tagged releases don't have "unknown"
# kicad nightlies use git describe --dirty
# nix removes .git, so its approximated here
postPatch = if (!stable) then ''
postPatch = lib.optionalString (!stable) ''
substituteInPlace cmake/KiCadVersion.cmake \
--replace "unknown" "${builtins.substring 0 10 src.rev}"
''
else "";
'';

makeFlags = optionals (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/electronics/kicad/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ stdenv.mkDerivation rec {
description = (if (stable)
then "Open Source Electronics Design Automation suite"
else "Open Source EDA suite, development build")
+ (if (!with3d) then ", without 3D models" else "");
+ (lib.optionalString (!with3d) ", without 3D models");
homepage = "https://www.kicad.org/";
longDescription = ''
KiCad is an open source software suite for Electronic Design Automation.
Expand Down
12 changes: 6 additions & 6 deletions pkgs/applications/science/logic/coq/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ let
buildIde = args.buildIde or (!coqAtLeast "8.14");
ideFlags = optionalString (buildIde && !coqAtLeast "8.10")
"-lablgtkdir ${ocamlPackages.lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt";
csdpPatch = if csdp != null then ''
csdpPatch = lib.optionalString (csdp != null) ''
substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp"
substituteInPlace plugins/micromega/coq_micromega.ml --replace "System.is_in_system_path \"csdp\"" "true"
'' else "";
'';
ocamlPackages = if !isNull customOCamlPackages then customOCamlPackages
else with versions; switch coq-version [
{ case = range "8.16" "8.17"; out = ocamlPackages_4_14; }
Expand Down Expand Up @@ -158,7 +158,7 @@ self = stdenv.mkDerivation {
UNAME=$(type -tp uname)
RM=$(type -tp rm)
substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM"
${if !coqAtLeast "8.7" then "substituteInPlace configure.ml --replace \"md5 -q\" \"md5sum\"" else ""}
${lib.optionalString (!coqAtLeast "8.7") "substituteInPlace configure.ml --replace \"md5 -q\" \"md5sum\""}
${csdpPatch}
'';

Expand Down Expand Up @@ -196,7 +196,7 @@ self = stdenv.mkDerivation {
categories = [ "Development" "Science" "Math" "IDE" "GTK" ];
});

postInstall = let suffix = if coqAtLeast "8.14" then "-core" else ""; in optionalString (!coqAtLeast "8.17") ''
postInstall = let suffix = optionalString (coqAtLeast "8.14") "-core"; in optionalString (!coqAtLeast "8.17") ''
cp bin/votour $out/bin/
'' + ''
ln -s $out/lib/coq${suffix} $OCAMLFIND_DESTDIR/coq${suffix}
Expand Down Expand Up @@ -227,12 +227,12 @@ if coqAtLeast "8.17" then self.overrideAttrs(_: {
buildPhase = ''
runHook preBuild
make dunestrap
dune build -p coq-core,coq-stdlib,coq,coqide-server${if buildIde then ",coqide" else ""} -j $NIX_BUILD_CORES
dune build -p coq-core,coq-stdlib,coq,coqide-server${lib.optionalString buildIde ",coqide"} -j $NIX_BUILD_CORES
runHook postBuild
'';
installPhase = ''
runHook preInstall
dune install --prefix $out coq-core coq-stdlib coq coqide-server${if buildIde then " coqide" else ""}
dune install --prefix $out coq-core coq-stdlib coq coqide-server${lib.optionalString buildIde " coqide"}
runHook postInstall
'';
}) else self
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/sage/sage-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let
src = sage-with-env.env.lib.src;
runAllTests = files == null;
testArgs = if runAllTests then "--all" else testFileList;
patienceSpecifier = if longTests then "--long" else "";
patienceSpecifier = lib.optionalString longTests "--long";
timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}";
relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute
testFileList = lib.concatStringsSep " " (map relpathToArg files);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let
# getAttr-like helper for optional append to string:
# "Hello" + appendByAttr "a" " " {a = "world";} = "Hello world"
# "Hello" + appendByAttr "a" " " {} = "Hello"
appendByAttr = attr: sep: x: if hasAttr attr x then sep + (getAttr attr x) else "";
appendByAttr = attr: sep: x: lib.optionalString (hasAttr attr x) (sep + (getAttr attr x));

# Are there any OM dependencies at all?
ifDeps = length pkg.omdeps != 0;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/window-managers/dwl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ stdenv.mkDerivation (self: {

preBuild = ''
makeFlagsArray+=(
XWAYLAND=${if enableXWayland then "-DXWAYLAND" else ""}
XLIBS=${if enableXWayland then "xcb\\ xcb-icccm" else ""}
XWAYLAND=${lib.optionalString enableXWayland "-DXWAYLAND"}
XLIBS=${lib.optionalString enableXWayland "xcb\\ xcb-icccm"}
)
'';

Expand Down
8 changes: 4 additions & 4 deletions pkgs/build-support/alternatives/blas/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ stdenv.mkDerivation {
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension}
'' else if stdenv.hostPlatform.isDarwin then ''
'' else lib.optionalString (stdenv.hostPlatform.isDarwin) ''
install_name_tool \
-id $out/lib/libblas${canonicalExtension} \
-add_rpath ${lib.getLib blasProvider'}/lib \
$out/lib/libblas${canonicalExtension}
'' else "") + ''
'') + ''
if [ "$out/lib/libblas${canonicalExtension}" != "$out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then
ln -s $out/lib/libblas${canonicalExtension} "$out/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}"
Expand All @@ -115,12 +115,12 @@ EOF
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension}
'' else if stdenv.hostPlatform.isDarwin then ''
'' else lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool \
-id $out/lib/libcblas${canonicalExtension} \
-add_rpath ${lib.getLib blasProvider'}/lib \
$out/lib/libcblas${canonicalExtension}
'' else "") + ''
'') + ''
if [ "$out/lib/libcblas${canonicalExtension}" != "$out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then
ln -s $out/lib/libcblas${canonicalExtension} "$out/lib/libcblas${stdenv.hostPlatform.extensions.sharedLibrary}"
fi
Expand Down
8 changes: 4 additions & 4 deletions pkgs/build-support/alternatives/lapack/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ stdenv.mkDerivation {
cp -L "$liblapack" $out/lib/liblapack${canonicalExtension}
chmod +w $out/lib/liblapack${canonicalExtension}
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
'' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") ''
patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension}
'' else "") + ''
'') + ''
if [ "$out/lib/liblapack${canonicalExtension}" != "$out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" ]; then
ln -s $out/lib/liblapack${canonicalExtension} "$out/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}"
Expand All @@ -83,10 +83,10 @@ EOF
cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension}
chmod +w $out/lib/liblapacke${canonicalExtension}
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
'' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") ''
patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension}
'' else "") + ''
'') + ''
if [ -f "$out/lib/liblapacke.so.3" ]; then
ln -s $out/lib/liblapacke.so.3 $out/lib/liblapacke.so
Expand Down
5 changes: 2 additions & 3 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ let
else "";

expand-response-params =
if buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null"
then import ../expand-response-params { inherit (buildPackages) stdenv; }
else "";
lib.optionalString (buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null")
(import ../expand-response-params { inherit (buildPackages) stdenv; });

in

Expand Down
6 changes: 3 additions & 3 deletions pkgs/build-support/build-bazel-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ stdenv.mkDerivation (fBuildAttrs // {
# Remove all built in external workspaces, Bazel will recreate them when building
rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker}
${if removeRulesCC then "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}" else ""}
${lib.optionalString removeRulesCC "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}"}
rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker}
${if removeLocalConfigCc then "rm -rf $bazelOut/external/{local_config_cc,\\@local_config_cc.marker}" else ""}
${if removeLocal then "rm -rf $bazelOut/external/{local_*,\\@local_*.marker}" else ""}
${lib.optionalString removeLocalConfigCc "rm -rf $bazelOut/external/{local_config_cc,\\@local_config_cc.marker}"}
${lib.optionalString removeLocal "rm -rf $bazelOut/external/{local_*,\\@local_*.marker}"}
# Clear markers
find $bazelOut/external -name '@*\.marker' -exec sh -c 'echo > {}' \;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ in stdenv.mkDerivation {
cd $out
${extraBuildCommands}
cd $out
${if isMultiBuild then extraBuildCommandsMulti else ""}
${lib.optionalString isMultiBuild extraBuildCommandsMulti}
'';
preferLocalBuild = true;
allowSubstitutes = false;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/build-fhs-userenv/env.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, buildEnv, writeText, pkgs, pkgsi686Linux }:
{ stdenv, lib, buildEnv, writeText, pkgs, pkgsi686Linux }:

{ name
, profile ? ""
Expand Down Expand Up @@ -237,7 +237,7 @@ in stdenv.mkDerivation {
cd $out
${extraBuildCommands}
cd $out
${if isMultiBuild then extraBuildCommandsMulti else ""}
${lib.optionalString isMultiBuild extraBuildCommandsMulti}
'';
preferLocalBuild = true;
allowSubstitutes = false;
Expand Down
4 changes: 1 addition & 3 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ let
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;

expand-response-params =
if (buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null"
then import ../expand-response-params { inherit (buildPackages) stdenv; }
else "";
lib.optionalString ((buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null") (import ../expand-response-params { inherit (buildPackages) stdenv; });

useGccForLibs = isClang
&& libcxx == null
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/fetchdocker/credentials.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ let
({prefix, path}: "DOCKER_CREDENTIALS" == prefix)
builtins.nixPath);
in
if (pathParts != []) then (builtins.head pathParts).path else ""
lib.optionalString (pathParts != []) ((builtins.head pathParts).path)
4 changes: 2 additions & 2 deletions pkgs/build-support/fetchfossil/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{stdenv, fossil, cacert}:
{stdenv, lib, fossil, cacert}:

{name ? null, url, rev, sha256}:

stdenv.mkDerivation {
name = "fossil-archive" + (if name != null then "-${name}" else "");
name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
builder = ./builder.sh;
nativeBuildInputs = [fossil cacert];

Expand Down
4 changes: 1 addition & 3 deletions pkgs/build-support/fetchgit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

short = builtins.substring 0 7 rev;

appendShort = if (builtins.match "[a-f0-9]*" rev) != null
then "-${short}"
else "";
appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${short}";
in "${if matched == null then base else builtins.head matched}${appendShort}";
in
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone
Expand Down
Loading

0 comments on commit cdb39a8

Please sign in to comment.