nixpkgs.channels disregards contextName
This commit is contained in:
parent
d85a6b963f
commit
0c5387fd61
1 changed files with 19 additions and 28 deletions
|
|
@ -26,11 +26,10 @@
|
||||||
cfg = config.nixpkgs.channels;
|
cfg = config.nixpkgs.channels;
|
||||||
in {
|
in {
|
||||||
options.nixpkgs.channels = lib.mkOption {
|
options.nixpkgs.channels = lib.mkOption {
|
||||||
type = lib.types.attrsOf (lib.types.attrs);
|
type = lib.types.attrs;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Declare package repositories per module context (nixos, home-manager, etc)";
|
description = "Declare package repositories";
|
||||||
example = {
|
example = {
|
||||||
"homes" = {
|
|
||||||
"pkgs" = {
|
"pkgs" = {
|
||||||
source = "inputs.nixpkgs";
|
source = "inputs.nixpkgs";
|
||||||
system = "x86-64-linux";
|
system = "x86-64-linux";
|
||||||
|
|
@ -43,29 +42,22 @@ in {
|
||||||
source = "inputs.nixpkgs-unstable";
|
source = "inputs.nixpkgs-unstable";
|
||||||
system = "x86-64-linux";
|
system = "x86-64-linux";
|
||||||
config = {
|
config = {
|
||||||
allowUnfree = true;
|
allowUnfree = false;
|
||||||
allowBroken = false;
|
allowBroken = true;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = let
|
||||||
# TODO: use lib.types.submodule to restrict what options
|
|
||||||
# TODO: can be given to `nixpkgs.channels.${moduleName}.${name}`
|
|
||||||
decl =
|
|
||||||
cfg.${contextName} or cfg.default;
|
|
||||||
|
|
||||||
repos =
|
repos =
|
||||||
decl
|
cfg
|
||||||
|> mapAttrs (
|
|> mapAttrs (
|
||||||
name: args:
|
name: args:
|
||||||
lib.mkForce (
|
lib.mkForce (
|
||||||
assert args ? source
|
assert args ? source
|
||||||
|| abort ''
|
|| abort ''
|
||||||
${toString ./.}
|
`nixpkgs.channels.${name}` missing required attribute "source"
|
||||||
`nixpkgs.channels.${contextName}.${name}` missing required attribute "source"
|
|
||||||
'';
|
'';
|
||||||
((removeAttrs args ["source"])
|
((removeAttrs args ["source"])
|
||||||
// {inherit system;})
|
// {inherit system;})
|
||||||
|
|
@ -78,8 +70,9 @@ in {
|
||||||
_module.args = repos;
|
_module.args = repos;
|
||||||
|
|
||||||
nixpkgs = let
|
nixpkgs = let
|
||||||
|
# XXX: TODO: would it work to use `base` instead of having default?
|
||||||
defaultPkgs =
|
defaultPkgs =
|
||||||
decl.default or (throw ''
|
cfg.default or (throw ''
|
||||||
Your `nixpkgs.nix` file does not declare a default package source.
|
Your `nixpkgs.nix` file does not declare a default package source.
|
||||||
Ensure you set `nixpkgs.channels.*.default = ...;`
|
Ensure you set `nixpkgs.channels.*.default = ...;`
|
||||||
'');
|
'');
|
||||||
|
|
@ -91,9 +84,7 @@ in {
|
||||||
}
|
}
|
||||||
else if contextName == "homes"
|
else if contextName == "homes"
|
||||||
then {
|
then {
|
||||||
# XXX: XXX: XXX: OH OH OH OMG, its because aurora never defines pkgs
|
|
||||||
config = lib.mkOverride 200 (defaultPkgs.config or {});
|
config = lib.mkOverride 200 (defaultPkgs.config or {});
|
||||||
# XXX: WARNING: TODO: modify options so overlays must always be given as the correct type
|
|
||||||
overlays = lib.mkOverride 200 (defaultPkgs.overlays or []);
|
overlays = lib.mkOverride 200 (defaultPkgs.overlays or []);
|
||||||
}
|
}
|
||||||
else {};
|
else {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue