From cb731c653dc6792742a92923a52d6cf2f8591b40 Mon Sep 17 00:00:00 2001 From: Ivan Kovnatsky <75213+ivankovnatsky@users.noreply.github.com> Date: Tue, 27 May 2025 09:54:11 +0300 Subject: [PATCH] netdata: use lm_sensors only on Linux in postFixup step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```console error: … while calling the 'derivationStrict' builtin at :37:12: 36| 37| strict = derivationStrict drvAttrs; | ^ 38| … while evaluating derivation 'darwin-system-25.05.2456ff5' whose name attribute is located at /nix/store/ci0w02z7bzdvy889jac8g45xkv3lx9i0-source/pkgs/stdenv/generic/make-derivation.nix:480:13 … while evaluating attribute 'activationScript' of derivation 'darwin-system-25.05.2456ff5' at /nix/store/xjlh0pvwqz7qbhkv7y40a508ps8r0ffv-source/modules/system/default.nix:97:7: 96| 97| activationScript = cfg.activationScripts.script.text; | ^ 98| … while evaluating the option `system.activationScripts.script.text': … while evaluating definitions from `/nix/store/xjlh0pvwqz7qbhkv7y40a508ps8r0ffv-source/modules/system/activation-scripts.nix': … while evaluating the option `system.activationScripts.applications.text': … while evaluating definitions from `/nix/store/xjlh0pvwqz7qbhkv7y40a508ps8r0ffv-source/modules/system/applications.nix': (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: Package ‘lm-sensors-3.6.0’ in /nix/store/ci0w02z7bzdvy889jac8g45xkv3lx9i0-source/pkgs/by-name/lm/lm_sensors/package.nix:97 is not available on the requested hostPlatform: hostPlatform.config = "arm64-apple-darwin" package.meta.platforms = [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "loongarch64-linux" "m68k-linux" "microblaze-linux" "microblazeel-linux" "mips-linux" "mips64-linux" "mips64el-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "s390-linux" "s390x-linux" "x86_64-linux" ] package.meta.badPlatforms = [ ] , refusing to evaluate. a) To temporarily allow packages that are unsupported for this system, you can use an environment variable for a single invocation of the nix tools. $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake, then pass `--impure` in order to allow use of environment variables. b) For `nixos-rebuild` you can set { nixpkgs.config.allowUnsupportedSystem = true; } in configuration.nix to override this. c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add { allowUnsupportedSystem = true; } to ~/.config/nixpkgs/config.nix. ``` --- pkgs/tools/system/netdata/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix index 1c298715b44a..9eaa89fb2307 100644 --- a/pkgs/tools/system/netdata/default.nix +++ b/pkgs/tools/system/netdata/default.nix @@ -239,7 +239,9 @@ stdenv.mkDerivation (finalAttrs: { wrapProgram $out/bin/netdata-claim.sh --prefix PATH : ${lib.makeBinPath [ openssl ]} wrapProgram $out/libexec/netdata/plugins.d/cgroup-network-helper.sh --prefix PATH : ${lib.makeBinPath [ bash ]} wrapProgram $out/bin/netdatacli --set NETDATA_PIPENAME /run/netdata/ipc - substituteInPlace $out/lib/netdata/conf.d/go.d/sensors.conf --replace-fail '/usr/bin/sensors' '${lm_sensors}/bin/sensors' + ${lib.optionalString (stdenv.hostPlatform.isLinux) '' + substituteInPlace $out/lib/netdata/conf.d/go.d/sensors.conf --replace-fail '/usr/bin/sensors' '${lm_sensors}/bin/sensors' + ''} # Time to cleanup the output directory. unlink $out/sbin