Skip to content

Commit

Permalink
fix: reconfigure modules to build successfully on demeter
Browse files Browse the repository at this point in the history
  • Loading branch information
youwen5 committed Dec 23, 2024
1 parent ce89f81 commit 180741e
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 63 deletions.
22 changes: 22 additions & 0 deletions hosts/demeter/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 1 addition & 12 deletions hosts/demeter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/linux/audio/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
Expand Down
4 changes: 2 additions & 2 deletions modules/linux/core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
Expand Down
13 changes: 10 additions & 3 deletions modules/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
};
}
6 changes: 3 additions & 3 deletions modules/linux/flatpak/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions modules/linux/gaming/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -44,7 +44,7 @@ in
mangojuice
];

liminalOS.programs.flatpaks.enable = true;
liminalOS.programs.flatpak.enable = true;

services.flatpak.packages = lib.mkIf cfg.roblox.enable [
{
Expand Down Expand Up @@ -82,7 +82,7 @@ in
};

users.users = forAllGamemodeUsers (username: {
${username}.extraGroups = [ "gamemode" ];
extraGroups = [ "gamemode" ];
});

services.logmein-hamachi.enable = cfg.utilities.hamachi.enable;
Expand Down
14 changes: 10 additions & 4 deletions modules/linux/misc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
...
}:
let
cfg = config.liminalOS.system.printing;
cfg = config.liminalOS.system;
inherit (lib) mkIf;
in
{
Expand All @@ -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";
};

Expand Down Expand Up @@ -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 ];
};
}
13 changes: 0 additions & 13 deletions modules/linux/stylix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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.'';
}
];
};
}
17 changes: 2 additions & 15 deletions modules/linux/wsl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,16 @@ 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 {
enable = true;
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.'';
}
];
}

0 comments on commit 180741e

Please sign in to comment.