NIX_PATHの一部のディレクトリが存在しないため、NixOSの再構築は失敗します。

NIX_PATHの一部のディレクトリが存在しないため、NixOSの再構築は失敗します。

NixOSを再構築しようとしたときに基盤になることができず、失敗しましたNIX_PATHnixos-unstableチャンネルの切り替えを試みたとき23.11に誤ってチャンネルを追加してnixpkgs-unstable削除したため、これが起こりました。チャンネルを再追加してもエラーは変わりませんでした。

ここに問題がありますか?

ディレクトリには/nix/var/nix/profiles/per-user/root/channels1つのファイルしか含まれておらず、ディレクトリを含むより多くのファイルを含むmanifest.nix兄弟ディレクトリがあります。channel-2-linkchannels-1-linknixos

NIX_PATH、私のチャンネルと完全なバグレポートはここにあります。

~> $env.NIX_PATH
nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

~> sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable

~> sudo nixos-rebuild switch --upgrade
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error:
       … <borked>

         at «none»:0: (source not available)

       … while calling the 'import' builtin

         at «string»:1:6:

            1| with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild
             |      ^

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs/nixos/modules/installer/tools/nix-fallback-paths.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
/tmp/nixos-rebuild.TFvl5H/nix
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building the system configuration...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

ベストアンサー1

まだ正確に何が間違っているのかわかりませんが、次のように読みました。手動nix-channelこれを実行して、sudo nix-channel --rollbackNix チャンネルを以前の正しい状態に戻すことができます。これは私の問題を解決しました。

おすすめ記事