[英]Can I start nix-shell with packages from different revisions?
I can start nix-shell
with a package from a particular revision, eg我可以使用来自特定版本的 package 启动
nix-shell
,例如
nix-shell -p ktlint -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/141439f6f11537ee349a58aaf97a5a5fc072365c.tar.gz
nix-shell -p jq -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/7d7622909a38a46415dd146ec046fdc0f3309f44.tar.gz
Can I start nix-shell
with two packages, but from different revisions, in one command?我可以在一个命令中使用两个包启动
nix-shell
,但来自不同的修订版吗? For example, if I wanted both ktlint
and jq
from the specific revisions above?例如,如果我想要上面特定版本中的
ktlint
和jq
?
Setting NIX_PATH=nixpkgs=...
is just syntactic sugar enabling references like <nixpkgs>
to work;设置
NIX_PATH=nixpkgs=...
只是使<nixpkgs>
类的引用起作用的语法糖; but one doesn't need to use import <nixpkgs>
exclusively -- one can also import directly from an explicit path.但是不需要专门使用
import <nixpkgs>
——也可以直接从显式路径导入。
nix-shell -E '
let
pkgsA = (import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/141439f6f11537ee349a58aaf97a5a5fc072365c.tar.gz) {});
pkgsB = (import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/7d7622909a38a46415dd146ec046fdc0f3309f44.tar.gz) {});
in
pkgsA.mkShell {
buildInputs = [
pkgsA.ktlint
pkgsB.jq
];
}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.