nix develop aarch64 flake

huangapple go评论78阅读模式
英文:

nix develop aarch64 flake

问题

我正在尝试编写一个Nix Flake,用于生成一个Shell,以从两个不同的系统编译一个TeX项目:一个是Linux x86_64,另一个是MacOS aarch64-darwin。

我对Nix和Flakes相当新,所以我参考了NixOS维基上提供的示例Flake“Super fast nix-shell”。它在Linux x86上运行良好,但在MacOS上运行nix develop时失败,我无法找出问题出在哪里。

这是我的flake.nix和shell.nix:

{
  description = "Build Shell with any dependency of the project";

  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let pkgs = nixpkgs.legacyPackages.${system}; in
        {
          devShells.default = import ./shell.nix { inherit pkgs; };
        }
      );
}
{ pkgs ? import <nixpkgs> {} }:
  let
    tex = pkgs.texlive.combine
      {
        inherit (pkgs.texlive)
          scheme-medium
          pgf
          standalone
          minted
          tcolorbox
          environ
          tabto-ltx
          circuitikz
          lastpage
          tabularray
          pygmentex
          ninecolors
          multirow;
      };
  in
    pkgs.mkShell
      {
        nativeBuildInputs = [ pkgs.python310Packages.pygments tex ];
      }

在MacOS上使用'nix develop'时,我收到以下错误信息:

error: flake 'git+file:///PATH_TO_FLAKE' does not provide attribute 'devShells.aarch64-darwin.devShell.aarch64-darwin', 'packages.aarch64-darwin.devShell.aarch64-darwin', 'legacyPackages.aarch64-darwin.devShell.aarch64-darwin', 'devShell.aarch64-darwin' or 'defaultPackage.aarch64-darwin'
英文:

I'm trying to write a nix flake that produces a shell to compile a tex project from two different systems: One linux x86_64 and one MacOs aarch64-darwin.

I'm quite new to nix and flakes, so I took the example flake given on the nixos wiki "Super fast nix-shell". It works well on linux x86 but nix develop fails on MacOs and I can't figure out where is the problem.

Here are my flake.nix and shell.nix:

{
  description = &quot;Build Shell with any dependency of the project&quot;;

  inputs.flake-utils.url = &quot;github:numtide/flake-utils&quot;;

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let pkgs = nixpkgs.legacyPackages.${system}; in
        {
          devShells.default = import ./shell.nix { inherit pkgs; };
        }
      );
}
{ pkgs ? import &lt;nixpkgs&gt; {} }:
  let
    tex = pkgs.texlive.combine
      {
        inherit (pkgs.texlive)
          scheme-medium
          pgf
          standalone
          minted
          tcolorbox
          environ
          tabto-ltx
          circuitikz
          lastpage
          tabularray
          pygmentex
          ninecolors
          multirow;
      };
  in
    pkgs.mkShell
      {
        nativeBuildInputs = [ pkgs.python310Packages.pygments tex ];
      }

When using 'nix develop' on MacOs, I get the following error:

error: flake &#39;git+file:///PATH_TO_FLAKE&#39; does not provide attribute &#39;devShells.aarch64-darwin.devShell.aarch64-darwin&#39;, &#39;packages.aarch64-darwin.devShell.aarch64-darwin&#39;, &#39;legacyPackages.aarch64-darwin.devShell.aarch64-darwin&#39;, &#39;devShell.aarch64-darwin&#39; or &#39;defaultPackage.aarch64-darwin&#39;

答案1

得分: 0

我最终成功使其按预期工作。
我的flake没有问题,我发现我的nix安装已经过时,并且处于一种无法更新的奇怪状态。
解决方案是完全卸载nix,然后从干净的最新安装重新开始。

英文:

I finally got it to work as intended.
No problem in my flake, I found out that my nix installation was outdated and in a strange state that couldn't be updated.
The solution was to completely uninstall nix and start over from a clean up to date install.

huangapple
  • 本文由 发表于 2023年6月19日 16:21:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76504853.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定