⚗️🚧 (modules/flake) Update easy-hosts config and flake module args

This commit is contained in:
Jo 2025-01-15 23:56:16 +01:00
parent ecfbc9baf6
commit e54b87a835
10 changed files with 85 additions and 49 deletions

View file

@ -0,0 +1,20 @@
{
inputs,
config,
...
}:
{
# Overwrite and add new arguments to all flake modules.
_module.args = {
namespace = config.flake.namespace;
# Initialize nixpkgs instance with custom overlays.
pkgs = import inputs.nixpkgs {
overlays = [
(final: prev: {
# Todo: actually append overlays from "/overlays/overlay-name/default.nix" files.
})
];
};
};
}

10
modules/flake/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
imports = [
# Automagically imports overlays from "/overlays/overlay-name" and applies them to pkgs.
# Also applies some other useful arguments, like namespace, to all flake modules.
./arguments.nix
# Automagically imports systems from "/systems/arch-classname/system-name".
./systems.nix
];
}

30
modules/flake/systems.nix Normal file
View file

@ -0,0 +1,30 @@
{
inputs,
namespace,
...
}:
{
imports = [ inputs.easy-hosts.flakeModule ];
easyHosts = {
autoConstruct = true;
path = ../../systems;
shared = {
specialArgs = {
inherit namespace;
};
};
perClass = class: {
modules = [
# Import modules based on current classname.
../${class}
(inputs.nixpkgs.lib.optionals (class == "nixos") [
inputs.home-manager.nixosModules.default
])
];
};
};
}

View file

@ -1 +0,0 @@
{}