mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-21 00:19:12 +00:00
flake-parts/setups: create module option for unified configuration directory
This commit is contained in:
parent
78193d5270
commit
dc31e3e36b
@ -14,15 +14,30 @@
|
||||
./wrapper-manager.nix
|
||||
];
|
||||
|
||||
options.setups.sharedNixpkgsConfig = lib.mkOption {
|
||||
type = with lib.types; attrsOf anything;
|
||||
description = ''
|
||||
Shared configuration of the nixpkgs instance to be passed to all of the
|
||||
module environments based from the nixpkgs module system.
|
||||
'';
|
||||
default = { };
|
||||
example = {
|
||||
allowUnfree = true;
|
||||
options.setups = {
|
||||
configDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = ../../../configs;
|
||||
description = ''
|
||||
The directory containing configurations of various environments. The
|
||||
top-level directories are expected to be the name of the environment
|
||||
with their configurations inside.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
''${inputs.my-flake}/configs
|
||||
'';
|
||||
};
|
||||
|
||||
sharedNixpkgsConfig = lib.mkOption {
|
||||
type = with lib.types; attrsOf anything;
|
||||
description = ''
|
||||
Shared configuration of the nixpkgs instance to be passed to all of the
|
||||
module environments based from the nixpkgs module system.
|
||||
'';
|
||||
default = { };
|
||||
example = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
let
|
||||
cfg = config.setups.disko;
|
||||
partsConfig = config;
|
||||
|
||||
diskoConfigType = { name, config, ... }: {
|
||||
options = {
|
||||
@ -57,7 +58,7 @@ in
|
||||
config = lib.mkIf (config.diskoConfigs != [ ]) (
|
||||
let
|
||||
diskoConfigs =
|
||||
builtins.map (name: import ../../../configs/disko/${name}) config.diskoConfigs;
|
||||
builtins.map (name: import "${partsConfig.setups.configDir}/disko/${name}") config.diskoConfigs;
|
||||
in
|
||||
{
|
||||
modules = lib.singleton {
|
||||
@ -75,6 +76,6 @@ in
|
||||
|
||||
config = {
|
||||
flake.diskoConfigurations =
|
||||
lib.mapAttrs (name: _: import ../../../configs/disko/${name}) cfg.configs;
|
||||
lib.mapAttrs (name: _: import "${partsConfig.setups.configDir}/disko/${name}") cfg.configs;
|
||||
};
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ let
|
||||
|
||||
config = {
|
||||
modules = [
|
||||
../../../configs/home-manager/${config.configName}
|
||||
"${partsConfig.setups.configDir}/home-manager/${config.configName}"
|
||||
|
||||
(
|
||||
let
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
let
|
||||
cfg = config.setups.nixos;
|
||||
partsConfig = config;
|
||||
nixosModules = ../../nixos;
|
||||
|
||||
# A thin wrapper around the NixOS configuration function.
|
||||
@ -172,7 +173,7 @@ let
|
||||
|
||||
config.modules = [
|
||||
# Bring in the required modules.
|
||||
../../../configs/nixos/${config.configName}
|
||||
"${partsConfig.setups.configDir}/nixos/${config.configName}"
|
||||
|
||||
# Setting up the typical configuration.
|
||||
(
|
||||
|
@ -103,7 +103,7 @@ let
|
||||
|
||||
config = {
|
||||
modules = [
|
||||
../../../configs/nixvim/${config.configName}
|
||||
"${partsConfig.setups.configDir}/nixvim/${config.configName}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ let
|
||||
nixpkgs.config = cfg.sharedNixpkgsConfig;
|
||||
|
||||
modules = [
|
||||
../../../configs/wrapper-manager/${config.configName}
|
||||
"${partsConfig.setups.configDir}/wrapper-manager/${config.configName}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user