chore: reformat codebase

This commit is contained in:
Gabriel Arazas 2024-02-02 12:40:16 +08:00
parent 2f389641cd
commit 44090d6257
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
12 changed files with 345 additions and 327 deletions

View File

@ -22,5 +22,6 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@ -101,7 +101,8 @@ in
# A set of bindings to be used for each jump direction. # A set of bindings to be used for each jump direction.
bindings: bindings:
let let
mappings = builtins.map (motion: mappings = builtins.map
(motion:
let let
inherit (motion) region jumpDirection variant; inherit (motion) region jumpDirection variant;
jumpDirection' = lib.strings.toLower jumpDirection; jumpDirection' = lib.strings.toLower jumpDirection;
@ -115,7 +116,8 @@ in
query = "@${query}.${variant}"; query = "@${query}.${variant}";
}; };
}; };
}) motions; })
motions;
in in
acc ++ mappings; acc ++ mappings;
in in
@ -127,7 +129,8 @@ in
"conditional" = { previous = "D"; next = "d"; }; "conditional" = { previous = "D"; next = "d"; };
"statement" = { previous = "S"; next = "s"; }; "statement" = { previous = "S"; next = "s"; };
"loop" = { previous = "L"; next = "l"; }; "loop" = { previous = "L"; next = "l"; };
})); }
));
select = { select = {
enable = true; enable = true;
lookahead = true; lookahead = true;
@ -161,7 +164,8 @@ in
let let
mappingsList = mappingsList =
builtins.map (variant: builtins.map
(variant:
let let
prefixMap' = prefixMap.${variant}; prefixMap' = prefixMap.${variant};
in in
@ -203,7 +207,8 @@ in
mkQueryMappings = acc: query: bindings: mkQueryMappings = acc: query: bindings:
let let
mappings = builtins.map (motion: mappings = builtins.map
(motion:
let let
inherit (motion) jumpDirection variant; inherit (motion) jumpDirection variant;
jumpDirection' = lib.strings.toLower jumpDirection; jumpDirection' = lib.strings.toLower jumpDirection;
@ -217,7 +222,8 @@ in
query = "@${query}.${variant}"; query = "@${query}.${variant}";
}; };
}; };
}) motions; })
motions;
in in
acc ++ mappings; acc ++ mappings;
in in
@ -225,7 +231,9 @@ in
"function" = { next = "f"; previous = "F"; }; "function" = { next = "f"; previous = "F"; };
"parameter" = { next = "a"; previous = "A"; }; "parameter" = { next = "a"; previous = "A"; };
"conditional" = { next = "d"; previous = "D"; }; "conditional" = { next = "d"; previous = "D"; };
})); }
)
);
}; };
}; };
} }

View File

@ -7,7 +7,12 @@ let
partsConfig = config; partsConfig = config;
# A thin wrapper around the home-manager configuration function. # A thin wrapper around the home-manager configuration function.
mkHome = { system, nixpkgsBranch ? "nixpkgs", homeManagerBranch ? "home-manager", extraModules ? [ ] }: mkHome =
{ system
, nixpkgsBranch ? "nixpkgs"
, homeManagerBranch ? "home-manager"
, extraModules ? [ ]
}:
let let
pkgs = inputs.${nixpkgsBranch}.legacyPackages.${system}; pkgs = inputs.${nixpkgsBranch}.legacyPackages.${system};
in in

View File

