我想用局部nixpkgs存储库的哈伯斯包,
let
# pass config so that packages use correct allowUnfree for example
nixpkgs-local = import /home/bjorn/projects/nixpkgs { inherit config; };
in
rec {
config.allowUnfree = true;
config.packageOverrides = old: {
# packages from local nixpkgs
inherit (nixpkgs-local) safeeyes hubstaff;
....但是它不自由的包,所以抛出不自由的包错误。
$ sudo nixos-rebuild dry-build
building the system configuration...
error: Package ‘hubstaff-1.3.1-ff75f26’ in /home/bjorn/projects/nixpkgs/pkgs/applications/misc/hubstaff/default.nix:60 has an unfree license (‘unfree’), refusing to evaluate.据我所知,我需要通过nixpkgs.config.allowUnfree = true,但上面的import /home/bjorn/projects/nixpkgs { inherit config; };不起作用
附注:
我的另一个问题是,我试图窥探我在config.nixpkgs.allowUnfree 这里中传递的价值。
{ config, pkgs, lib, ... }:
let r = {
imports = [
./hardware-configuration.nix
./hardware-configuration-override.nix
./hardware-programs.nix
/home/bjorn/projects/nixpkgs/nixos/modules/services/misc/safeeyes.nix
];
....
};
in
builtins.seq (lib.debug.showVal config.nixpkgs.allowUnfree) r但我得到了无限递归误差,也许有人知道怎么做?
发布于 2018-04-18 20:35:25
Tnx到tilpner
我传递了错误的配置
也就是说,这是import /home/bjorn/projects/nixpkgs期望的配置。
nix-repl> c = import <nixpkgs/nixos> {}
nix-repl> c.config.nixpkgs
{ config = { ... }; overlays = [ ... ]; pkgs = { ... }; system = "x86_64-linux"; }这就是我路过的地方
nix-repl> c.config
{ _module = { ... }; assertions = [ ... ]; boot = { ... }; config = { ... }; containers = { ... }; dysnomia = { ... }; ec2 = { ... }; environment = { ... }; fileSystems = { ... }; fonts = { ... }; gnu = false; hardware = { ... }; i18n = { ... }; ids = { ... }; jobs = «error: The option `jobs' is used but not defined.»; kde = { ... }; krb5 = { ... }; lib = { ... }; meta = { ... }; nesting = { ... }; networking = { ... }; nix = { ... }; nixpkgs = { ... }; passthru = «error: The option `passthru' is used but not defined.»; power = { ... }; powerManagement = { ... }; programs = { ... }; security = { ... }; services = { ... }; sound = { ... }; swapDevices = [ ... ]; system = {它是传递给/etc/nixos/的
修正:
{ config, pkgs }:
let
# pass config so that packages use correct allowUnfree for example
unfreeConfig = config.nixpkgs.config // {
allowUnfree = true;
};
nixpkgs-local = import /home/bjorn/projects/nixpkgs { config = unfreeConfig; };
in发布于 2018-04-19 10:46:56
回答你的第二个“P.S”问题是,这是为什么和建议做什么代替。
出现无限递归是因为模块系统需要计算每个模块的“根”和一些属性(如imports ),以构建表示config根的术语。
在调用seq时,您正在计算config的一个属性,此时config本身仍在计算中。
从技术上讲,您可以通过将seq调用添加到属性而不是整个模块来解决这个问题。这样,可以在不评估config调用的情况下评估seq。
查看配置的一个更简单的方法可能是在nix repl中导入它。
nix-repl> c = import <nixpkgs/nixos> { configuration = ./nixos/root/default.nix; /* or the file usually called configuration.nix */ }
nix-repl> c.config.nixpkgs.config.allowUnfree
true您可以在迭代时使用:r命令重新加载所有文件。Nix喜欢缓存它们,因为实现面向批处理执行。
https://stackoverflow.com/questions/49906076
复制相似问题