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 # 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 # workflow module. It's a good thing the baseline for the configuration is not
# tedious to set up for simpler configs like this. # tedious to set up for simpler configs like this.
{ workflow, extraModules ? [] }: { workflow, extraModules ? [ ] }:
let let
pkgs = import <nixpkgs> { }; pkgs = import <nixpkgs> { };

View File

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

View File

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

View File

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

View File

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