@ -41,7 +41,12 @@ let
}; };
# A very very thin wrapper around `mkHost` to build with the given format. # A very very thin wrapper around `mkHost` to build with the given format.
mkImage = { system, nixpkgsBranch ? "nixpkgs", extraModules ? [ ], format ? "iso" }: mkImage =
{ system
, nixpkgsBranch ? "nixpkgs"
, extraModules ? [ ]
, format ? "iso"
}:
let let
extraModules' = extraModules' =
extraModules ++ [ inputs.nixos-generators.nixosModules.${format} ]; extraModules ++ [ inputs.nixos-generators.nixosModules.${format} ];
@ -295,8 +300,7 @@ let
}; };
}; };
config = { config.modules = [
modules = [
# Bring in the required modules. # Bring in the required modules.
inputs.${config.homeManagerBranch}.nixosModules.home-manager inputs.${config.homeManagerBranch}.nixosModules.home-manager
../../../configs/nixos/${name} ../../../configs/nixos/${name}
@ -385,7 +389,8 @@ let
setupConfig.homeManagerUsers.users); setupConfig.homeManagerUsers.users);
}) })
]; ];
})) }
))
# Next, we include the chosen NixVim configuration into NixOS. # Next, we include the chosen NixVim configuration into NixOS.
(lib.mkIf (config.nixvim.instance != null) (lib.mkIf (config.nixvim.instance != null)
@ -426,7 +431,6 @@ let
) )
]; ];
}; };
};
in in
{ {
options.setups.nixos = { options.setups.nixos = {

View File

@ -11,7 +11,7 @@ let
cfg = config.setups.nixvim; cfg = config.setups.nixvim;
nixvimModules = ../../nixvim; nixvimModules = ../../nixvim;
mkNixvimConfig = { system, pkgs, modules ? [] }: mkNixvimConfig = { system, pkgs, modules ? [ ] }:
inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule { inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule {
inherit pkgs; inherit pkgs;
module = { module = {
@ -24,7 +24,7 @@ let
modulesOption = lib.mkOption { modulesOption = lib.mkOption {
type = with lib.types; listOf raw; type = with lib.types; listOf raw;
default = []; default = [ ];
}; };
modulesOption' = configEnv: modulesOption // { modulesOption' = configEnv: modulesOption // {
description = '' description = ''
@ -84,7 +84,7 @@ in
configType configType
]; ];
}); });
default = {}; default = { };
description = '' description = ''
A set of NixVim configurations to be integrated into the declarative A set of NixVim configurations to be integrated into the declarative
setups configuration. Each of them will be available as part of setups configuration. Each of them will be available as part of
@ -101,14 +101,15 @@ in
standaloneConfigModules = modulesOption' "standalone configuration"; standaloneConfigModules = modulesOption' "standalone configuration";
}; };
config = lib.mkIf (cfg.configs != {}) { config = lib.mkIf (cfg.configs != { }) {
setups.nixvim.sharedModules = [ nixvimModules ]; setups.nixvim.sharedModules = [ nixvimModules ];
perSystem = { system, config, lib, ... }: perSystem = { system, config, lib, ... }:
( (
let let
validConfigs = lib.filterAttrs validConfigs = lib.filterAttrs
(_: metadata: lib.elem system metadata.systems) cfg.configs; (_: metadata: lib.elem system metadata.systems)
cfg.configs;
nixvimConfigurations = nixvimConfigurations =
let let
@ -135,7 +136,7 @@ in
cfg.sharedModules cfg.sharedModules
++ cfg.standaloneConfigModules ++ cfg.standaloneConfigModules
++ metadata.modules ++ metadata.modules
++ [ { package = neovimPkg; } ]; ++ [{ package = neovimPkg; }];
}); });
in in
builtins.map mkNixvimConfig' neovimPackages; builtins.map mkNixvimConfig' neovimPackages;

View File

@ -205,8 +205,9 @@ in
TODO: Is `Type=notify` a good default? TODO: Is `Type=notify` a good default?
* `Service.Type=` is obviously not included since not all desktop * `Service.Type=` is obviously not included since not all desktop
components are the same either. Some of them could be a D-Bus service, components are the same either. Some of them could be a D-Bus service,
some of them are oneshots, etc. Not to mention, this is already implied some of them are oneshots, etc. Though, it might be better to have this
to be `Type=simple` by systemd anyways which is enough for most cases. as an explicit option set by the user instead of setting `Type=notify` as
a default.
TODO: A good balance for this value, probably? TODO: A good balance for this value, probably?
* `Service.OOMScoreAdjust=` have different values for different * `Service.OOMScoreAdjust=` have different values for different

View File

@ -173,12 +173,10 @@ in
environment. environment.
::: {.tip} ::: {.tip}
While you can make identifiers in any way, it is While you can make identifiers in any way, it is encouraged to stick to
encouraged to stick to a naming scheme. Here's two common ways to name a naming scheme. The recommended method is a reverse DNS-like scheme
a desktop environment. preferably with a domain name you own (e.g.,
`com.example.MoseyBranch`).
* Reverse DNS-like scheme (e.g., `com.example.MoseyBranch`).
* Kebab-case (e.g., `mosey-branch`).
::: :::
''; '';
default = { }; default = { };

View File

@ -3,7 +3,7 @@
let let
cfg = config.keyunmaps; cfg = config.keyunmaps;
keyunmapOption = { config, lib, ...}: { keyunmapOption = { config, lib, ... }: {
options = { options = {
key = lib.mkOption { key = lib.mkOption {
type = lib.types.str; type = lib.types.str;

View File

@ -9,7 +9,7 @@ in
package = helpers.mkPackageOption "firenvim" pkgs.vimPlugins.firenvim; package = helpers.mkPackageOption "firenvim" pkgs.vimPlugins.firenvim;
extraConfig = lib.mkOption { extraConfig = lib.mkOption {
type = with lib.types; attrsOf anything; type = with lib.types; attrsOf anything;
default = {}; default = { };
example = { example = {
globalSettings = { alt = "all"; }; globalSettings = { alt = "all"; };
localSettings = { localSettings = {