gitea: fix passthru.data-compressed

Fixes two bugs:
- pass a forgotten `{}` to `compressDrv`.
- remove incorrect usage of `lndir` in `compressDrv`. I added a brief
  comment on why, see [this comment][1] for more details.

Tested with:

```
$ nix build .#legacyPackages.x86_64-linux.gitea.passthru.data-compressed
$ ls -lh result/public/assets/licenses.txt*
lrwxrwxrwx 1 root root  90 Jan  1  1970 result/public/assets/licenses.txt -> /nix/store/p21irsr57hckd3x3ym18aa0cr9zmm3an-gitea-1.22.1-data/./public/assets/licenses.txt
-r--r--r-- 1 root root 30K Jan  1  1970 result/public/assets/licenses.txt.br
-r--r--r-- 1 root root 82K Jan  1  1970 result/public/assets/licenses.txt.gz
```

[1]: https://github.com/NixOS/nixpkgs/pull/332752#discussion_r1721043286
This commit is contained in:
Motiejus Jakštys 2024-08-18 22:40:18 +03:00
parent b2fbbdb466
commit 1bd350449a
2 changed files with 7 additions and 7 deletions

View File

@ -1,8 +1,4 @@
{
lib,
xorg,
runCommand,
}:
{ lib, runCommand }:
/**
Compresses files of a given derivation, and returns a new derivation with
compressed files
@ -72,7 +68,11 @@ let
in
runCommand "${drv.name}-compressed" { } ''
mkdir $out
(cd $out; ${xorg.lndir}/bin/lndir ${drv})
# cannot use lndir here, because it also symlinks directories,
# which we do not need; we only need to symlink files.
(cd ${drv}; find -L -type d -exec mkdir -p $out/{} ';')
(cd ${drv}; find -L -type f -exec ln -s ${drv}/{} $out/{} ';')
${lib.concatStringsSep "\n\n" (lib.mapAttrsToList mkCmd compressors)}
''

View File

@ -88,7 +88,7 @@ in buildGoModule rec {
'';
passthru = {
data-compressed = lib.warn "gitea.passthru.data-compressed is deprecated. Use \"compressDrvWeb gitea.data\"." (compressDrvWeb gitea.data);
data-compressed = lib.warn "gitea.passthru.data-compressed is deprecated. Use \"compressDrvWeb gitea.data\"." (compressDrvWeb gitea.data {});
tests = nixosTests.gitea;
};