From 06211e700b2b45cf5ea20b9d032322fade3da7d9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 5 Jan 2017 20:16:48 +0100 Subject: [PATCH] locate: build in correct dbpath --- nixos/modules/misc/locate.nix | 6 ++++++ nixos/modules/programs/environment.nix | 3 +-- pkgs/tools/misc/mlocate/default.nix | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix index e7fc25fc2078..a9c84f6db243 100644 --- a/nixos/modules/misc/locate.nix +++ b/nixos/modules/misc/locate.nix @@ -113,8 +113,14 @@ in { } ]; + nixpkgs.config = { locate.dbfile = cfg.output; }; + environment.systemPackages = [ cfg.locate ]; + environment.variables = mkIf (!isMLocate) + { LOCATE_PATH = cfg.output; + }; + warnings = optional (isMLocate && cfg.localuser != null) "mlocate does not support searching as user other than root" ++ optional (isFindutils && cfg.pruneNames != []) "findutils locate does not support pruning by directory component" ++ optional (isFindutils && cfg.pruneBindMounts) "findutils locate does not support skipping bind mounts"; diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix index a35b5cc9513e..a1615c920c02 100644 --- a/nixos/modules/programs/environment.nix +++ b/nixos/modules/programs/environment.nix @@ -17,8 +17,7 @@ in config = { environment.variables = - { LOCATE_PATH = "/var/cache/locatedb"; - NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix"; + { NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix"; PAGER = mkDefault "less -R"; EDITOR = mkDefault "nano"; }; diff --git a/pkgs/tools/misc/mlocate/default.nix b/pkgs/tools/misc/mlocate/default.nix index 6dbd0bcc439a..4aef6114c57c 100644 --- a/pkgs/tools/misc/mlocate/default.nix +++ b/pkgs/tools/misc/mlocate/default.nix @@ -1,6 +1,8 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, config }: -stdenv.mkDerivation rec { +let + dbfile = stdenv.lib.attrByPath [ "locate" "dbfile" ] "/var/cache/locatedb" config; +in stdenv.mkDerivation rec { name = "mlocate-${version}"; version = "0.26"; @@ -10,6 +12,7 @@ stdenv.mkDerivation rec { }; buildInputs = [ ]; + makeFlags = [ "dbfile=${dbfile}" ]; meta = with stdenv.lib; { description = "Merging locate is an utility to index and quickly search for files";