From 180741ec71f7ddc0268fc724d921290521ec0a57 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 23 Dec 2024 04:29:01 -0800 Subject: [PATCH] fix: reconfigure modules to build successfully on demeter --- hosts/demeter/configuration.nix | 22 ++++++++++++++++++++++ hosts/demeter/default.nix | 13 +------------ modules/default.nix | 7 ------- modules/linux/audio/default.nix | 2 +- modules/linux/core/default.nix | 4 ++-- modules/linux/default.nix | 13 ++++++++++--- modules/linux/flatpak/default.nix | 6 +++--- modules/linux/gaming/default.nix | 6 +++--- modules/linux/misc/default.nix | 14 ++++++++++---- modules/linux/stylix/default.nix | 13 ------------- modules/linux/wsl/default.nix | 17 ++--------------- 11 files changed, 54 insertions(+), 63 deletions(-) diff --git a/hosts/demeter/configuration.nix b/hosts/demeter/configuration.nix index 6267d75..d65d427 100755 --- a/hosts/demeter/configuration.nix +++ b/hosts/demeter/configuration.nix @@ -14,6 +14,28 @@ ./hardware-configuration.nix ]; + liminalOS = { + system = { + audio.prod.enable = true; + networking = { + enable = true; + firewallPresets.vite = true; + cloudflareNameservers.enable = true; + }; + }; + theming.enable = true; + desktop.enable = true; + extras.gaming = { + enable = true; + roblox.enable = true; + utilities.gamemode = { + enable = true; + gamemodeUsers = [ "youwen" ]; + }; + }; + programs.flatpak.enable = true; + }; + # Bootloader. boot.loader = { efi.canTouchEfiVariables = true; diff --git a/hosts/demeter/default.nix b/hosts/demeter/default.nix index 9414274..93b71aa 100644 --- a/hosts/demeter/default.nix +++ b/hosts/demeter/default.nix @@ -6,18 +6,7 @@ imports = [ ./configuration.nix - ../../modules/linux/gaming - ../../modules/linux/audio - ../../modules/linux/networking - ../../modules/linux/fonts - ../../modules/linux/greeter - ../../modules/linux/core - ../../modules/linux/hamachi - ../../modules/linux/desktop-portal - ../../modules/linux/audio-prod - ../../modules/linux/stylix - ../../modules/linux/wine - ../../modules/linux/flatpak + ../../modules/linux ../../overlays { home-manager.useGlobalPkgs = true; diff --git a/modules/default.nix b/modules/default.nix index 7a93bd2..0f342f8 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -12,13 +12,6 @@ in ./linux ]; options.liminalOS = { - linux.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Whether to enable liminalOS's default modules and options for Linux. - ''; - }; darwin.enable = lib.mkOption { type = lib.types.bool; default = false; diff --git a/modules/linux/audio/default.nix b/modules/linux/audio/default.nix index 07c728a..a1e1ab6 100755 --- a/modules/linux/audio/default.nix +++ b/modules/linux/audio/default.nix @@ -5,7 +5,7 @@ in { options.liminalOS.system.audio.enable = lib.mkOption { type = lib.types.bool; - default = config.liminalOS.linux.enable; + default = config.liminalOS.enable; description = '' Whether to set up PipeWire and default audio utilities. ''; diff --git a/modules/linux/core/default.nix b/modules/linux/core/default.nix index fe4f2eb..9901df7 100644 --- a/modules/linux/core/default.nix +++ b/modules/linux/core/default.nix @@ -46,8 +46,8 @@ in ''; }; flakeLocation = lib.mkOption { - type = lib.types.str; - default = ""; + type = lib.types.nullOr lib.types.path; + default = null; description = '' Absolute filepath location of the NixOS system configuration flake. ''; diff --git a/modules/linux/default.nix b/modules/linux/default.nix index bd3468d..a98aadc 100644 --- a/modules/linux/default.nix +++ b/modules/linux/default.nix @@ -4,16 +4,23 @@ ./audio ./audio-prod ./core - ./desktop-portal + ./desktop-environment ./distrobox ./flatpak - ./fonts ./gaming ./greeter + ./misc ./networking ./stylix ./wine ./wsl - ./misc ]; + + options.liminalOS.enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Whether to enable liminalOS's default modules and options for Linux. + ''; + }; } diff --git a/modules/linux/flatpak/default.nix b/modules/linux/flatpak/default.nix index 29d5851..417d9f4 100644 --- a/modules/linux/flatpak/default.nix +++ b/modules/linux/flatpak/default.nix @@ -9,14 +9,14 @@ ... }: let - cfg = config.liminalOS.programs.flatpaks; + cfg = config.liminalOS.programs.flatpak; in { imports = [ - inputs.${cfg.moduleName}.nixosModules.nix-flatpak + inputs.nix-flatpak.nixosModules.nix-flatpak ]; - options.liminalOS.programs.flatpaks = { + options.liminalOS.programs.flatpak = { enable = lib.mkOption { type = lib.types.bool; default = false; diff --git a/modules/linux/gaming/default.nix b/modules/linux/gaming/default.nix index e3705a7..8747352 100755 --- a/modules/linux/gaming/default.nix +++ b/modules/linux/gaming/default.nix @@ -15,7 +15,7 @@ in gamemode = { enable = lib.mkEnableOption "gamemode"; gamemodeUsers = lib.mkOption { - type = lib.types.listOf lib.types.string; + type = lib.types.listOf lib.types.str; default = [ ]; description = '' List of users to add to the gamemode group. Gamemode will likely not work unless you add your user to the group! @@ -44,7 +44,7 @@ in mangojuice ]; - liminalOS.programs.flatpaks.enable = true; + liminalOS.programs.flatpak.enable = true; services.flatpak.packages = lib.mkIf cfg.roblox.enable [ { @@ -82,7 +82,7 @@ in }; users.users = forAllGamemodeUsers (username: { - ${username}.extraGroups = [ "gamemode" ]; + extraGroups = [ "gamemode" ]; }); services.logmein-hamachi.enable = cfg.utilities.hamachi.enable; diff --git a/modules/linux/misc/default.nix b/modules/linux/misc/default.nix index c0b03c4..8b9f44c 100644 --- a/modules/linux/misc/default.nix +++ b/modules/linux/misc/default.nix @@ -5,7 +5,7 @@ ... }: let - cfg = config.liminalOS.system.printing; + cfg = config.liminalOS.system; inherit (lib) mkIf; in { @@ -17,7 +17,13 @@ in Whether to set up default options for printing and printer discover on UNIX. ''; }; - fonts.enable = lib.mkEnableOption "fonts"; + fonts.enable = lib.mkOption { + type = lib.types.bool; + default = config.liminalOS.enable; + description = '' + Whether to set up some nice default fonts, including a Nerd Font, Noto Fonts, and CJK. + ''; + }; distrobox.enable = lib.mkEnableOption "distrobox and podman"; }; @@ -45,11 +51,11 @@ in ]); }; - virtualisation.podman = cfg.distrobox.enable { + virtualisation.podman = mkIf cfg.distrobox.enable { enable = true; dockerCompat = true; }; - environment.systemPackages = cfg.distrobox.enable [ pkgs.distrobox ]; + environment.systemPackages = mkIf cfg.distrobox.enable [ pkgs.distrobox ]; }; } diff --git a/modules/linux/stylix/default.nix b/modules/linux/stylix/default.nix index 80dc3ee..3ca67bd 100644 --- a/modules/linux/stylix/default.nix +++ b/modules/linux/stylix/default.nix @@ -11,13 +11,6 @@ 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 = [ @@ -58,11 +51,5 @@ in 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 5711d86..d2f4416 100644 --- a/modules/linux/wsl/default.nix +++ b/modules/linux/wsl/default.nix @@ -9,18 +9,11 @@ let in { imports = [ - inputs.${cfg.wslName}.nixosModules.default + inputs.nixos-wsl.nixosModules.default ]; - options = { + options.liminalOS.wsl = { enable = lib.mkEnableOption "WSL"; - wslName = lib.mkOption { - type = lib.types.str; - default = "nixos-wsl"; - description = '' - 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`. - ''; - }; }; config.wsl = lib.mkIf cfg.enable { @@ -28,10 +21,4 @@ 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.''; - } - ]; }