chore: reformat codebase

This commit is contained in:
Gabriel Arazas 2024-01-16 15:19:51 +08:00
parent 26881be1b4
commit d3e0802d38
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
5 changed files with 51 additions and 51 deletions

View File

@ -1,7 +1,7 @@
# A very basic NixOS VM configuration intended for testing out the given
# workflow module. It's a good thing the baseline for the configuration is not
# tedious to set up for simpler configs like this.
{ workflow, extraModules ? [] }:
{ workflow, extraModules ? [ ] }:
let
pkgs = import <nixpkgs> { };

View File

@ -25,7 +25,7 @@ in
options = {
images = lib.mkOption {
type = with lib.types; attrsOf package;
default = {};
default = { };
description = ''
An attribute set of NixOS configurations built as an image output
supported by
@ -41,7 +41,7 @@ in
lib.mapAttrs
(k: v: v.images)
(lib.filterAttrs
(k: v: v.images != {})
(k: v: v.images != { })
config.allSystems
);

View File

@ -73,7 +73,7 @@ let
modules = lib.mkOption {
type = with lib.types; listOf raw;
default = [];
default = [ ];
description = ''
A list of NixOS modules specific for that host.
'';
@ -81,7 +81,7 @@ let
overlays = lib.mkOption {
type = with lib.types; listOf (functionTo raw);
default = [];
default = [ ];
example = lib.literalExpression ''
[
inputs.neovim-nightly-overlay.overlays.default
@ -154,7 +154,7 @@ in
options.setups.home-manager = {
sharedModules = lib.mkOption {
type = with lib.types; listOf raw;
default = [];
default = [ ];
description = ''
A list of modules to be shared by all of the declarative home-manager
setups.
@ -168,7 +168,7 @@ in
standaloneConfigModules = lib.mkOption {
type = with lib.types; listOf raw;
default = [];
default = [ ];
internal = true;
description = ''
A list of modules to be added alongside the shared home-manager modules
@ -182,7 +182,7 @@ in
configs = lib.mkOption {
type = with lib.types; attrsOf (submodule configType);
default = {};
default = { };
description = ''
An attribute set of metadata for the declarative home-manager setups.
'';
@ -208,7 +208,7 @@ in
};
};
config = lib.mkIf (cfg.configs != {}) {
config = lib.mkIf (cfg.configs != { }) {
flake =
let
# A quick data structure we can pass through multiple build pipelines.
@ -221,14 +221,14 @@ in
let
name = "${username}-${system}";
in
lib.nameValuePair name (mkHome {
inherit (metadata) nixpkgs-branch home-manager-branch;
inherit system;
extraModules =
cfg.sharedModules
++ cfg.standaloneConfigModules
++ metadata.modules;
})
lib.nameValuePair name (mkHome {
inherit (metadata) nixpkgs-branch home-manager-branch;
inherit system;
extraModules =
cfg.sharedModules
++ cfg.standaloneConfigModules
++ metadata.modules;
})
)
metadata.systems);
in
@ -238,27 +238,27 @@ in
cfg.configs;
in
{
homeConfigurations =
lib.concatMapAttrs
(name: configs:
lib.mapAttrs'
(system: config: lib.nameValuePair "${name}-${system}" config)
configs)
pureHomeManagerConfigs;
homeConfigurations =
lib.concatMapAttrs
(name: configs:
lib.mapAttrs'
(system: config: lib.nameValuePair "${name}-${system}" config)
configs)
pureHomeManagerConfigs;
deploy.nodes =
let
validConfigs =
lib.filterAttrs
(name: _: cfg.configs.${name}.deploy != null)
pureHomeManagerConfigs;
in
lib.concatMapAttrs
(name: configs:
lib.mapAttrs'
(system: config: lib.nameValuePair "home-manager-${name}-${system}"
(cfg.configs.${name}.deploy.profiles { inherit name config system; })))
validConfigs;
};
deploy.nodes =
let
validConfigs =
lib.filterAttrs
(name: _: cfg.configs.${name}.deploy != null)
pureHomeManagerConfigs;
in
lib.concatMapAttrs
(name: configs:
lib.mapAttrs'
(system: config: lib.nameValuePair "home-manager-${name}-${system}"
(cfg.configs.${name}.deploy.profiles { inherit name config system; })))
validConfigs;
};
};
}

View File

@ -46,7 +46,7 @@ let
extraModules = extraModules';
};
in
image.config.system.build.${image.config.formatAttr};
image.config.system.build.${image.config.formatAttr};
deployNodeType = { config, lib, ... }: {
freeformType = with lib.types; attrsOf anything;
@ -114,7 +114,7 @@ let
modules = lib.mkOption {
type = with lib.types; listOf raw;
default = [];
default = [ ];
description = ''
A list of NixOS modules specific for that host.
'';
@ -122,7 +122,7 @@ let
overlays = lib.mkOption {
type = with lib.types; listOf (functionTo raw);
default = [];
default = [ ];
example = lib.literalExpression ''
[
inputs.neovim-nightly-overlay.overlays.default
@ -211,7 +211,7 @@ in
options.setups.nixos = {
sharedModules = lib.mkOption {
type = with lib.types; listOf raw;
default = [];
default = [ ];
description = ''
A list of modules to be shared by all of the declarative NixOS setups.
'';
@ -219,7 +219,7 @@ in
configs = lib.mkOption {
type = with lib.types; attrsOf (submodule configType);
default = {};
default = { };
description = ''
An attribute set of metadata for the declarative NixOS setups. This
will then be used for related flake outputs such as
@ -273,7 +273,7 @@ in
};
};
config = lib.mkIf (cfg.configs != {}) {
config = lib.mkIf (cfg.configs != { }) {
setups.nixos.sharedModules = [
{
home-manager.useUserPackages = lib.mkDefault true;
@ -294,11 +294,11 @@ in
lib.listToAttrs
(builtins.map
(system:
lib.nameValuePair system (mkHost {
nixpkgs-branch = metadata.nixpkgs-branch;
extraModules = cfg.sharedModules ++ metadata.modules;
inherit system;
})
lib.nameValuePair system (mkHost {
nixpkgs-branch = metadata.nixpkgs-branch;
extraModules = cfg.sharedModules ++ metadata.modules;
inherit system;
})
)
metadata.systems);
in
@ -337,7 +337,7 @@ in
let
validImages = lib.filterAttrs
(host: metadata:
metadata.formats != null && (lib.elem system metadata.systems))
metadata.formats != null && (lib.elem system metadata.systems))
cfg.configs;
in
lib.mapAttrs'

View File

@ -389,7 +389,7 @@ rec {
if (lib.elem name validDesktopNames) || (lib.hasPrefix "X-" name) then
name
else
"X-${name}")
"X-${name}")
names;
example = [ "GNOME" "Garden" ];
};