From ce89f8149eed4fbe4b197727f65b79a4159032ef Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 23 Dec 2024 02:14:20 -0800 Subject: [PATCH] refactor: condense some small modules into misc --- modules/linux/default.nix | 3 +-- modules/linux/fonts/default.nix | 31 ------------------------ modules/linux/misc/default.nix | 42 ++++++++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 39 deletions(-) delete mode 100755 modules/linux/fonts/default.nix diff --git a/modules/linux/default.nix b/modules/linux/default.nix index c5df2b9..bd3468d 100644 --- a/modules/linux/default.nix +++ b/modules/linux/default.nix @@ -10,11 +10,10 @@ ./fonts ./gaming ./greeter - ./hamachi ./networking - ./spotifyd ./stylix ./wine ./wsl + ./misc ]; } diff --git a/modules/linux/fonts/default.nix b/modules/linux/fonts/default.nix deleted file mode 100755 index a2b53b6..0000000 --- a/modules/linux/fonts/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - 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/misc/default.nix b/modules/linux/misc/default.nix index 3780248..c0b03c4 100644 --- a/modules/linux/misc/default.nix +++ b/modules/linux/misc/default.nix @@ -1,25 +1,55 @@ -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.liminalOS.system.printing; + inherit (lib) mkIf; in { - options.liminalOS.system.printing = { - enable = lib.mkOption { + options.liminalOS.system = { + printing.enable = lib.mkOption { type = lib.types.bool; default = config.liminalOS.enable; description = '' Whether to set up default options for printing and printer discover on UNIX. ''; }; + fonts.enable = lib.mkEnableOption "fonts"; + distrobox.enable = lib.mkEnableOption "distrobox and podman"; }; - config = lib.mkIf cfg.enable { - services.printing.enable = true; + config = { + services.printing.enable = mkIf cfg.printing.enable true; - services.avahi = { + services.avahi = mkIf cfg.printing.enable { enable = true; nssmdns4 = true; openFirewall = true; }; + + fonts = mkIf cfg.fonts.enable { + 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 + ]); + }; + + virtualisation.podman = cfg.distrobox.enable { + enable = true; + dockerCompat = true; + }; + + environment.systemPackages = cfg.distrobox.enable [ pkgs.distrobox ]; }; }