mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-25 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
|
./wrapper-manager.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.setups.sharedNixpkgsConfig = lib.mkOption {
|
options.setups = {
|
||||||
type = with lib.types; attrsOf anything;
|
configDir = lib.mkOption {
|
||||||
description = ''
|
type = lib.types.path;
|
||||||
Shared configuration of the nixpkgs instance to be passed to all of the
|
default = ../../../configs;
|
||||||
module environments based from the nixpkgs module system.
|
description = ''
|
||||||
'';
|
The directory containing configurations of various environments. The
|
||||||
default = { };
|
top-level directories are expected to be the name of the environment
|
||||||
example = {
|
with their configurations inside.
|
||||||
allowUnfree = true;
|
'';
|
||||||
|
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
|
let
|
||||||
cfg = config.setups.disko;
|
cfg = config.setups.disko;
|
||||||
|
partsConfig = config;
|
||||||
|
|
||||||
diskoConfigType = { name, config, ... }: {
|
diskoConfigType = { name, config, ... }: {
|
||||||
options = {
|
options = {
|
||||||
@ -57,7 +58,7 @@ in
|
|||||||
config = lib.mkIf (config.diskoConfigs != [ ]) (
|
config = lib.mkIf (config.diskoConfigs != [ ]) (
|
||||||
let
|
let
|
||||||
diskoConfigs =
|
diskoConfigs =
|
||||||
builtins.map (name: import ../../../configs/disko/${name}) config.diskoConfigs;
|
builtins.map (name: import "${partsConfig.setups.configDir}/disko/${name}") config.diskoConfigs;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
modules = lib.singleton {
|
modules = lib.singleton {
|
||||||
@ -75,6 +76,6 @@ in
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
flake.diskoConfigurations =
|
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 = {
|
config = {
|
||||||
modules = [
|
modules = [
|
||||||
../../../configs/home-manager/${config.configName}
|
"${partsConfig.setups.configDir}/home-manager/${config.configName}"
|
||||||
|
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.setups.nixos;
|
cfg = config.setups.nixos;
|
||||||
|
partsConfig = config;
|
||||||
nixosModules = ../../nixos;
|
nixosModules = ../../nixos;
|
||||||
|
|
||||||
# A thin wrapper around the NixOS configuration function.
|
# A thin wrapper around the NixOS configuration function.
|
||||||
@ -172,7 +173,7 @@ let
|
|||||||
|
|
||||||
config.modules = [
|
config.modules = [
|
||||||
# Bring in the required modules.
|
# Bring in the required modules.
|
||||||
../../../configs/nixos/${config.configName}
|
"${partsConfig.setups.configDir}/nixos/${config.configName}"
|
||||||
|
|
||||||
# Setting up the typical configuration.
|
# Setting up the typical configuration.
|
||||||
(
|
(
|
||||||
|
@ -103,7 +103,7 @@ let
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
modules = [
|
modules = [
|
||||||
../../../configs/nixvim/${config.configName}
|
"${partsConfig.setups.configDir}/nixvim/${config.configName}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -86,7 +86,7 @@ let
|
|||||||
nixpkgs.config = cfg.sharedNixpkgsConfig;
|
nixpkgs.config = cfg.sharedNixpkgsConfig;
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
../../../configs/wrapper-manager/${config.configName}
|
"${partsConfig.setups.configDir}/wrapper-manager/${config.configName}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user