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 @@
...
}:
{
options.features.cli.bluetuith.enable = lib.mkEnableOption "Enable bluetuith";
with lib;
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; [
bluetuith
];

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.features.cli.direnv.enable = lib.mkEnableOption "Enable direnv";
with lib;
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 = {
enable = true;
enableZshIntegration = true;

View file

@ -6,10 +6,12 @@
...
}:
{
options.features.cli.neovim.enable = lib.mkEnableOption "Enable neovim";
with lib;
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 = {
enable = true;

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.cli.tmux-sessionizer.enable = lib.mkEnableOption "Enable tmux-sessionizer";
with lib;
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.file.".tmux-sessionizer".source = "${

View file

@ -5,13 +5,15 @@
...
}:
with lib;
let
inherit (pkgs) tmuxPlugins;
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 = {
enable = true;

View file

@ -4,10 +4,12 @@
...
}:
{
options.features.desktop.alacritty.enable = lib.mkEnableOption "Enable Alacritty";
with lib;
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 = {
enable = true;

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.features.desktop.copyq.enable = lib.mkEnableOption "Enable copyq";
with lib;
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;
};
}

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.discord.enable = lib.mkEnableOption "Enable Discord";
with lib;
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 ];
};
}

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.features.desktop.espanso.enable = lib.mkEnableOption "Enable espanso";
with lib;
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 = {
enable = true;

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.flameshot.enable = lib.mkEnableOption "Enable flameshot";
with lib;
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 = {
enable = true;

View file

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

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.media.gimp.enable = lib.mkEnableOption "Enable gimp";
with lib;
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 ];
};
}

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.media.handbrake.enable = lib.mkEnableOption "Enable handbrake";
with lib;
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 ];
};
}

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.media.kdenlive.enable = lib.mkEnableOption "Enable kdenlive";
with lib;
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 ];
};
}

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.features.desktop.media.mpv.enable = lib.mkEnableOption "Enable mpv media player";
with lib;
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 = {
enable = true;

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.media.pocket-casts.enable = lib.mkEnableOption "Enable Pocket Casts";
with lib;
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 ];
};
}

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.slack.enable = lib.mkEnableOption "Enable Slack";
with lib;
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 ];
};
}

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.zoom.enable = lib.mkEnableOption "Enable zoom";
with lib;
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 ];
};
}

View file

@ -1,9 +1,11 @@
{ lib, config, ... }:
{
options.features.cli.docker.enable = lib.mkEnableOption "Enable Docker";
with lib;
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 = {
enable = true;

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.peek.enable = lib.mkEnableOption "Enable peek";
with lib;
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 ];
};
}

View file

@ -6,10 +6,12 @@
...
}:
{
options.features.desktop.screenkey.enable = lib.mkEnableOption "Enable screenkey";
with lib;
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 ];
home-manager.users.${username}.xdg.configFile."screenkey.json".text = builtins.toJSON {

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.desktop.gaming.enable = lib.mkEnableOption "Enable games";
with lib;
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;
environment.systemPackages = with pkgs; [ zeroad ];

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.features.homelab.gitea.enable = lib.mkEnableOption "Enable gitea";
with lib;
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 = {
enable = true;

View file

@ -5,10 +5,12 @@
...
}:
{
options.features.homelab.immich.enable = lib.mkEnableOption "Enable immich";
with lib;
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;
environment.systemPackages = [ pkgs.immich-cli ];

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
options.features.homelab.jellyfin.enable = lib.mkEnableOption "Enable jellyfin";
with lib;
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 = {
enable = true;
openFirewall = true;