Compare commits
2 commits
d85a6b963f
...
870bbb1f37
| Author | SHA1 | Date | |
|---|---|---|---|
| 870bbb1f37 | |||
| 0c5387fd61 |
3 changed files with 52 additions and 59 deletions
|
|
@ -197,8 +197,8 @@ in {
|
||||||
inherit root base;
|
inherit root base;
|
||||||
inherit (node) system;
|
inherit (node) system;
|
||||||
_cerulean = {
|
_cerulean = {
|
||||||
inherit inputs userArgs;
|
inherit inputs userArgs ceruleanArgs;
|
||||||
args = ceruleanArgs;
|
specialArgs = userArgs // ceruleanArgs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
specialArgs = assert (userArgs
|
specialArgs = assert (userArgs
|
||||||
|
|
@ -209,7 +209,7 @@ in {
|
||||||
`specialArgs` are like super important to Cerulean my love... </3
|
`specialArgs` are like super important to Cerulean my love... </3
|
||||||
But `args.${argName}` is a reserved argument name :(
|
But `args.${argName}` is a reserved argument name :(
|
||||||
''));
|
''));
|
||||||
userArgs // ceruleanArgs;
|
ceruleanArgs._cerulean.specialArgs;
|
||||||
in
|
in
|
||||||
lib.nixosSystem {
|
lib.nixosSystem {
|
||||||
inherit (node) system;
|
inherit (node) system;
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,16 @@
|
||||||
pathExists
|
pathExists
|
||||||
;
|
;
|
||||||
in {
|
in {
|
||||||
config = {
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
users =
|
users =
|
||||||
config.users.users
|
config.users.users
|
||||||
|> attrNames
|
|> attrNames
|
||||||
|> filter (x: pathExists (root + "/homes/${x}"))
|
|> filter (x: pathExists (root + "/homes/${x}"))
|
||||||
|> (x: lib.genAttrs x (y: import (root + "/homes/${y}")));
|
|> (x:
|
||||||
|
lib.genAttrs x (y:
|
||||||
|
import (root + "/homes/${y}")));
|
||||||
|
|
||||||
extraSpecialArgs = _cerulean.args;
|
extraSpecialArgs = _cerulean.specialArgs;
|
||||||
sharedModules = [
|
sharedModules = [
|
||||||
# user configuration
|
# user configuration
|
||||||
(import (root + "/nixpkgs.nix"))
|
(import (root + "/nixpkgs.nix"))
|
||||||
|
|
@ -41,5 +42,4 @@ in {
|
||||||
(import ./nixpkgs.nix (args // {contextName = "homes";}))
|
(import ./nixpkgs.nix (args // {contextName = "homes";}))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,57 +42,51 @@ 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
|
||||||
|
|> (xs: removeAttrs xs ["default"])
|
||||||
|> 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"])
|
import args.source ({inherit system;} // (removeAttrs args ["source"]))
|
||||||
// {inherit system;})
|
|
||||||
|> import args.source
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# XXX: TODO: would it work to use `base` instead of having default?
|
||||||
|
defaultPkgs =
|
||||||
|
cfg.default or (throw ''
|
||||||
|
Your `nixpkgs.nix` file does not declare a default package source.
|
||||||
|
Ensure you set `nixpkgs.channels.*.default = ...;`
|
||||||
|
'');
|
||||||
in {
|
in {
|
||||||
# NOTE: _module.args is a special option that allows us to
|
# NOTE: _module.args is a special option that allows us to
|
||||||
# NOTE: set extend specialArgs from inside the modules.
|
# NOTE: set extend specialArgs from inside the modules.
|
||||||
_module.args = repos;
|
_module.args = repos;
|
||||||
|
|
||||||
nixpkgs = let
|
nixpkgs =
|
||||||
defaultPkgs =
|
|
||||||
decl.default or (throw ''
|
|
||||||
Your `nixpkgs.nix` file does not declare a default package source.
|
|
||||||
Ensure you set `nixpkgs.channels.*.default = ...;`
|
|
||||||
'');
|
|
||||||
in
|
|
||||||
if contextName == "hosts"
|
if contextName == "hosts"
|
||||||
then {
|
then
|
||||||
flake.source = lib.mkOverride 200 defaultPkgs.source;
|
# DEBUG: defaultPkgs
|
||||||
config = lib.mkOverride 200 defaultPkgs.config;
|
{
|
||||||
|
flake.source = lib.mkOverride 200 (defaultPkgs.source or null);
|
||||||
|
overlays = lib.mkOverride 200 (defaultPkgs.overlays or {});
|
||||||
|
config = lib.mkOverride 200 (defaultPkgs.config or {});
|
||||||
}
|
}
|
||||||
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