Simplify use of lib

This commit is contained in:
Oliver Davies 2024-12-10 21:40:33 +00:00
parent 3d4bca0ada
commit 0f90bcfd70
25 changed files with 124 additions and 74 deletions

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.cli.bluetuith.enable = lib.mkEnableOption "Enable bluetuith";
config = lib.mkIf config.features.cli.bluetuith.enable { {
options.features.cli.bluetuith.enable = mkEnableOption "Enable bluetuith";
config = mkIf config.features.cli.bluetuith.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
bluetuith bluetuith
]; ];

View file

@ -1,9 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
{ with lib;
options.features.cli.direnv.enable = lib.mkEnableOption "Enable direnv";
config = lib.mkIf config.features.cli.direnv.enable { {
options.features.cli.direnv.enable = mkEnableOption "Enable direnv";
config = mkIf config.features.cli.direnv.enable {
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;

View file

@ -6,10 +6,12 @@
... ...
}: }:
{ with lib;
options.features.cli.neovim.enable = lib.mkEnableOption "Enable neovim";
config = lib.mkIf config.features.cli.neovim.enable { {
options.features.cli.neovim.enable = mkEnableOption "Enable neovim";
config = mkIf config.features.cli.neovim.enable {
programs.neovim = { programs.neovim = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.cli.tmux-sessionizer.enable = lib.mkEnableOption "Enable tmux-sessionizer";
config = lib.mkIf config.features.cli.tmux-sessionizer.enable { {
options.features.cli.tmux-sessionizer.enable = mkEnableOption "Enable tmux-sessionizer";
config = mkIf config.features.cli.tmux-sessionizer.enable {
home.packages = with pkgs; [ custom-tmux-sessionizer ]; home.packages = with pkgs; [ custom-tmux-sessionizer ];
home.file.".tmux-sessionizer".source = "${ home.file.".tmux-sessionizer".source = "${

View file

@ -5,13 +5,15 @@
... ...
}: }:
with lib;
let let
inherit (pkgs) tmuxPlugins; inherit (pkgs) tmuxPlugins;
in in
{ {
options.features.cli.tmux.enable = lib.mkEnableOption "Enable tmux"; options.features.cli.tmux.enable = mkEnableOption "Enable tmux";
config = lib.mkIf config.features.cli.tmux.enable { config = mkIf config.features.cli.tmux.enable {
programs.tmux = { programs.tmux = {
enable = true; enable = true;

View file

@ -4,10 +4,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.alacritty.enable = lib.mkEnableOption "Enable Alacritty";
config = lib.mkIf config.features.desktop.alacritty.enable { {
options.features.desktop.alacritty.enable = mkEnableOption "Enable Alacritty";
config = mkIf config.features.desktop.alacritty.enable {
programs.alacritty = { programs.alacritty = {
enable = true; enable = true;

View file

@ -1,9 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
{ with lib;
options.features.desktop.copyq.enable = lib.mkEnableOption "Enable copyq";
config = lib.mkIf config.features.desktop.copyq.enable { {
options.features.desktop.copyq.enable = mkEnableOption "Enable copyq";
config = mkIf config.features.desktop.copyq.enable {
services.copyq.enable = true; services.copyq.enable = true;
}; };
} }

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.discord.enable = lib.mkEnableOption "Enable Discord";
config = lib.mkIf config.features.desktop.discord.enable { {
options.features.desktop.discord.enable = mkEnableOption "Enable Discord";
config = mkIf config.features.desktop.discord.enable {
home.packages = with pkgs; [ discord ]; home.packages = with pkgs; [ discord ];
}; };
} }

View file

@ -1,9 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
{ with lib;
options.features.desktop.espanso.enable = lib.mkEnableOption "Enable espanso";
config = lib.mkIf config.features.desktop.espanso.enable { {
options.features.desktop.espanso.enable = mkEnableOption "Enable espanso";
config = mkIf config.features.desktop.espanso.enable {
services.espanso = { services.espanso = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.flameshot.enable = lib.mkEnableOption "Enable flameshot";
config = lib.mkIf config.features.desktop.flameshot.enable { {
options.features.desktop.flameshot.enable = mkEnableOption "Enable flameshot";
config = mkIf config.features.desktop.flameshot.enable {
services.flameshot = { services.flameshot = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.gtk.enable = lib.mkEnableOption "Enable gtk";
config = lib.mkIf config.features.desktop.gtk.enable { {
options.features.desktop.gtk.enable = mkEnableOption "Enable gtk";
config = mkIf config.features.desktop.gtk.enable {
gtk = { gtk = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.media.gimp.enable = lib.mkEnableOption "Enable gimp";
config = lib.mkIf config.features.desktop.media.gimp.enable { {
options.features.desktop.media.gimp.enable = mkEnableOption "Enable gimp";
config = mkIf config.features.desktop.media.gimp.enable {
home.packages = with pkgs; [ gimp ]; home.packages = with pkgs; [ gimp ];
}; };
} }

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.media.handbrake.enable = lib.mkEnableOption "Enable handbrake";
config = lib.mkIf config.features.desktop.media.handbrake.enable { {
options.features.desktop.media.handbrake.enable = mkEnableOption "Enable handbrake";
config = mkIf config.features.desktop.media.handbrake.enable {
home.packages = with pkgs; [ handbrake ]; home.packages = with pkgs; [ handbrake ];
}; };
} }

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.media.kdenlive.enable = lib.mkEnableOption "Enable kdenlive";
config = lib.mkIf config.features.desktop.media.kdenlive.enable { {
options.features.desktop.media.kdenlive.enable = mkEnableOption "Enable kdenlive";
config = mkIf config.features.desktop.media.kdenlive.enable {
home.packages = with pkgs; [ kdenlive ]; home.packages = with pkgs; [ kdenlive ];
}; };
} }

View file

@ -1,9 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
{ with lib;
options.features.desktop.media.mpv.enable = lib.mkEnableOption "Enable mpv media player";
config = lib.mkIf config.features.desktop.media.mpv.enable { {
options.features.desktop.media.mpv.enable = mkEnableOption "Enable mpv media player";
config = mkIf config.features.desktop.media.mpv.enable {
programs.mpv = { programs.mpv = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.media.pocket-casts.enable = lib.mkEnableOption "Enable Pocket Casts";
config = lib.mkIf config.features.desktop.media.pocket-casts.enable { {
options.features.desktop.media.pocket-casts.enable = mkEnableOption "Enable Pocket Casts";
config = mkIf config.features.desktop.media.pocket-casts.enable {
home.packages = with pkgs; [ pocket-casts ]; home.packages = with pkgs; [ pocket-casts ];
}; };
} }

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.slack.enable = lib.mkEnableOption "Enable Slack";
config = lib.mkIf config.features.desktop.slack.enable { {
options.features.desktop.slack.enable = mkEnableOption "Enable Slack";
config = mkIf config.features.desktop.slack.enable {
home.packages = with pkgs; [ slack ]; home.packages = with pkgs; [ slack ];
}; };
} }

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.zoom.enable = lib.mkEnableOption "Enable zoom";
config = lib.mkIf config.features.desktop.zoom.enable { {
options.features.desktop.zoom.enable = mkEnableOption "Enable zoom";
config = mkIf config.features.desktop.zoom.enable {
home.packages = with pkgs; [ nixpkgs-2405.zoom-us ]; home.packages = with pkgs; [ nixpkgs-2405.zoom-us ];
}; };
} }

View file

@ -1,9 +1,11 @@
{ lib, config, ... }: { lib, config, ... }:
{ with lib;
options.features.cli.docker.enable = lib.mkEnableOption "Enable Docker";
config = lib.mkIf config.features.cli.docker.enable { {
options.features.cli.docker.enable = mkEnableOption "Enable Docker";
config = mkIf config.features.cli.docker.enable {
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.peek.enable = lib.mkEnableOption "Enable peek";
config = lib.mkIf config.features.desktop.peek.enable { {
options.features.desktop.peek.enable = mkEnableOption "Enable peek";
config = mkIf config.features.desktop.peek.enable {
environment.systemPackages = with pkgs; [ peek ]; environment.systemPackages = with pkgs; [ peek ];
}; };
} }

View file

@ -6,10 +6,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.screenkey.enable = lib.mkEnableOption "Enable screenkey";
config = lib.mkIf config.features.desktop.screenkey.enable { {
options.features.desktop.screenkey.enable = mkEnableOption "Enable screenkey";
config = mkIf config.features.desktop.screenkey.enable {
environment.systemPackages = with pkgs; [ screenkey ]; environment.systemPackages = with pkgs; [ screenkey ];
home-manager.users.${username}.xdg.configFile."screenkey.json".text = builtins.toJSON { home-manager.users.${username}.xdg.configFile."screenkey.json".text = builtins.toJSON {

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.desktop.gaming.enable = lib.mkEnableOption "Enable games";
config = lib.mkIf config.features.desktop.gaming.enable { {
options.features.desktop.gaming.enable = mkEnableOption "Enable games";
config = mkIf config.features.desktop.gaming.enable {
programs.steam.enable = true; programs.steam.enable = true;
environment.systemPackages = with pkgs; [ zeroad ]; environment.systemPackages = with pkgs; [ zeroad ];

View file

@ -1,9 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
{ with lib;
options.features.homelab.gitea.enable = lib.mkEnableOption "Enable gitea";
config = lib.mkIf config.features.homelab.gitea.enable { {
options.features.homelab.gitea.enable = mkEnableOption "Enable gitea";
config = mkIf config.features.homelab.gitea.enable {
services.gitea = { services.gitea = {
enable = true; enable = true;

View file

@ -5,10 +5,12 @@
... ...
}: }:
{ with lib;
options.features.homelab.immich.enable = lib.mkEnableOption "Enable immich";
config = lib.mkIf config.features.homelab.immich.enable { {
options.features.homelab.immich.enable = mkEnableOption "Enable immich";
config = mkIf config.features.homelab.immich.enable {
services.immich.enable = true; services.immich.enable = true;
environment.systemPackages = [ pkgs.immich-cli ]; environment.systemPackages = [ pkgs.immich-cli ];

View file

@ -1,9 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
{ with lib;
options.features.homelab.jellyfin.enable = lib.mkEnableOption "Enable jellyfin";
config = lib.mkIf config.features.homelab.jellyfin.enable { {
options.features.homelab.jellyfin.enable = mkEnableOption "Enable jellyfin";
config = mkIf config.features.homelab.jellyfin.enable {
services.jellyfin = { services.jellyfin = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;