mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-23 06:19:00 +00:00
flake-parts/setups/nixos: clean up the code
Make it snazzy, more readable, and stuff.
This commit is contained in:
parent
40895e71c3
commit
23d466dea6
@ -8,6 +8,9 @@
|
||||
let
|
||||
cfg = config.setups.nixos;
|
||||
|
||||
# This is used on a lot of the Nix modules below.
|
||||
partsConfig = config;
|
||||
|
||||
# A thin wrapper around the NixOS configuration function.
|
||||
mkHost = { extraModules ? [ ], nixpkgsBranch ? "nixpkgs", system }:
|
||||
let
|
||||
@ -99,11 +102,7 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
homeManagerUserType =
|
||||
let
|
||||
partsConfig = config;
|
||||
in
|
||||
{ name, config, lib, ... }: {
|
||||
homeManagerUserType = { name, config, lib, ... }: {
|
||||
options = {
|
||||
userConfig = lib.mkOption {
|
||||
type = with lib.types; attrsOf anything;
|
||||
@ -142,11 +141,7 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
configType =
|
||||
let
|
||||
partsConfig = config;
|
||||
in
|
||||
{ config, name, lib, ... }: {
|
||||
configType = { config, name, lib, ... }: {
|
||||
options = {
|
||||
systems = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
@ -398,9 +393,9 @@ let
|
||||
|
||||
overlays = lib.lists.flatten hmUsersOverlays;
|
||||
in
|
||||
# Most of the overlays are going to be imported from a flake
|
||||
# input anyways. This should massively reduce the step needed
|
||||
# for nixpkgs to do its thing.
|
||||
# Most of the overlays are going to be imported from a
|
||||
# variable anyways. This should massively reduce the step
|
||||
# needed for nixpkgs to do its thing.
|
||||
#
|
||||
# Though, it becomes unpredictable due to the way how the
|
||||
# overlay list is constructed. However, this is much more
|
||||
@ -499,20 +494,15 @@ in
|
||||
|
||||
config = lib.mkIf (cfg.configs != { }) {
|
||||
setups.nixos.sharedModules = [
|
||||
(
|
||||
let
|
||||
osConfig = config;
|
||||
in
|
||||
{ lib, ... }: {
|
||||
home-manager.sharedModules = osConfig.setups.home-manager.sharedModules;
|
||||
({ lib, ... }: {
|
||||
home-manager.sharedModules = partsConfig.setups.home-manager.sharedModules;
|
||||
|
||||
# These are just the recommended options for home-manager that may be
|
||||
# the default value in the future but this is how most of the NixOS
|
||||
# setups are already done so...
|
||||
home-manager.useUserPackages = lib.mkDefault true;
|
||||
home-manager.useGlobalPkgs = lib.mkDefault true;
|
||||
}
|
||||
)
|
||||
})
|
||||
];
|
||||
|
||||
flake =
|
||||
@ -540,12 +530,12 @@ in
|
||||
{
|
||||
nixosConfigurations =
|
||||
let
|
||||
renameSystems = name: system: config:
|
||||
renameSystem = name: system: config:
|
||||
lib.nameValuePair "${name}-${system}" config;
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(name: configs:
|
||||
lib.mapAttrs' (renameSystems name) configs)
|
||||
lib.mapAttrs' (renameSystem name) configs)
|
||||
pureNixosConfigs;
|
||||
|
||||
deploy.nodes =
|
||||
|
Loading…
Reference in New Issue
Block a user