Merge pull request #258434 from SuperSandro2000/locate-dbfile

nixos/locate: #258575 followup
This commit is contained in:
K900 2023-10-03 08:58:20 +03:00 committed by GitHub
commit 9d2e9d8ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

View file

@ -6,7 +6,7 @@ let
cfg = config.services.locate; cfg = config.services.locate;
isMLocate = hasPrefix "mlocate" cfg.locate.name; isMLocate = hasPrefix "mlocate" cfg.locate.name;
isPLocate = hasPrefix "plocate" cfg.locate.name; isPLocate = hasPrefix "plocate" cfg.locate.name;
isMorPLocate = (isMLocate || isPLocate); isMorPLocate = isMLocate || isPLocate;
isFindutils = hasPrefix "findutils" cfg.locate.name; isFindutils = hasPrefix "findutils" cfg.locate.name;
in in
{ {
@ -216,18 +216,18 @@ in
setgid = true; setgid = true;
setuid = false; setuid = false;
}; };
mlocate = (mkIf isMLocate { mlocate = mkIf isMLocate {
group = "mlocate"; group = "mlocate";
source = "${cfg.locate}/bin/locate"; source = "${cfg.locate}/bin/locate";
}); };
plocate = (mkIf isPLocate { plocate = mkIf isPLocate {
group = "plocate"; group = "plocate";
source = "${cfg.locate}/bin/plocate"; source = "${cfg.locate}/bin/plocate";
}); };
in in
mkIf isMorPLocate { mkIf isMorPLocate {
locate = mkMerge [ common mlocate plocate ]; locate = mkMerge [ common mlocate plocate ];
plocate = (mkIf isPLocate (mkMerge [ common plocate ])); plocate = mkIf isPLocate (mkMerge [ common plocate ]);
}; };
environment.systemPackages = [ cfg.locate ]; environment.systemPackages = [ cfg.locate ];

View file

@ -5,10 +5,14 @@ stdenv.mkDerivation rec {
version = "0.26"; version = "0.26";
src = fetchurl { src = fetchurl {
url = "https://releases.pagure.org/mlocate/${pname}-${version}.tar.xz"; url = "https://releases.pagure.org/mlocate/mlocate-${version}.tar.xz";
sha256 = "0gi6y52gkakhhlnzy0p6izc36nqhyfx5830qirhvk3qrzrwxyqrh"; sha256 = "0gi6y52gkakhhlnzy0p6izc36nqhyfx5830qirhvk3qrzrwxyqrh";
}; };
makeFlags = [
"dbfile=/var/cache/locatedb"
];
meta = with lib; { meta = with lib; {
description = "Merging locate is an utility to index and quickly search for files"; description = "Merging locate is an utility to index and quickly search for files";
homepage = "https://pagure.io/mlocate"; homepage = "https://pagure.io/mlocate";

View file

@ -29,6 +29,8 @@ stdenv.mkDerivation rec {
mesonFlags = [ mesonFlags = [
"-Dsystemunitdir=${placeholder "out"}/etc/systemd/system" "-Dsystemunitdir=${placeholder "out"}/etc/systemd/system"
"-Dsharedstatedir=/var/cache"
"-Ddbpath=locatedb"
]; ];
meta = with lib; { meta = with lib; {