Move options to seperate modules so they can be shared between home manager and nixos

This commit is contained in:
2024-06-17 17:43:14 -05:00
parent 8f66309008
commit 4910af0d2c
23 changed files with 394 additions and 291 deletions

47
modules/options/audio.nix Normal file
View File

@@ -0,0 +1,47 @@
{ lib
, pkgs
, config
, ...
}:
with lib; let
cfg = config.simmer.audio;
in
{
options.simmer.audio = {
pipewire = {
enable = mkOption {
description = "Enable pipewire";
type = types.bool;
default = false;
};
};
music = {
enable = mkOption {
description = "Install music player";
type = types.bool;
default = false;
};
};
tools = {
helvum = mkOption {
description = "Install helvum";
type = types.bool;
default = false;
};
easyeffects = mkOption {
description = "Install easyeffects";
type = types.bool;
default = false;
};
pavucontrol = mkOption {
description = "Install pavucontrol";
type = types.bool;
default = cfg.pipewire.enable;
};
};
};
}

View File

@@ -0,0 +1,55 @@
{ pkgs
, lib
, config
, ...
}:
with lib;
{
options.simmer.backup = {
enable = mkOption {
description = "Whether backups should be enabled";
type = types.bool;
default = false;
};
repo = mkOption {
description = "Which repository to backup to";
type = types.str;
};
paths = mkOption {
description = "Which paths to backup";
type = types.listOf types.str;
};
user = mkOption {
description = "Which user to run backup commands with";
type = types.str;
default = "root";
};
excludes = mkOption {
description = "Which directories to exclude";
type = types.listOf types.str;
default = [];
};
passphrase = mkOption {
description = "Path to file containing passphrase";
type = types.path;
};
key = mkOption {
description = "Path to file containing SSH Key";
type = types.path;
};
repeat = mkOption {
description = "How often to run the backup (hourly, daily, weekly)";
type = types.enum [ "hourly" "daily" "weekly" ];
};
};
}

View File

@@ -0,0 +1,41 @@
{ lib
, pkgs
, localPackages
, config
, ...
}:
with lib;
{
options.simmer.common = {
neovim.enable = mkOption {
description = "Whether to install neovim and set as default editor";
type = types.bool;
default = true;
};
nil.enable = mkOption {
description = "Whether to install nil";
type = types.bool;
default = true;
};
shell = mkOption {
description = "Default shell to use (fish)";
type = types.enum [ "fish" ];
default = "fish";
};
caps = mkOption {
description = "What key to bind caps lock to";
type = types.enum [ "ctrl-esc" "esc" "caps" ];
default = "ctrl-esc";
};
nixpkgs = mkOption {
description = "Which nixpkgs version to use";
type = types.any;
};
};
}

View File

@@ -0,0 +1,18 @@
{ lib
, pkgs
, config
, ...
}:
{
imports = [
./audio.nix
./backup.nix
./common.nix
./games.nix
./gui.nix
./networking.nix
./openssh.nix
./system.nix
];
}

55
modules/options/games.nix Normal file
View File

@@ -0,0 +1,55 @@
{ lib
, pkgs
, config
, localPackages
, ...
}:
with lib;
let
cfg = config.simmer.games;
in
{
options.simmer.games = {
enable = mkOption {
description = "Whether to enable games";
type = types.bool;
default = false;
};
protonup.enable = mkOption {
description = "Whether to install protonup";
type = types.bool;
default = true;
};
lutris.enable = mkOption {
description = "Whether to install lutris";
type = types.bool;
default = false;
};
steam.enable = mkOption {
description = "Whether to install steam";
type = types.bool;
default = true;
};
minecraft.enable = mkOption {
description = "Whether to install minecraft launcher";
type = types.bool;
default = false;
};
gamescope.enable = mkOption {
description = "Whether to install gamescope";
type = types.bool;
default = cfg.steam.enable;
};
discord.enable = mkOption {
description = "Whether to install discord";
type = types.bool;
default = true;
};
};
}

73
modules/options/gui.nix Normal file
View File

@@ -0,0 +1,73 @@
{ lib
, pkgs
, config
, localPackages
, ...
}:
with lib;
let
cfg = config.simmer.gui;
in
{
options.simmer.gui = {
enable = mkOption {
description = "Enable gui";
type = types.bool;
default = false;
};
sway = {
enable = mkOption {
description = "Install and configure sway window manager";
type = types.bool;
default = true;
};
desktop = mkOption {
description= "Use desktop configuration";
type = types.bool;
default = false;
};
};
terminal = mkOption {
description = "Which terminal to install (alacritty)";
type = types.enum [ pkgs.alacritty ];
default = pkgs.alacritty;
};
gtk = mkOption {
description = "Whether to configure gtk";
type = types.bool;
default = cfg.gui.enable;
};
protonmail = mkOption {
description = "Whether to install protonmail bridge and mail application";
type = types.bool;
default = false;
};
secrets = mkOption {
description = "Whether to enable secrets handling with gnomke-keyring";
type = types.bool;
default = cfg.protonmail;
};
matrix = mkOption {
description = "Whether to install a matrix client";
type = types.bool;
default = false;
};
monitors = mkOption {
description = "Attribute set of system monitors";
type = types.attrs;
default = {};
};
};
}

View File

@@ -0,0 +1,57 @@
{ lib
, pkgs
, localPackages
, config
, ...
}:
with lib; let
cfg = config.simmer.networking;
in
{
options.simmer.networking = {
firewall = {
enable = mkOption {
description = "Whether to enable firewall";
type = types.bool;
default = true;
};
allowedTCPPorts = mkOption {
description = "Which tcp ports to allow through firewall";
type = types.listOf types.int;
default = [];
};
allowedUDPPorts = mkOption {
description = "Which udp ports to allow through firewall";
type = types.listOf types.int;
default = [];
};
};
wireguard = {
enable = mkOption {
description = "Whether to install wireguard";
type = types.bool;
default = false;
};
};
networkmanager = {
enable = mkOption {
description = "Whether to enable network manager";
type = types.bool;
default = true;
};
};
nameservers = mkOption {
description = "Which nameservers to use";
type = types.listOf types.str;
default = [ "1.1.1.1" ];
};
};
}

View File

@@ -0,0 +1,31 @@
{ lib
, pkgs
, config
, ...
}:
with lib; let
cfg = config.simmer.openssh;
in
{
options.simmer.openssh = {
enable = mkOption {
description = "Whether to enable openssh server";
type = types.bool;
default = false;
};
port = mkOption {
description = "What port the server should run on";
type = types.int;
default = 22;
};
allow-password = mkOption {
description = "Whether the server should allow password authenitication" ;
type = types.bool;
default = false;
};
};
}

View File

@@ -0,0 +1,14 @@
{ lib
, pkgs
, config
, ...
}:
with lib; {
options.simmer.system = mkOption {
description = "System architecture";
type = types.str;
default = "x86_64-linux";
};
}