我正在尝试下载一个版本不在nixpkgs上的软件包。为此,我正在使用builtins.fetchGit
. fetchGit
以下是我使用( /etc/nixos/home/core.nix
) 以获得更好想法的文件摘要:
{ pkgs, username, homeDirectory }:
############################
# Custom package snapshots #
############################
let custom-ver-pkgs = {
# Haskell Language Server
hls = let pkgsSnapshot = import (builtins.fetchGit {
name = "custom hls version";
url = "https://github.com/nixos/nixpkgs-channels/";
ref = "refs/heads/nixpkgs-unstable";
rev = "2c162d49cd5b979eb66ff1653aecaeaa01690fcc";
}) {}; in pkgsSnapshot.haskellPackages.haskell-language-server;
};
in
{
# Actual config
}
这就是我使用hls
上面定义的关键字的地方:
# Packages
home.packages = with pkgs; [
... # Normal packages
] ++
# Packages with custom version (See start of file)
(with custom-ver-pkgs; [
hls
]);
如您所见,我也使用家庭管理器。上述.../core.nix
文件直接导入到/etc/nixos/configuration.nix
.
正如标题所说,如果我运行sudo nixos-rebuild switch
,终端会冻结(从某种意义上说,该命令会永远持续下去而没有做任何事情)。我的问题可能是什么?