【问题标题】:nixos-shell in nixos vm does not seem to be recognizing store paths that exist?nixos vm 中的 nixos-shell 似乎无法识别存在的存储路径?
【发布时间】:2021-06-29 15:23:42
【问题描述】:

我正在使用https://github.com/Mic92/nixos-shell 构建/运行虚拟机。

在此 VM 中,我尝试运行 nixos-shell,它最初因错误而失败,但在添加后:

{...}: {
  nix.nixPath = [
    "nixpkgs=${pkgs.path}"
  ];
}

它现在可以工作了,但是在尝试通过 nix-shell 调用某些东西时,它似乎正在下载应该已经存在于主机中的依赖项。

nix-shell -p vim                                                                                       /bambie
these paths will be fetched (7.00 MiB download, 33.13 MiB unpacked):
  /nix/store/1cbk7i6dg26cygss2b6w8xq4dnj50z31-vim-8.2.1522
copying path '/nix/store/1cbk7i6dg26cygss2b6w8xq4dnj50z31-vim-8.2.1522' from 'https://cache.nixos.org'...
^Cerror: interrupted by the user

为什么会这样?当路径 (/nix/store/1cbk7i6dg26cygss2b6w8xq4dnj50z31-vim-8.2.1522) 出现在 VM 上时(我这样说是因为当我执行 ls /nix/store/1cbk7i6dg26cygss2b6w8xq4dnj50z31-vim-8.2.1522 时它就出现了)?

【问题讨论】:

    标签: nix nixos


    【解决方案1】:

    不是真正的解决方案,但我相信这解释了为什么会发生这种行为:

    这里的问题是,当您在 VM 中使用 Nix 时,存储 来自主机的路径未在 Nix 的 SQLite 数据库中注册。在 另一方面,来自主机的所有存储路径都应该是 在 VM 中可用(当然,如果 VM 在内部运行时除外 Nix 构建过程)。

    https://discourse.nixos.org/t/how-to-build-a-nixos-vm-with-nix-in-which-nixos-rebuild-is-a-no-op/7937/2

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-13
      • 1970-01-01
      • 2022-07-11
      • 2016-12-05
      • 2014-07-07
      • 2018-06-19
      • 1970-01-01
      相关资源
      最近更新 更多