From 22571931595983b46f987bd1b6b25029f82cd4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 9 Jul 2024 07:51:29 +0300 Subject: [PATCH] rm xorg --- pkgs/compress-drv/default.nix | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/pkgs/compress-drv/default.nix b/pkgs/compress-drv/default.nix index 2925fe9..6a3baf3 100644 --- a/pkgs/compress-drv/default.nix +++ b/pkgs/compress-drv/default.nix @@ -38,8 +38,6 @@ Inputs: { lib, runCommand, - parallel, - xorg, }: drv: { formats, compressors, @@ -52,29 +50,22 @@ Inputs: (matches == 1) "compressor-${ext} needs to have exactly one '{}', found ${builtins.toString matches}"; compressorMap = lib.filterAttrs (k: _: (lib.hasPrefix "compressor-" k)) args; - mkCmd = ext: prog: let - cmdline = builtins.replaceStrings ["{}"] ["\"$fname\""] prog; - in - assert validProg ext prog; "${parallel}/bin/sem --id $$ -P$NIX_BUILD_CORES ${cmdline}"; + mkCmd = ext: prog: + assert validProg ext prog; '' + find -L $out -type f -regextype posix-extended -iregex '.*\.(${formatsPipe})' -print0 \ + | xargs -0 -P$NIX_BUILD_CORES -I{} ${prog} + ''; formatsPipe = builtins.concatStringsSep "|" formats; in runCommand "${drv.name}-compressed" {} '' mkdir $out + (cd ${drv}; find -L -type d -exec mkdir -p $out/{} ';') + (cd ${drv}; find -L -type f -exec ln -s ${drv}/{} $out/{} ';') - export PARALLEL_HOME=$(mktemp -d) - # Displaying the citation notice once per run of compressDrv is fair game - echo will cite | ${parallel}/bin/parallel --citation - - ${xorg.lndir}/bin/lndir ${drv}/ $out/ - - while IFS= read -d "" -r fname; do - ${ + ${ lib.concatMapStringsSep - "\n" + "\n\n" (ext: mkCmd ext (builtins.getAttr "compressor-${ext}" compressorMap)) compressors } - done < <(find -L $out -print0 -type f -regextype posix-extended -iregex '.*\.(${formatsPipe})') - - ${parallel}/bin/sem --id ''$$ --wait ''