英文:
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 = "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 ];
}
When using 'nix develop' on MacOs, I get the following error:
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'
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论