1

Refactor home modules into config + options

This commit is contained in:
2023-04-26 12:42:48 +02:00
parent 156f87c077
commit 1b83c0131f
31 changed files with 76 additions and 46 deletions

View File

@ -12,10 +12,10 @@ with mylib.modules; let
cfgfp = config.modules.flatpak;
in {
imports = [
../flatpak.nix
../flatpak
];
options.modules.audio = import ./options.nix { inherit lib; };
options.modules.audio = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
assertions = [

View File

@ -1,7 +1,9 @@
{
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Audio module";

View File

@ -8,20 +8,20 @@
...
}: {
imports = [
./audio/default.nix
./emacs/default.nix
./email/default.nix
./firefox/default.nix
./fish/default.nix
./flatpak/default.nix
./gaming/default.nix
./gnome/default.nix
./hyprland/default.nix
./kitty/default.nix
./misc/default.nix
./neovim/default.nix
./nextcloud/default.nix
./plasma/default.nix
./ranger/default.nix
./audio
./emacs
./email
./firefox
./fish
./flatpak
./gaming
./gnome
./hyprland
./kitty
./misc
./neovim
./nextcloud
./plasma
./ranger
];
}

View File

@ -18,7 +18,7 @@ in {
# Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom"
options.modules.emacs = import ./options.nix { inherit lib; };
options.modules.emacs = import ./options.nix { inherit lib mylib; };
# Config is the merged set of all module configurations
# Here we define what happens to the config if the module is active (but only if the module is active)

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Emacs module";

View File

@ -14,7 +14,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.email;
in {
options.modules.email = import ./options.nix { inherit lib; };
options.modules.email = import ./options.nix { inherit lib mylib; };
# TODO: Add Maildir to nextcloud sync
config = mkIf cfg.enable {

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";

View File

@ -12,7 +12,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.firefox;
in {
options.modules.firefox = import ./options.nix { inherit lib; };
options.modules.firefox = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
home.packages = with pkgs;

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Firefox";
wayland = mkBoolOpt false "Enable firefox wayland support";

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.fish;
in {
options.modules.fish = import ./options.nix { inherit lib; };
options.modules.fish = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
programs.fish = {

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Fish";
}

View File

@ -14,7 +14,7 @@ with mylib.modules;
let
cfg = config.modules.flatpak;
in {
options.modules.flatpak = import ./options.nix { inherit lib; };
options.modules.flatpak = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
assertions = [

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Flatpak module";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them";

View File

@ -12,14 +12,14 @@ with mylib.modules; let
in {
imports = [
# NOTE: I don't know if this is the right approach or if I should use config.modules.flatpak
./flatpak.nix
../flatpak
];
# TODO: Enable flatpak MangoHud, there are multiple versions, Steam.Utility.MangoHud works but can't be configured (in ~/.config/MangoHud), other versions don't even work (need to figure that out as Steam.Utility.MangoHud is EOL...)
# TODO: SteamTinkerLaunch option
# TODO: Dolphin + SteamRomManager option
options.modules.gaming = import ./options.nix { inherit lib; };
options.modules.gaming = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
assertions = [

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Gaming module";

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.gnome;
in {
options.modules.gnome = import ./options.nix { inherit lib; };
options.modules.gnome = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
assertions = [

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Gnome Desktop";
# TODO: Add option for dash-to-dock

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.hyprland;
in {
options.modules.hyprland = import ./options.nix { inherit lib; };
options.modules.hyprland = import ./options.nix { inherit lib mylib; };
config = let
# Taken from https://github.com/Ruixi-rebirth/flakes/blob/main/modules/programs/wayland/waybar/workspace-patch.nix

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Hyprland Window Manager + Compositor";

View File

@ -11,7 +11,7 @@ with mylib.modules; let
cfg = config.modules.kitty;
# cfgnv = config.modules.neovim;
in {
options.modules.kitty = import ./options.nix { inherit lib; };
options.modules.kitty = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
programs.kitty = {

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Kitty";
}

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.misc;
in {
options.modules.misc = import ./options.nix { inherit lib; };
options.modules.misc = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
home.packages = with pkgs;

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Misc module";

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.neovim;
in {
options.modules.neovim = import ./options.nix { inherit lib; };
options.modules.neovim = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
# TODO: Configure by option

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "NeoVim";
alias = mkBoolOpt false "Link nvim to vim/vi";

View File

@ -13,7 +13,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.nextcloud;
in {
options.modules.nextcloud = import ./options.nix { inherit lib; };
options.modules.nextcloud = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
assertions = [

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Nextcloud Client";
autostart = mkBoolOpt false "Autostart the Nextcloud client (systemd)";

View File

@ -11,7 +11,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.plasma;
in {
options.modules.plasma = import ./options.nix { inherit lib; };
options.modules.plasma = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
assertions = [

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Plasma Desktop";
}

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.ranger;
in {
options.modules.ranger = import ./options.nix { inherit lib; };
options.modules.ranger = import ./options.nix { inherit lib mylib; };
config = mkIf cfg.enable {
home.packages = with pkgs;

View File

@ -1,7 +1,9 @@
{
lib
lib,
mylib
}:
with lib;
with mylib.modules;
{
enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview";