From 70d0e2456857dc10dd7d2654277fc1dd8d8cc216 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Fri, 1 Apr 2022 19:50:06 +0800 Subject: [PATCH] nixos/logrotate: use packages from buildPackages in configuration checkPhase, fixing cross compilation --- nixos/modules/services/logging/logrotate.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix index 332a2a597edc..e6eb0552c9e9 100644 --- a/nixos/modules/services/logging/logrotate.nix +++ b/nixos/modules/services/logging/logrotate.nix @@ -162,8 +162,8 @@ let # file exist, but we only have sandboxed users here so brown these # out. according to man page that means su, create and createolddir. # files required to exist also won't be present, so missingok is forced. - user=$(${pkgs.coreutils}/bin/id -un) - group=$(${pkgs.coreutils}/bin/id -gn) + user=$(${pkgs.buildPackages.coreutils}/bin/id -un) + group=$(${pkgs.buildPackages.coreutils}/bin/id -gn) sed -e "s/\bsu\s.*/su $user $group/" \ -e "s/\b\(create\s\+[0-9]*\s*\|createolddir\s\+[0-9]*\s\+\).*/\1$user $group/" \ -e "1imissingok" -e "s/\bnomissingok\b//" \ @@ -173,7 +173,7 @@ let # 'error:' at common log level, so we can use grep, taking care # to keep error codes set -o pipefail - if ! ${pkgs.logrotate}/sbin/logrotate --debug /tmp/logrotate.conf 2>&1 \ + if ! ${pkgs.buildPackages.logrotate}/sbin/logrotate --debug /tmp/logrotate.conf 2>&1 \ | ( ! grep "error:" ) > /tmp/logrotate-error; then echo "Logrotate configuration check failed." echo "The failing configuration (after adjustments to pass tests in sandbox) was:"