gpt4 book ai didi

nix - 以下 cmdline 参数的最短 `shell.nix` 等价物是什么?

转载 作者:行者123 更新时间:2023-12-05 02:10:45 27 4
gpt4 key购买 nike

以下 cmdline 参数的最短 shell.nix 等价物是什么?

nix-shell -p "haskell.packages.ghc865.ghcWithPackages (p: [p.ghci-pretty])"

这行得通,但是很冗长:

# contents of shell.nix file
# run with the following cmd:
# nix-shell shell.nix
{ nixpkgs ? import <nixpkgs> {} }:
let
inherit nixpkgs;
inherit (nixpkgs) haskellPackages;
haskellDeps = a: with a; [
ipprint
base
hscolour
ghci-pretty
];
ghc = nixpkgs.haskellPackages.ghcWithPackages haskellDeps;

nixPackages = [
haskellPackages.cabal-install
ghc
];
in
nixpkgs.stdenv.mkDerivation {
name = "profile_name";
buildInputs = nixPackages;
}

最佳答案

您可以像这样逐字复制命令行:

{ pkgs ? import <nixpkgs> {} }:
let
ghc = pkgs.haskell.packages.ghc865.ghcWithPackages (p: [ p.ghci-pretty ]);
in
pkgs.mkShell {
buildInputs = [ ghc ];
}

关于nix - 以下 cmdline 参数的最短 `shell.nix` 等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58270109/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com