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; cfgfp = config.modules.flatpak;
in { in {
imports = [ 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 { config = mkIf cfg.enable {
assertions = [ assertions = [

View File

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

View File

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

View File

@ -18,7 +18,7 @@ in {
# Options is a vector of options this module defines # Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom" # 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 # 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) # 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 lib;
with mylib.modules;
{ {
enable = mkEnableOpt "Emacs module"; enable = mkEnableOpt "Emacs module";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
{ {
lib lib,
mylib
}: }:
with lib; with lib;
with mylib.modules;
{ {
enable = mkEnableOpt "Flatpak module"; enable = mkEnableOpt "Flatpak module";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them"; 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 { in {
imports = [ imports = [
# NOTE: I don't know if this is the right approach or if I should use config.modules.flatpak # 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: 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: SteamTinkerLaunch option
# TODO: Dolphin + SteamRomManager 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 { config = mkIf cfg.enable {
assertions = [ assertions = [

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let with mylib.modules; let
cfg = config.modules.hyprland; cfg = config.modules.hyprland;
in { in {
options.modules.hyprland = import ./options.nix { inherit lib; }; options.modules.hyprland = import ./options.nix { inherit lib mylib; };
config = let config = let
# Taken from https://github.com/Ruixi-rebirth/flakes/blob/main/modules/programs/wayland/waybar/workspace-patch.nix # 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 lib;
with mylib.modules;
{ {
enable = mkEnableOpt "Hyprland Window Manager + Compositor"; enable = mkEnableOpt "Hyprland Window Manager + Compositor";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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