From 8bda2c3acce520c835e471b81912174402f7d554 Mon Sep 17 00:00:00 2001 From: Peng Guanwen Date: Sun, 15 Jan 2023 16:09:30 +0800 Subject: [PATCH 1/2] nix-info: fix error when no channel installed The nix-info script fails when user only use flake. This patch use the new nix CLI when old fails. --- pkgs/tools/nix/info/info.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/nix/info/info.sh b/pkgs/tools/nix/info/info.sh index c309e8be1649..64afac8f7553 100755 --- a/pkgs/tools/nix/info/info.sh +++ b/pkgs/tools/nix/info/info.sh @@ -69,8 +69,14 @@ nixev() { nix-instantiate --eval --strict -E "$1" } +# use `nix eval` command +nixev2() { + nix eval --raw "$1" +} + desc_system() { - nixev '(import {}).stdenv.hostPlatform.system' + nixev '(import {}).stdenv.hostPlatform.system' 2>/dev/null || + nixev2 'nixpkgs#stdenv.hostPlatform.system' } desc_host_os() { @@ -98,7 +104,7 @@ desc_multi_user() { } desc_nixpkgs_path() { - nixev '' + nixev '' 2>/dev/null || echo "not found" } channel_facts() { From ffe90311294ae0867e1fd64ee30bcf726d1a53f8 Mon Sep 17 00:00:00 2001 From: Peng Guanwen Date: Tue, 31 Jan 2023 17:56:23 +0800 Subject: [PATCH 2/2] Use buitins.currentSystem --- pkgs/tools/nix/info/info.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkgs/tools/nix/info/info.sh b/pkgs/tools/nix/info/info.sh index 64afac8f7553..6ec827350469 100755 --- a/pkgs/tools/nix/info/info.sh +++ b/pkgs/tools/nix/info/info.sh @@ -69,14 +69,8 @@ nixev() { nix-instantiate --eval --strict -E "$1" } -# use `nix eval` command -nixev2() { - nix eval --raw "$1" -} - desc_system() { - nixev '(import {}).stdenv.hostPlatform.system' 2>/dev/null || - nixev2 'nixpkgs#stdenv.hostPlatform.system' + nixev 'builtins.currentSystem' } desc_host_os() {