diff --git a/hosts/MaxNixosLaptop/configuration.nix b/hosts/MaxNixosLaptop/configuration.nix index 7599fa9..b00bb4f 100644 --- a/hosts/MaxNixosLaptop/configuration.nix +++ b/hosts/MaxNixosLaptop/configuration.nix @@ -14,11 +14,11 @@ inputs.home-manager.nixosModules.default ]; - music.enable = true; - greetd.enable = true; - wifi.enable = true; - wifi.tray = true; - sway.enable = true; + myConfig = { + enable = true; + desktop = true; + laptop = true; + }; hardware.opengl = { enable = true; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index b88a1ff..bdad4fe 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,3 +1,26 @@ -{...}: { +{ + lib, + config, + ... +}: let + cfg = config.myConfig; +in { + options.myConfig = { + enable = lib.mkEnableOption "my custom config"; + desktop = lib.mkEnableOption "custom config with desktop support"; + laptop = lib.mkEnableOption "extra stuff for laptops like wifi"; + }; imports = [./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix]; + + config.myConfig = lib.mkIf cfg.enable { + rebuild.enable = true; + + greetd.enable = lib.mkIf cfg.desktop true; + sway.enable = lib.mkIf cfg.desktop true; + music.enable = lib.mkIf cfg.desktop true; + wifi.tray = lib.mkIf cfg.desktop true; + + sway.laptop = lib.mkIf cfg.laptop true; + wifi.enable = lib.mkIf cfg.laptop true; + }; } diff --git a/modules/nixos/greetd.nix b/modules/nixos/greetd.nix index a68854b..0df897b 100644 --- a/modules/nixos/greetd.nix +++ b/modules/nixos/greetd.nix @@ -4,15 +4,15 @@ pkgs, ... }: let - cfg = config.greetd; + cfg = config.myConfig.greetd; themeEnv = '' export XDG_DATA_DIRS="${pkgs.whitesur-gtk-theme}/share:$XDG_DATA_DIRS" export XDG_DATA_DIRS="${pkgs.whitesur-icon-theme}/share:$XDG_DATA_DIRS" export XDG_DATA_DIRS="${pkgs.whitesur-cursors}/share:$XDG_DATA_DIRS" ''; in { - options = { - greetd.enable = lib.mkEnableOption "greetd, a light weight greater deamon"; + options.myConfig.greetd = { + enable = lib.mkEnableOption "greetd, a light weight greater deamon"; }; config = lib.mkIf cfg.enable { diff --git a/modules/nixos/music.nix b/modules/nixos/music.nix index ab1e696..874571b 100644 --- a/modules/nixos/music.nix +++ b/modules/nixos/music.nix @@ -4,10 +4,10 @@ pkgs, ... }: let - cfg = config.music; + cfg = config.myConfig.music; in { - options = { - music.enable = lib.mkEnableOption "sound system"; + options.myConfig.music = { + enable = lib.mkEnableOption "sound system"; }; config = lib.mkIf cfg.enable { diff --git a/modules/nixos/rebuild.nix b/modules/nixos/rebuild.nix index a97bd24..8f73fba 100644 --- a/modules/nixos/rebuild.nix +++ b/modules/nixos/rebuild.nix @@ -1,4 +1,11 @@ -{pkgs, ...}: let +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.myConfig.rebuild; + # script for rebuilding nixos rebuild = pkgs.writeShellScriptBin "rebuild" '' # A rebuild script that commits on a successful build @@ -37,5 +44,11 @@ ${pkgs.libnotify}/bin/notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available ''; in { - environment.systemPackages = [rebuild]; + options.myConfig.rebuild = { + enable = lib.mkEnableOption "rebuild script with automatic git commits"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [rebuild]; + }; } diff --git a/modules/nixos/sops.nix b/modules/nixos/sops.nix index ee60200..e6cea39 100644 --- a/modules/nixos/sops.nix +++ b/modules/nixos/sops.nix @@ -3,10 +3,10 @@ config, ... }: let - cfg = config.secrets; + cfg = config.myConfig.sops; in { - options = { - secrets.enable = lib.mkEnableOption "sops, an secrets manager"; + options.myConfig.sops = { + enable = lib.mkEnableOption "sops, an secrets manager"; }; config = lib.mkIf cfg.enable { diff --git a/modules/nixos/sway.nix b/modules/nixos/sway.nix index 0a361cd..9f0048b 100644 --- a/modules/nixos/sway.nix +++ b/modules/nixos/sway.nix @@ -4,10 +4,11 @@ pkgs, ... }: let - cfg = config.sway; + cfg = config.myConfig.sway; in { - options = { - sway.enable = lib.mkEnableOption "sway"; + options.myConfig.sway = { + enable = lib.mkEnableOption "sway"; + laptop = lib.mkEnableOption "enable laptop things (backlight)"; }; config = lib.mkIf cfg.enable { @@ -38,7 +39,7 @@ in { # make brightness keys work users.users.max.extraGroups = ["video" "input"]; - programs.light.enable = true; + programs.light.enable = lib.mkIf cfg.laptop true; # make swaylock work security.pam.services.swaylock = {}; diff --git a/modules/nixos/wifi.nix b/modules/nixos/wifi.nix index 8b304fc..8004b6b 100644 --- a/modules/nixos/wifi.nix +++ b/modules/nixos/wifi.nix @@ -4,11 +4,11 @@ pkgs, ... }: let - cfg = config.wifi; + cfg = config.myConfig.wifi; in { - options = { - wifi.enable = lib.mkEnableOption "wifi"; - wifi.tray = lib.mkEnableOption "nm tray entry"; + options.myConfig.wifi = { + enable = lib.mkEnableOption "wifi"; + tray = lib.mkEnableOption "nm tray entry"; }; config = lib.mkIf cfg.enable { @@ -26,7 +26,7 @@ in { environment.systemPackages = lib.optional cfg.tray pkgs.nm-tray; - secrets.enable = true; + myConfig.sops.enable = true; sops = { secrets = { "home/ssid" = {