From bb84b44861c0ef6c082ed61d07013aba882b832f Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Sat, 10 Feb 2024 18:27:02 -0300 Subject: [PATCH] refactor: consistency between files --- hosts/desktop/.desktop/default.nix | 2 +- hosts/desktop/.desktop/scripts/desktop.nix | 10 +- hosts/desktop/default/configuration.nix | 20 +- hosts/desktop/default/home.nix | 13 +- hosts/desktop/shared-configuration.nix | 181 +++++++++-------- hosts/desktop/shared-home.nix | 184 +++++++++--------- hosts/desktop/work/configuration.nix | 20 +- hosts/desktop/work/home.nix | 47 ++--- modules/home-manager/packages/nixi.nix | 10 +- modules/home-manager/packages/nixx.nix | 10 +- modules/home-manager/programs/hyprland.nix | 24 +-- .../programs/librewolf/default.nix | 3 +- modules/home-manager/programs/starship.nix | 11 +- modules/home-manager/programs/tmux.nix | 19 +- modules/home-manager/programs/wezterm.nix | 3 +- modules/home-manager/programs/zsh.nix | 3 +- modules/home-manager/theme.nix | 14 +- modules/nixos/config/host.nix | 14 +- modules/nixos/systems/localization.nix | 26 ++- modules/nixos/systems/set-user.nix | 25 ++- 20 files changed, 330 insertions(+), 309 deletions(-) diff --git a/hosts/desktop/.desktop/default.nix b/hosts/desktop/.desktop/default.nix index 5d6523f..9844c6f 100644 --- a/hosts/desktop/.desktop/default.nix +++ b/hosts/desktop/.desktop/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ config, ... }: let cfg = config.desktop; diff --git a/hosts/desktop/.desktop/scripts/desktop.nix b/hosts/desktop/.desktop/scripts/desktop.nix index 315b619..e0df3b8 100644 --- a/hosts/desktop/.desktop/scripts/desktop.nix +++ b/hosts/desktop/.desktop/scripts/desktop.nix @@ -48,8 +48,12 @@ let ''; in { - home.packages = [ - desktop - ]; + imports = [ ]; + options.desktop.cli = { }; + config = { + home.packages = [ + desktop + ]; + }; } diff --git a/hosts/desktop/default/configuration.nix b/hosts/desktop/default/configuration.nix index e1a53d2..9147a3f 100644 --- a/hosts/desktop/default/configuration.nix +++ b/hosts/desktop/default/configuration.nix @@ -1,15 +1,17 @@ -{ config, pkgs, inputs, lib, ... }: +{ pkgs, ... }: { imports = [ ../shared-configuration.nix ]; - - set-user.users = [ - { - username = "guz"; - shell = pkgs.zsh; - home = import ./home.nix; - } - ]; + options.default.configuration = { }; + config = { + set-user.users = [ + { + username = "guz"; + shell = pkgs.zsh; + home = import ./home.nix; + } + ]; + }; } diff --git a/hosts/desktop/default/home.nix b/hosts/desktop/default/home.nix index 93ea4bb..b29970a 100644 --- a/hosts/desktop/default/home.nix +++ b/hosts/desktop/default/home.nix @@ -1,12 +1,15 @@ -{ config, pkgs, inputs, ... }: +{ ... }: { imports = [ ../shared-home.nix ]; - librewolf.profiles.guz.isDefault = true; + options.default.home = { }; + config = { + librewolf.profiles.guz.isDefault = true; - services.flatpak.packages = [ - "com.valvesoftware.Steam" - ]; + services.flatpak.packages = [ + "com.valvesoftware.Steam" + ]; + }; } diff --git a/hosts/desktop/shared-configuration.nix b/hosts/desktop/shared-configuration.nix index 5687f2d..7925e83 100644 --- a/hosts/desktop/shared-configuration.nix +++ b/hosts/desktop/shared-configuration.nix @@ -7,98 +7,97 @@ # Include the results of the hardware scan. ./hardware-configuration.nix ]; + options.shared.configuration = { }; + config = { - sops.defaultSopsFile = ../../secrets/desktop-secrets.yaml; - sops.defaultSopsFormat = "yaml"; + sops.defaultSopsFile = ../../secrets/desktop-secrets.yaml; + sops.defaultSopsFormat = "yaml"; - sops.secrets.lon = { - owner = config.users.users.guz.name; + sops.secrets.lon = { + owner = config.users.users.guz.name; + }; + sops.secrets.lat = { + owner = config.users.users.guz.name; + }; + + sops.age.keyFile = "/home/guz/.config/sops/age/keys.txt"; + + programs.hyprland = { + enable = true; + xwayland.enable = true; + package = inputs.hyprland.packages."${pkgs.system}".hyprland; + portalPackage = inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland; + }; + + xdg.portal.enable = true; + xdg.portal.extraPortals = with pkgs; [ + xdg-desktop-portal-gnome + ]; + + environment.sessionVariables = { + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + }; + + environment.systemPackages = with pkgs; [ + inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland + inputs.hyprland.packages."${pkgs.system}".hyprland + electron_28 + wlroots + kitty + rofi-wayland + dunst + libnotify + swww + sops + wl-clipboard + ]; + + hardware = { + opengl.enable = true; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + programs.zsh.enable = true; + # Define a user account. Don't forget to set a password with ‘passwd’. + + services.flatpak.enable = true; + + environment.pathsToLink = [ " /share/zsh " ]; + + services.tailscale = { + enable = true; + useRoutingFeatures = "client"; + }; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; }; - sops.secrets.lat = { - owner = config.users.users.guz.name; - }; - - sops.age.keyFile = "/home/guz/.config/sops/age/keys.txt"; - - programs.hyprland = { - enable = true; - xwayland.enable = true; - package = inputs.hyprland.packages."${pkgs.system}".hyprland; - portalPackage = inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland; - }; - - xdg.portal.enable = true; - xdg.portal.extraPortals = with pkgs; [ - xdg-desktop-portal-gnome - ]; - - environment.sessionVariables = { - WLR_NO_HARDWARE_CURSORS = "1"; - NIXOS_OZONE_WL = "1"; - }; - - environment.systemPackages = with pkgs; [ - inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland - inputs.hyprland.packages."${pkgs.system}".hyprland - electron_28 - wlroots - kitty - rofi-wayland - dunst - libnotify - swww - sops - wl-clipboard - ]; - - hardware = { - opengl.enable = true; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - programs.zsh.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - - services.flatpak.enable = true; - - environment.pathsToLink = [ " /share/zsh " ]; - - services.tailscale = { - enable = true; - useRoutingFeatures = "client"; - }; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - } - - diff --git a/hosts/desktop/shared-home.nix b/hosts/desktop/shared-home.nix index d637be5..5670b47 100644 --- a/hosts/desktop/shared-home.nix +++ b/hosts/desktop/shared-home.nix @@ -11,115 +11,113 @@ ./keybinds.nix ./.desktop ]; + options.shared.home = { }; + config = { - programs.bash = { - enable = true; - initExtra = '' - export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share" + programs.bash = { + enable = true; + initExtra = '' + export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share" - export GPG_TTY=$(tty) - ''; - }; + export GPG_TTY=$(tty) + ''; + }; - services.gnome-keyring.enable = true; + services.gnome-keyring.enable = true; - programs.gpg.enable = true; - services.gpg-agent = { - enable = true; - pinentryFlavor = "gnome3"; - }; + programs.gpg.enable = true; + services.gpg-agent = { + enable = true; + pinentryFlavor = "gnome3"; + }; - librewolf = { - enable = true; - profiles = { - guz = { - id = 0; - settings = { - "webgl.disabled" = false; - "browser.startup.homepage" = "https://search.brave.com"; - "privacy.clearOnShutdown.history" = false; - "privacy.clearOnShutdown.downloads" = false; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; - "privacy.clearOnShutdown.cookies" = false; + librewolf = { + enable = true; + profiles = { + guz = { + id = 0; + settings = { + "webgl.disabled" = false; + "browser.startup.homepage" = "https://search.brave.com"; + "privacy.clearOnShutdown.history" = false; + "privacy.clearOnShutdown.downloads" = false; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + "privacy.clearOnShutdown.cookies" = false; + }; + extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ + darkreader + canvasblocker + smart-referer + libredirect + tridactyl + ]; }; - extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ - darkreader - canvasblocker - smart-referer - libredirect - tridactyl - ]; }; }; - }; - services.flatpak.packages = [ - "nz.mega.MEGAsync" - "md.obsidian.Obsidian" - "com.bitwarden.desktop" - "org.prismlauncher.PrismLauncher" - "org.mozilla.Thunderbird" - "net.blockbench.Blockbench" - ]; - # services.flatpak.overrides = { }; + services.flatpak.packages = [ + "nz.mega.MEGAsync" + "md.obsidian.Obsidian" + "com.bitwarden.desktop" + "org.prismlauncher.PrismLauncher" + "org.mozilla.Thunderbird" + "net.blockbench.Blockbench" + ]; + # services.flatpak.overrides = { }; - nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowUnfreePredicate = _: true; - home.packages = with pkgs; [ - ## Programs - webcord-vencord - gimp - inkscape - pureref + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = _: true; + home.packages = with pkgs; [ + ## Programs + webcord-vencord + gimp + inkscape + pureref - # (pkgs.writeShellScriptBin "my-hello" '' - # echo "Hello, ${config.home.username}!" - # '') + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') - ## Fonts - fira-code - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - ]; + ## Fonts + fira-code + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; - fonts.fontconfig.enable = true; + fonts.fontconfig.enable = true; - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - home.file = { - # # Building this configuration will create a copy of 'dotfiles/screenrc' in - # # the Nix store. Activating the configuration will then make '~/.screenrc' a - # # symlink to the Nix store copy. - # ".screenrc".source = dotfiles/screenrc; + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; - }; + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; - # Home Manager can also manage your environment variables through - # 'home.sessionVariables'. If you don't want to manage your shell through Home - # Manager then you have to manually source 'hm-session-vars.sh' located at - # either - # - # ~/.nix-profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # /etc/profiles/per-user/guz/etc/profile.d/hm-session-vars.sh - # - home.sessionVariables = { - # EDITOR = "emacs"; + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/guz/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "neovim"; + }; }; } - - - - - diff --git a/hosts/desktop/work/configuration.nix b/hosts/desktop/work/configuration.nix index e1a53d2..9209467 100644 --- a/hosts/desktop/work/configuration.nix +++ b/hosts/desktop/work/configuration.nix @@ -1,15 +1,17 @@ -{ config, pkgs, inputs, lib, ... }: +{ pkgs, ... }: { imports = [ ../shared-configuration.nix ]; - - set-user.users = [ - { - username = "guz"; - shell = pkgs.zsh; - home = import ./home.nix; - } - ]; + options.work.configuration = { }; + config = { + set-user.users = [ + { + username = "guz"; + shell = pkgs.zsh; + home = import ./home.nix; + } + ]; + }; } diff --git a/hosts/desktop/work/home.nix b/hosts/desktop/work/home.nix index bb8592d..5a9ff2a 100644 --- a/hosts/desktop/work/home.nix +++ b/hosts/desktop/work/home.nix @@ -1,31 +1,32 @@ -{ config, pkgs, inputs, ... }: +{ inputs, ... }: { imports = [ ../shared-home.nix ]; - - theme.accent = "94e2d5"; - wm.wallpaper = ../../../static/guz-wallpaper-work.png; - librewolf.profiles.work = { - isDefault = true; - id = 1; - settings = { - "webgl.disabled" = false; - "browser.startup.homepage" = "https://github.com"; - "privacy.clearOnShutdown.history" = false; - "privacy.clearOnShutdown.downloads" = false; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; - "privacy.clearOnShutdown.cookies" = false; + options.work.home = { }; + config = { + theme.accent = "94e2d5"; + wm.wallpaper = ../../../static/guz-wallpaper-work.png; + librewolf.profiles.work = { + isDefault = true; + id = 1; + settings = { + "webgl.disabled" = false; + "browser.startup.homepage" = "https://github.com"; + "privacy.clearOnShutdown.history" = false; + "privacy.clearOnShutdown.downloads" = false; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + "privacy.clearOnShutdown.cookies" = false; + }; + extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ + darkreader + canvasblocker + smart-referer + github-file-icons + libredirect + tridactyl + ]; }; - extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ - darkreader - canvasblocker - smart-referer - github-file-icons - libredirect - tridactyl - ]; }; - } diff --git a/modules/home-manager/packages/nixi.nix b/modules/home-manager/packages/nixi.nix index 5a4f251..595ff51 100644 --- a/modules/home-manager/packages/nixi.nix +++ b/modules/home-manager/packages/nixi.nix @@ -11,8 +11,12 @@ let ''; in { - home.packages = [ - nixi - ]; + imports = [ ]; + options.nixi = { }; + config = { + home.packages = [ + nixi + ]; + }; } diff --git a/modules/home-manager/packages/nixx.nix b/modules/home-manager/packages/nixx.nix index 767d446..e0554b0 100644 --- a/modules/home-manager/packages/nixx.nix +++ b/modules/home-manager/packages/nixx.nix @@ -11,8 +11,12 @@ let ''; in { - home.packages = [ - nixx - ]; + imports = [ ]; + options.nixx = { }; + config = { + home.packages = [ + nixx + ]; + }; } diff --git a/modules/home-manager/programs/hyprland.nix b/modules/home-manager/programs/hyprland.nix index 56de00c..eeb14d0 100644 --- a/modules/home-manager/programs/hyprland.nix +++ b/modules/home-manager/programs/hyprland.nix @@ -1,21 +1,23 @@ -{ config, lib, pkgs, inputs, ... }: +{ config, inputs, lib, pkgs, ... }: let cfg = config.hyprland; in { + imports = [ ]; options.hyprland = with lib; with lib.types; { enable = mkEnableOption ""; monitors = mkOption { default = [ ]; - # TODO: Fix types - /* type = lib.types.listOf { - name = lib.types.str; - resolution = lib.types.str; - hz = lib.types.nullOr lib.types.int; - offset = lib.types.nullOr lib.types.str; - scale = lib.types.nullOr lib.types.int; - }; */ + type = listOf (submodule ({ ... }: { + options = { + name = str; + resolution = str; + hz = nullOr int; + offset = nullOr str; + scale = nullOr int; + }; + })); }; exec = mkOption { default = [ ]; @@ -28,7 +30,7 @@ in windowRules = mkOption { default = { }; description = "window = [ \"rule\" ]"; - # type = attrsOf listOf str; + type = attrsOf (listOf str); }; input = { keyboard.layout = mkOption { @@ -105,7 +107,7 @@ in monitor = nullOr str; default = nullOr bool; extraRules = nullOr str; - }; */ + }; */ }; binds = { mod = mkOption { diff --git a/modules/home-manager/programs/librewolf/default.nix b/modules/home-manager/programs/librewolf/default.nix index 721068f..fa91ef2 100644 --- a/modules/home-manager/programs/librewolf/default.nix +++ b/modules/home-manager/programs/librewolf/default.nix @@ -31,7 +31,7 @@ SOFTWARE. */ -{ inputs, config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: with lib; let @@ -183,6 +183,7 @@ let ); in { + imports = [ ]; options.librewolf = with lib; with lib.types; { enable = mkEnableOption "Enable module"; overrides = mkOption { diff --git a/modules/home-manager/programs/starship.nix b/modules/home-manager/programs/starship.nix index 78da04b..da0ab50 100644 --- a/modules/home-manager/programs/starship.nix +++ b/modules/home-manager/programs/starship.nix @@ -1,13 +1,14 @@ -{ inputs, config, lib, pkgs, ... }: +{ config, lib, ... }: let cfg = config.starship; in { - options.starship = { - enable = lib.mkEnableOption "Enable module"; - enableZsh = lib.mkEnableOption "Enable Zsh Integration"; - enableBash = lib.mkEnableOption "Enable Bash Integration"; + imports = [ ]; + options.starship = with lib; with lib.types; { + enable = mkEnableOption "Enable module"; + enableZsh = mkEnableOption "Enable Zsh Integration"; + enableBash = mkEnableOption "Enable Bash Integration"; }; config = lib.mkIf cfg.enable { programs.starship.enable = true; diff --git a/modules/home-manager/programs/tmux.nix b/modules/home-manager/programs/tmux.nix index 14e76f8..ebcbcc5 100644 --- a/modules/home-manager/programs/tmux.nix +++ b/modules/home-manager/programs/tmux.nix @@ -1,21 +1,22 @@ -{ inputs, config, pkgs, lib, ... }: +{ config, inputs, lib, pkgs, ... }: let cfg = config.tmux; in { - options.tmux = { - enable = lib.mkEnableOption "Enable Tmux module"; - baseIndex = lib.mkOption { - type = lib.types.ints.unsigned; + imports = [ ]; + options.tmux = with lib; with lib.types; { + enable = mkEnableOption "Enable Tmux module"; + baseIndex = mkOption { + type = ints.unsigned; default = 1; }; - prefix = lib.mkOption { - type = lib.types.str; + prefix = mkOption { + type = str; default = "C-Space"; }; - shell = lib.mkOption { - type = lib.types.str; + shell = mkOption { + type = str; default = "\${pkgs.bash}/bin/bash"; }; }; diff --git a/modules/home-manager/programs/wezterm.nix b/modules/home-manager/programs/wezterm.nix index fa5d3e1..f1b4940 100644 --- a/modules/home-manager/programs/wezterm.nix +++ b/modules/home-manager/programs/wezterm.nix @@ -1,9 +1,10 @@ -{ inputs, pkgs, lib, config, ... }: +{ config, lib, ... }: let cfg = config.wezterm; in { + imports = [ ]; options.wezterm = with lib; with lib.types; { enable = mkEnableOption "Enable Wezterm"; integration = { diff --git a/modules/home-manager/programs/zsh.nix b/modules/home-manager/programs/zsh.nix index 9733037..fe53e46 100644 --- a/modules/home-manager/programs/zsh.nix +++ b/modules/home-manager/programs/zsh.nix @@ -1,9 +1,10 @@ -{ inputs, config, pkgs, lib, ... }: +{ config, lib, ... }: let cfg = config.zsh; in { + imports = [ ]; options.zsh = with lib; with lib.types; { enable = mkEnableOption "Enable Zsh shell"; plugins = { diff --git a/modules/home-manager/theme.nix b/modules/home-manager/theme.nix index b9009f4..2c4a433 100644 --- a/modules/home-manager/theme.nix +++ b/modules/home-manager/theme.nix @@ -7,19 +7,19 @@ in imports = [ inputs.nix-colors.homeManagerModules.default ]; - options.theme = { - accent = lib.mkOption { - type = lib.types.str; + options.theme = with lib; with lib.types; { + accent = mkOption { + type = str; default = "cdd6f4"; description = "The accent color of Frappuccino"; }; - accentBase = lib.mkOption { - type = lib.types.str; + accentBase = mkOption { + type = str; default = "magenta"; description = "The base name for the accent color to be used in the terminal"; }; - scheme = lib.mkOption { - type = lib.types.path; + scheme = mkOption { + type = path; default = ../../themes/frappuccino.yaml; }; }; diff --git a/modules/nixos/config/host.nix b/modules/nixos/config/host.nix index 1510c64..db992f6 100644 --- a/modules/nixos/config/host.nix +++ b/modules/nixos/config/host.nix @@ -10,22 +10,22 @@ in inputs.sops-nix.nixosModules.sops ../systems/localization.nix ]; - options.host = { + options.host = with lib; with lib.types; { networking = { - hostName = lib.mkOption { + hostName = mkOption { default = "nixos"; - type = lib.types.str; + type = str; description = "Define the host's network name"; }; - wireless.enable = lib.mkOption { + wireless.enable = mkOption { default = false; - type = lib.types.bool; + type = bool; description = "Enables wireless support"; }; }; time = { - timeZone = lib.mkOption { - type = lib.types.str; + timeZone = mkOption { + type = str; description = "Sets host's time zone"; }; }; diff --git a/modules/nixos/systems/localization.nix b/modules/nixos/systems/localization.nix index 4cfd6df..ab97362 100644 --- a/modules/nixos/systems/localization.nix +++ b/modules/nixos/systems/localization.nix @@ -4,13 +4,13 @@ let cfg = config.localization; in { - options.localization = { - locale = lib.mkOption { + options.localization = with lib; with lib.types; { + locale = mkOption { default = "en_US.UTF-8"; - type = lib.types.str; + type = str; description = "Sets default locale of the host"; }; - extraLocales = lib.mkOption { + extraLocales = mkOption { default = rec { LC_ADDRESS = "pt_BR.UTF-8"; LC_IDENTIFICATION = LC_ADDRESS; @@ -24,24 +24,22 @@ in }; description = "Extra localization settings"; }; - - keymap.layout = lib.mkOption { + keymap.layout = mkOption { default = "br"; - type = lib.types.str; + type = str; }; - keymap.variant = lib.mkOption { + keymap.variant = mkOption { default = ""; - type = lib.types.str; + type = str; }; - keymap.console = lib.mkOption { + keymap.console = mkOption { default = "br-abnt2"; - type = lib.types.str; + type = str; }; - time = { - zone = lib.mkOption { + zone = mkOption { default = "America/Sao_Paulo"; - type = lib.types.str; + type = str; }; }; }; diff --git a/modules/nixos/systems/set-user.nix b/modules/nixos/systems/set-user.nix index c5d115a..9c6f20f 100644 --- a/modules/nixos/systems/set-user.nix +++ b/modules/nixos/systems/set-user.nix @@ -4,20 +4,19 @@ let cfg = config.set-user; in { - options.set-user = { - users = lib.mkOption { + options.set-user = with lib; with lib.types; { + users = mkOption { default = [ ]; - # TODO: Fix types - /* type = lib.types.listOf { - username = lib.types.str; - description = lib.types.str; - normalUser = lib.types.bool; - shell = lib.types.package; - packages = lib.types.pkgs; - extraGroups = lib.types.listOf lib.types.str; - home = lib.types.anything; - flatpak = lib.types.bool; - }; */ + type = listOf (submodule ({ ... }: { + username = str; + description = str; + normalUser = bool; + shell = package; + packages = types.pkgs; + extraGroups = listOf str; + home = anything; + flatpak = bool; + })); }; }; config =