diff --git a/hosts/callisto/configuration.nix b/hosts/callisto/configuration.nix index 8612a45..4894167 100755 --- a/hosts/callisto/configuration.nix +++ b/hosts/callisto/configuration.nix @@ -22,6 +22,10 @@ firewallPresets.vite = true; cloudflareNameservers.enable = true; }; + fonts.enable = true; + }; + theming = { + enable = true; }; }; diff --git a/hosts/callisto/default.nix b/hosts/callisto/default.nix index 50d9d12..97308b1 100644 --- a/hosts/callisto/default.nix +++ b/hosts/callisto/default.nix @@ -11,7 +11,6 @@ ../../modules/linux/networking ../../modules/linux/fonts ../../modules/linux/greeter - # ../../modules/linux/spotifyd ../../modules/linux/core ../../modules/linux/desktop-portal ../../modules/linux/stylix diff --git a/modules/linux/fonts/default.nix b/modules/linux/fonts/default.nix index 2ac31de..a2b53b6 100755 --- a/modules/linux/fonts/default.nix +++ b/modules/linux/fonts/default.nix @@ -1,19 +1,31 @@ -{ pkgs, ... }: { - fonts = { - enableDefaultPackages = true; - # fontconfig = { - # defaultFonts = { - # serif = [ "Noto Serif" ]; - # sansSerif = [ "Noto Sans" ]; - # }; - # }; - packages = with pkgs; [ - # noto-fonts - noto-fonts-cjk-sans - # noto-fonts-emoji - # (nerdfonts.override { fonts = [ "CascadiaCode" ]; }) - (google-fonts.override { fonts = [ "Lora" ]; }) - ]; + pkgs, + lib, + config, + ... +}: +let + cfg = config.liminalOS.system.fonts; +in +{ + options.liminalOS.system.fonts = { + enable = lib.mkEnableOption "fonts"; + }; + + config = lib.mkIf cfg.enable { + fonts = { + enableDefaultPackages = true; + packages = + with pkgs; + [ + noto-fonts-cjk-sans + (google-fonts.override { fonts = [ "Lora" ]; }) + ] + ++ (lib.optionals (!config.liminalOS.theming.enable) [ + noto-fonts + noto-fonts-emoji + nerd-fonts.caskaydia-cove + ]); + }; }; } diff --git a/modules/linux/stylix/default.nix b/modules/linux/stylix/default.nix index 0ecf1fc..80dc3ee 100644 --- a/modules/linux/stylix/default.nix +++ b/modules/linux/stylix/default.nix @@ -1,40 +1,68 @@ -{ inputs, pkgs, ... }: { + inputs, + pkgs, + config, + lib, + ... +}: +let + cfg = config.liminalOS.theming; +in +{ + options.liminalOS.theming = { + enable = lib.mkEnableOption "theming"; + stylixName = lib.mkOption { + type = lib.types.str; + default = "stylix"; + description = '' + Name of Stylix module defined in `inputs`. Defaults to `stylix`. You must define `inputs.stylix.url` in your `flake.nix` to enable this option + ''; + }; + }; + imports = [ inputs.stylix.nixosModules.stylix ]; - stylix = { - enable = true; - image = "${inputs.wallpapers}/aesthetic/afterglow_city_skyline_at_night.png"; - # image = "${inputs.wallpapers}/aesthetic/red_deadly_sun.jpg"; - # image = "${inputs.wallpapers}/aesthetic/afterglow_sand_dunes.jpg"; - base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine.yaml"; - polarity = "dark"; + config = lib.mkIf cfg.enable { + stylix = { + enable = true; + image = "${inputs.wallpapers}/aesthetic/afterglow_city_skyline_at_night.png"; + # image = "${inputs.wallpapers}/aesthetic/red_deadly_sun.jpg"; + # image = "${inputs.wallpapers}/aesthetic/afterglow_sand_dunes.jpg"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine.yaml"; + polarity = "dark"; - fonts = { - serif = { - name = "Noto Serif"; - package = pkgs.noto-fonts; + fonts = { + serif = { + name = "Noto Serif"; + package = pkgs.noto-fonts; + }; + sansSerif = { + name = "Noto Sans"; + package = pkgs.noto-fonts; + }; + emoji = { + name = "Noto Color Emoji"; + package = pkgs.noto-fonts-emoji; + }; + monospace = { + name = "CaskaydiaCove Nerd Font"; + package = pkgs.nerd-fonts.caskaydia-cove; + }; }; - sansSerif = { - name = "Noto Sans"; - package = pkgs.noto-fonts; - }; - emoji = { - name = "Noto Color Emoji"; - package = pkgs.noto-fonts-emoji; - }; - monospace = { - name = "CaskaydiaCove Nerd Font"; - package = pkgs.nerd-fonts.caskaydia-cove; + + cursor = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + size = 26; }; }; - - cursor = { - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Ice"; - size = 26; - }; + assertions = [ + { + assertion = builtins.hasAttr cfg.stylixName inputs; + message = ''You enabled theming but did not add a Stylix module to your flake inputs, or did not set `liminalOS.theming.stylixName` to the name of your Stylix input, if it is not `stylix`. Please set `inputs.stylix.url = "github:danth/stylix"` or set the stylixName option to the name of your stylix flake input.''; + } + ]; }; } diff --git a/modules/linux/wsl/default.nix b/modules/linux/wsl/default.nix index a3ac317..5711d86 100644 --- a/modules/linux/wsl/default.nix +++ b/modules/linux/wsl/default.nix @@ -8,17 +8,17 @@ let cfg = config.liminalOS.wsl; in { - imports = lib.mkIf cfg.enable [ - inputs.nixos-wsl.nixosModules.default + imports = [ + inputs.${cfg.wslName}.nixosModules.default ]; options = { - enable = lib.mkEnableOption "wsl"; - module = lib.mkOption { - type = lib.types.submodule; - default = inputs.nixos-wsl.nixosModules.default; + enable = lib.mkEnableOption "WSL"; + wslName = lib.mkOption { + type = lib.types.str; + default = "nixos-wsl"; description = '' - NixOS WSL module. Defaults to + Name of the NixOS WSL module in your flake inputs. You should define `inputs.nixos-wsl.url = "github:nixos-community/nixos-wsl", and set `liminalOS.wsl.wslName` if you did not call it `nixos-wsl`. ''; }; }; @@ -28,4 +28,10 @@ in defaultUser = config.liminalOS.username; useWindowsDriver = true; }; + assertions = [ + { + assertion = builtins.hasAttr cfg.wslName inputs; + message = ''You enabled WSL but did not add the WSL module to your flake inputs, or did not set `liminalOS.theming.wslName` to the name of your NixOS WSL input, if it is not `nixos-wsl`. Please set `inputs.nixos-wsl.url = "github:nix-community/nixos-wsl"` or set the wslName option to the name of your WSL flake input.''; + } + ]; }