为了找出存储库无法构建的原因,我想枚举源中的所有可用属性。也就是说,列出所有ATTR
适合 的内容nix-build --attr ATTR https://github.com/USER/REPO/tarball/X.Y.Z
。
您可以根据您的用例和格式使用各种工具。
\n如果您正在 flake 存储库中查找包,您可以执行以下操作:
\n$ nix search github:kamadorueda/alejandra/3.0.0\n* packages.x86_64-linux.alejandra-aarch64-unknown-linux-musl (3.0.0+20220814.ef03f7e)\n The Uncompromising Nix Code Formatter.\n\xe2\x80\xa6\n
Run Code Online (Sandbox Code Playgroud)\n您还可以列出任意文件中的属性,例如:
\n$ cat demo.nix\n{\n myAttr = 42;\n myOtherAttr = "hello";\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n通过调用attrNames
提取导入文件的属性名称:
$ nix eval --impure --expr "let pkgs = import <nixpkgs> {}; in pkgs.lib.attrNames (import ./demo.nix)"\n[ "myAttr" "myOtherAttr" ]\n
Run Code Online (Sandbox Code Playgroud)\n如果您在本地复制/提取您提供的 tarball 并运行以下命令:
\n$ nix eval --impure --expr "let pkgs = import <nixpkgs> {}; in pkgs.lib.attrNames (import ./default.nix {})"\n[ "PKG_CONFIG_ALLOW_CROSS" "__ignoreNulls" "all" "args" "buildAndTestSubdir" "buildInputs" "builder" "cargoBuildFeatures" "cargoBuildNoDefaultFeatures" "cargoBuildType" "cargoCheckFeatures" "cargoCheckNoDefaultFeatures" "cargoCheckType" "cargoDeps" "configureFlags" "configurePhase" "depsBuildBuild" "depsBuildBuildPropagated" "depsBuildTarget" "depsBuildTargetPropagated" "depsHostHost" "depsHostHostPropagated" "depsTargetTarget" "depsTargetTargetPropagated" "doCheck" "doInstallCheck" "drvAttrs" "drvPath" "inputDerivation" "meta" "name" "nativeBuildInputs" "out" "outPath" "outputName" "outputs" "overrideAttrs" "passthru" "patchRegistryDeps" "patches" "pname" "postUnpack" "propagatedBuildInputs" "propagatedNativeBuildInputs" "src" "stdenv" "strictDeps" "system" "tests" "type" "userHook" "version" ]\n
Run Code Online (Sandbox Code Playgroud)\n您将看到,在您的情况下default.nix
,直接输出单个推导(您看到的垃圾只是推导的内容)而不是一组推导。如果您实际阅读该文件的源代码,您会发现它确实输出了flake.defaultNix.defaultPackage.${system}
. 这样你应该nix-build
在没有任何属性的情况下调用,例如nix-build https://github.com/kamadorueda/alejandra/tarball/3.0.0
.
话虽这么说,我不确定你如何运行/安装这个软件,但就我而言(启用了薄片)我可以运行:
\n$ nix run github:kamadorueda/alejandra/3.0.0\nFormatting stdin.\nUse --help to see all command line options.\nuse --quiet to suppress this and other messages.\n
Run Code Online (Sandbox Code Playgroud)\nat it works\xe2\x80\xa6 所以我想问题不在于库,而在于安装它的方式。
\n 归档时间: |
|
查看次数: |
1884 次 |
最近记录: |