From e3619d6c949b459d9d802c0b1e87a5f8643dd4f6 Mon Sep 17 00:00:00 2001 From: DashieTM Date: Sun, 25 Aug 2024 23:47:33 +0200 Subject: [PATCH] Introduce more options to configure individual modules --- modules/programs/coding.nix | 483 ++++++++++++++++++++++------ modules/programs/fish.nix | 259 ++++++++------- modules/programs/gaming.nix | 36 ++- modules/programs/gnome_services.nix | 54 ++-- modules/programs/gpu.nix | 41 ++- modules/programs/greetd.nix | 18 +- modules/programs/home_packages.nix | 10 +- modules/programs/keepassxc.nix | 6 +- modules/programs/kitty.nix | 8 +- modules/programs/media.nix | 13 +- modules/programs/stylix.nix | 9 +- modules/programs/yazi/default.nix | 30 ++ modules/programs/yazi/yazi.nix | 232 +------------ 13 files changed, 668 insertions(+), 531 deletions(-) diff --git a/modules/programs/coding.nix b/modules/programs/coding.nix index 595574c..fb5dff7 100644 --- a/modules/programs/coding.nix +++ b/modules/programs/coding.nix @@ -32,20 +32,358 @@ Enables jetbrains toolbox. ''; }; + useDefaultPackages = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default base packages (only additionalPackages are installed if false)"; + }; + additionalPackages = lib.mkOption { + default = [ ]; + example = [ ]; + type = with lib.types; listOf package; + description = "Additional packages to be installed"; + }; + languages = { + haskell = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables haskell. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + haskellPackages.cabal-install + ghc + haskellPackages.haskell-language-server + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + haskell packages + ''; + }; + }; + typst = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables typst. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + typst + tinymist + ltex-ls + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + typst packages + ''; + }; + }; + go = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables go. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + go + gopls + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + Go packages + ''; + }; + }; + rust = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables rust. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ rustup ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + Rust packages + ''; + }; + }; + ts-js = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables TS/JS. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + nodejs_20 + deno + typescript + nodePackages.typescript-language-server + nodePackages.prettier + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + TS/JS packages + ''; + }; + }; + zig = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables zig. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + zig + zls + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + zig packages + ''; + }; + }; + java = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables java. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + gradle + maven + jdt-language-server + temurin-jre-bin + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + Java packages + ''; + }; + }; + dotnet = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables C#/F#. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + #.! + dotnet-sdk_8 + omnisharp-roslyn + csharpier + netcoredbg + #fsharp + fsharp + fsautocomplete + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + C#/F# packages + ''; + }; + }; + C-CPP = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables C/C++. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + bear + gcc + clang-tools + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + C/C++ packages + ''; + }; + }; + python = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables python. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + python3 + python312Packages.python-lsp-server + python312Packages.python-lsp-ruff + python312Packages.python-lsp-black + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + python packages + ''; + }; + }; + configFiles = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables Json/toml/yaml etc. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + #yaml + yamlfmt + yamllint + yaml-language-server + + #json + jq + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + packages for said filetypes + ''; + }; + }; + bash = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables bash. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + bash-language-server + shfmt + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + bash packages + ''; + }; + }; + html-css = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables html/css. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + tailwindcss + tailwindcss-language-server + # html-tidy + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + html/css packages + ''; + }; + }; + sql = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables sql. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ + nodePackages.sql-formatter + sqls + ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + sql packages + ''; + }; + }; + asm = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables assembly. + ''; + }; + packages = lib.mkOption { + default = with pkgs; [ asm-lsp ]; + example = [ ]; + type = with lib.types; listOf package; + description = '' + assembly packages + ''; + }; + }; + }; }; }; - config = lib.mkIf config.mods.coding.enable ( - lib.optionalAttrs (options ? home.packages) { - programs.dashvim = lib.mkIf config.mods.coding.dashvim { - enable = true; - colorscheme = config.mods.stylix.colorscheme; - }; - home.packages = with pkgs; [ - (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) - #basics + config = + let + basePackages = with pkgs; [ gitui - gcc meson ninja tree-sitter @@ -54,100 +392,39 @@ sqlite plantuml d-spy - - # cpp - bear - clang-tools - - #sql - nodePackages.sql-formatter - sqls - - #assembly - asm-lsp - - #yaml - yamlfmt - yamllint - yaml-language-server - - #markdown - marksman - mdformat - - #bash - bash-language-server - shfmt - - #fsharp - fsharp - fsautocomplete - - #haskell - haskellPackages.cabal-install - ghc - haskellPackages.haskell-language-server - - #html - # html-tidy - - #json - jq - - #css - tailwindcss - tailwindcss-language-server - - #editors - neovide - ##fallback - vscodium - - #rust - rustup - - #python - python3 - python312Packages.python-lsp-server - python312Packages.python-lsp-ruff - python312Packages.python-lsp-black - - #ts/js - nodejs_20 - deno - typescript - nodePackages.typescript-language-server - nodePackages.prettier - - #go - go - gopls - - #typst - typst - tinymist - ltex-ls - - #java - gradle - maven - jdt-language-server - temurin-jre-bin - - #.! - dotnet-sdk_8 - omnisharp-roslyn - csharpier - netcoredbg - - #zig - zig - zls - tmux tmate + #editors + neovide + #fallback + vscodium ]; - - } - ); + in + lib.mkIf config.mods.coding.enable ( + lib.optionalAttrs (options ? home.packages) { + programs.dashvim = lib.mkIf config.mods.coding.dashvim { + enable = true; + colorscheme = config.mods.stylix.colorscheme; + }; + home.packages = + with pkgs; + [ (lib.mkIf config.mods.coding.jetbrains jetbrains-toolbox) ] + ++ config.mods.coding.additionalPackages + ++ (lib.lists.optionals config.mods.coding.useDefaultPackages basePackages) + ++ (lib.lists.optionals config.mods.coding.languages.haskell.enable config.mods.coding.languages.haskell.packages) + ++ (lib.lists.optionals config.mods.coding.languages.rust.enable config.mods.coding.languages.rust.packages) + ++ (lib.lists.optionals config.mods.coding.languages.go.enable config.mods.coding.languages.go.packages) + ++ (lib.lists.optionals config.mods.coding.languages.java.enable config.mods.coding.languages.java.packages) + ++ (lib.lists.optionals config.mods.coding.languages.dotnet.enable config.mods.coding.languages.dotnet.packages) + ++ (lib.lists.optionals config.mods.coding.languages.bash.enable config.mods.coding.languages.bash.packages) + ++ (lib.lists.optionals config.mods.coding.languages.C-CPP.enable config.mods.coding.languages.C-CPP.packages) + ++ (lib.lists.optionals config.mods.coding.languages.asm.enable config.mods.coding.languages.asm.packages) + ++ (lib.lists.optionals config.mods.coding.languages.sql.enable config.mods.coding.languages.sql.packages) + ++ (lib.lists.optionals config.mods.coding.languages.html-css.enable config.mods.coding.languages.html-css.packages) + ++ (lib.lists.optionals config.mods.coding.languages.configFiles.enable config.mods.coding.languages.configFiles.packages) + ++ (lib.lists.optionals config.mods.coding.languages.ts-js.enable config.mods.coding.languages.ts-js.packages) + ++ (lib.lists.optionals config.mods.coding.languages.typst.enable config.mods.coding.languages.typst.packages) + ++ (lib.lists.optionals config.mods.coding.languages.zig.enable config.mods.coding.languages.zig.packages); + } + ); } diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 21ea5ee..887b6c7 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -12,146 +12,163 @@ type = lib.types.bool; description = "Enables fish"; }; + additionalConfig = lib.mkOption { + default = ''''; + example = ''''; + type = lib.types.lines; + description = "Additional fish config"; + }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default fish config"; + }; }; config = lib.mkIf config.mods.fish.enable ( lib.optionalAttrs (options ? programs.fish) { programs.fish = { enable = true; - shellInit = '' - if status is-interactive - # Commands to run in interactive sessions can go here - end - - # ============================================================================= - # - # Utility functions for zoxide. - # - - export NIX_PATH="$NIX_PATH:${config.conf.nixos-config-path}" - - set EDITOR "neovide --no-fork" - - alias rebuild='sudo nixos-rebuild switch --flake ${config.conf.nixos-config-path}' - abbr --add ls 'lsd' - abbr --add :q 'exit' - abbr --add gh 'git push origin' - abbr --add gl 'git pull origin' - abbr --add gm 'git commit -m' - abbr --add ga "git add -A" - abbr --add g+ 'bear -- g++ -Wextra -Werror -std=c++20' - abbr --add s "kitty +kitten ssh" - abbr --add zl 'z "" ' - abbr --add nv 'neovide' - abbr --add cr 'cargo run' - abbr --add grep 'rg' - abbr --add cat 'bat' - abbr --add find 'fd' - abbr --add rm 'rip' - - set fish_greeting - # pwd based on the value of _ZO_RESOLVE_SYMLINKS. - function __zoxide_pwd - builtin pwd -L - end - - # A copy of fish's internal cd function. This makes it possible to use - # `alias cd=z` without causing an infinite loop. - if ! builtin functions --query __zoxide_cd_internal - if builtin functions --query cd - builtin functions --copy cd __zoxide_cd_internal - else - alias __zoxide_cd_internal='builtin cd' + shellInit = + if config.mods.fish.useDefaultConfig then + '' + if status is-interactive + # Commands to run in interactive sessions can go here end - end - # cd + custom logic based on the value of _ZO_ECHO. - function __zoxide_cd - __zoxide_cd_internal $argv - end + # ============================================================================= + # + # Utility functions for zoxide. + # - # ============================================================================= - # - # Hook configuration for zoxide. - # + export NIX_PATH="$NIX_PATH:${config.conf.nixos-config-path}" - # Initialize hook to add new entries to the database. - function __zoxide_hook --on-variable PWD - test -z "$fish_private_mode" - and command zoxide add -- (__zoxide_pwd) - end + set EDITOR "neovide --no-fork" - # ============================================================================= - # - # When using zoxide with --no-cmd, alias these internal functions as desired. - # + alias rebuild='sudo nixos-rebuild switch --flake ${config.conf.nixos-config-path}' + abbr --add ls 'lsd' + abbr --add :q 'exit' + abbr --add gh 'git push origin' + abbr --add gl 'git pull origin' + abbr --add gm 'git commit -m' + abbr --add ga "git add -A" + abbr --add g+ 'bear -- g++ -Wextra -Werror -std=c++20' + abbr --add s "kitty +kitten ssh" + abbr --add zl 'z "" ' + abbr --add nv 'neovide' + abbr --add cr 'cargo run' + abbr --add grep 'rg' + abbr --add cat 'bat' + abbr --add find 'fd' + abbr --add rm 'rip' - if test -z $__zoxide_z_prefix - set __zoxide_z_prefix 'z!' - end - set __zoxide_z_prefix_regex ^(string escape --style=regex $__zoxide_z_prefix) + set fish_greeting + # pwd based on the value of _ZO_RESOLVE_SYMLINKS. + function __zoxide_pwd + builtin pwd -L + end - # Jump to a directory using only keywords. - function __zoxide_z - set -l argc (count $argv) - if test $argc -eq 0 - __zoxide_cd $HOME - else if test "$argv" = - - __zoxide_cd - - else if test $argc -eq 1 -a -d $argv[1] - __zoxide_cd $argv[1] - else if set -l result (string replace --regex $__zoxide_z_prefix_regex \'\' $argv[-1]); and test -n $result - __zoxide_cd $result - else - set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv) + # A copy of fish's internal cd function. This makes it possible to use + # `alias cd=z` without causing an infinite loop. + if ! builtin functions --query __zoxide_cd_internal + if builtin functions --query cd + builtin functions --copy cd __zoxide_cd_internal + else + alias __zoxide_cd_internal='builtin cd' + end + end + + # cd + custom logic based on the value of _ZO_ECHO. + function __zoxide_cd + __zoxide_cd_internal $argv + end + + # ============================================================================= + # + # Hook configuration for zoxide. + # + + # Initialize hook to add new entries to the database. + function __zoxide_hook --on-variable PWD + test -z "$fish_private_mode" + and command zoxide add -- (__zoxide_pwd) + end + + # ============================================================================= + # + # When using zoxide with --no-cmd, alias these internal functions as desired. + # + + if test -z $__zoxide_z_prefix + set __zoxide_z_prefix 'z!' + end + set __zoxide_z_prefix_regex ^(string escape --style=regex $__zoxide_z_prefix) + + # Jump to a directory using only keywords. + function __zoxide_z + set -l argc (count $argv) + if test $argc -eq 0 + __zoxide_cd $HOME + else if test "$argv" = - + __zoxide_cd - + else if test $argc -eq 1 -a -d $argv[1] + __zoxide_cd $argv[1] + else if set -l result (string replace --regex $__zoxide_z_prefix_regex \'\' $argv[-1]); and test -n $result + __zoxide_cd $result + else + set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv) + and __zoxide_cd $result + end + end + + # Completions. + function __zoxide_z_complete + set -l tokens (commandline --current-process --tokenize) + set -l curr_tokens (commandline --cut-at-cursor --current-process --tokenize) + + if test (count $tokens) -le 2 -a (count $curr_tokens) -eq 1 + # If there are < 2 arguments, use `cd` completions. + complete --do-complete "\'\' "(commandline --cut-at-cursor --current-token) | string match --regex '.*/$' + else if test (count $tokens) -eq (count $curr_tokens); and ! string match --quiet --regex $__zoxide_z_prefix_regex. $tokens[-1] + # If the last argument is empty and the one before doesn't start with + # $__zoxide_z_prefix, use interactive selection. + set -l query $tokens[2..-1] + set -l result (zoxide query --exclude (__zoxide_pwd) --interactive -- $query) + and echo $__zoxide_z_prefix$result + commandline --function repaint + end + end + complete --command __zoxide_z --no-files --arguments '(__zoxide_z_complete)' + + # Jump to a directory using interactive search. + function __zoxide_zi + set -l result (command zoxide query --interactive -- $argv) and __zoxide_cd $result end - end - # Completions. - function __zoxide_z_complete - set -l tokens (commandline --current-process --tokenize) - set -l curr_tokens (commandline --cut-at-cursor --current-process --tokenize) + # ============================================================================= + # + # Commands for zoxide. Disable these using --no-cmd. + # - if test (count $tokens) -le 2 -a (count $curr_tokens) -eq 1 - # If there are < 2 arguments, use `cd` completions. - complete --do-complete "\'\' "(commandline --cut-at-cursor --current-token) | string match --regex '.*/$' - else if test (count $tokens) -eq (count $curr_tokens); and ! string match --quiet --regex $__zoxide_z_prefix_regex. $tokens[-1] - # If the last argument is empty and the one before doesn't start with - # $__zoxide_z_prefix, use interactive selection. - set -l query $tokens[2..-1] - set -l result (zoxide query --exclude (__zoxide_pwd) --interactive -- $query) - and echo $__zoxide_z_prefix$result - commandline --function repaint - end - end - complete --command __zoxide_z --no-files --arguments '(__zoxide_z_complete)' + abbr --erase z &>/dev/null + alias z=__zoxide_z - # Jump to a directory using interactive search. - function __zoxide_zi - set -l result (command zoxide query --interactive -- $argv) - and __zoxide_cd $result - end + abbr --erase zi &>/dev/null + alias zi=__zoxide_zi - # ============================================================================= - # - # Commands for zoxide. Disable these using --no-cmd. - # + # ============================================================================= + # + # To initialize zoxide, add this to your configuration (usually + # ~/.config/fish/config.fish): + # + # zoxide init fish | source - abbr --erase z &>/dev/null - alias z=__zoxide_z - - abbr --erase zi &>/dev/null - alias zi=__zoxide_zi - - # ============================================================================= - # - # To initialize zoxide, add this to your configuration (usually - # ~/.config/fish/config.fish): - # - # zoxide init fish | source - - direnv hook fish | source - ''; + direnv hook fish | source + '' + + config.mods.fish.additionalConfig + else + config.mods.fish.additionalPackages; }; } ); diff --git a/modules/programs/gaming.nix b/modules/programs/gaming.nix index 2652010..52c7af3 100644 --- a/modules/programs/gaming.nix +++ b/modules/programs/gaming.nix @@ -61,23 +61,25 @@ lib.optionalAttrs (options ? environment.systemPackages) { environment.systemPackages = config.mods.gaming.tools; - programs.steam.enable = config.mods.gaming.steam; - programs.gamemode.enable = true; - programs.gamemode = { - enableRenice = true; - settings = { - general = { - governor = "performance"; - }; - gpu = lib.mkIf config.mods.gaming.gpu_optimization { - apply_gpu_optimisations = "accept-responsibility"; - gpu_device = config.mods.gaming.gpu_device; - amd_performance_level = "high"; - nv_powermizer_mode = 1; - }; - custom = { - start = "notify-send -a 'Gamemode' 'Optimizations activated'"; - end = "notify-send -a 'Gamemode' 'Optimizations deactivated'"; + programs = { + steam.enable = config.mods.gaming.steam; + gamemode.enable = true; + gamemode = { + enableRenice = true; + settings = { + general = { + governor = "performance"; + }; + gpu = lib.mkIf config.mods.gaming.gpu_optimization { + apply_gpu_optimisations = "accept-responsibility"; + gpu_device = config.mods.gaming.gpu_device; + amd_performance_level = "high"; + nv_powermizer_mode = 1; + }; + custom = { + start = "notify-send -a 'Gamemode' 'Optimizations activated'"; + end = "notify-send -a 'Gamemode' 'Optimizations deactivated'"; + }; }; }; }; diff --git a/modules/programs/gnome_services.nix b/modules/programs/gnome_services.nix index f83418c..6add240 100644 --- a/modules/programs/gnome_services.nix +++ b/modules/programs/gnome_services.nix @@ -9,35 +9,47 @@ options.mods = { gnome_services.enable = lib.mkOption { default = true; - type = lib.types.bool; example = false; + type = lib.types.bool; description = '' Enables gnome services: keyring and settings daemon. Note: Do not use these for environments which ship these functionalities by default: GNOME, KDE ''; }; + nautilus.enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = '' + Enables and configures Nautilus + ''; + }; }; - config = lib.mkIf config.mods.gnome_services.enable ( - lib.optionalAttrs (options ? services.gnome.gnome-keyring) { - programs.dconf.enable = true; - services = { - # needed for GNOME services outside of GNOME Desktop - dbus.packages = with pkgs; [ - gcr - gnome.gnome-settings-daemon - ]; + config = + lib.mkIf config.mods.gnome_services.enable ( + lib.optionalAttrs (options ? services.gnome.gnome-keyring) { + programs.dconf.enable = true; + services = { + # needed for GNOME services outside of GNOME Desktop + dbus.packages = with pkgs; [ + gcr + gnome.gnome-settings-daemon + ]; - gnome.gnome-keyring.enable = true; - gvfs.enable = true; - }; - } + gnome.gnome-keyring.enable = true; + gvfs.enable = true; + }; + } + ) // lib.optionalAttrs (options ? home.packages) { - home.packages = with pkgs; [ - nautilus - sushi - nautilus-python - ]; - } - ); + home.packages = lib.mkIf config.mods.gnome_services.nautilus.enable ( + with pkgs; + [ + nautilus + sushi + nautilus-python + ] + ); + }; } diff --git a/modules/programs/gpu.nix b/modules/programs/gpu.nix index 24c37b6..bfd4964 100644 --- a/modules/programs/gpu.nix +++ b/modules/programs/gpu.nix @@ -10,25 +10,33 @@ options.mods = { nvidia.enable = lib.mkOption { default = false; - type = lib.types.bool; example = true; + type = lib.types.bool; description = '' Enables nvidia support. ''; }; amdgpu.enable = lib.mkOption { default = false; - type = lib.types.bool; example = true; + type = lib.types.bool; description = '' Enables amdgpu support. ''; }; + intelgpu.enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Enables intel support. + ''; + }; vapi = { enable = lib.mkOption { - default = false; + default = true; + example = false; type = lib.types.bool; - example = true; description = '' Enables vapi. ''; @@ -44,8 +52,8 @@ }; }; - config = lib.mkIf config.mods.vapi.enable ( - lib.optionalAttrs (options ? hardware.graphics) { + config = + (lib.optionalAttrs (options ? hardware.graphics) { boot = lib.mkIf config.mods.amdgpu.enable { kernelModules = [ "kvm-amd" ]; initrd.kernelModules = [ "amdgpu" ]; @@ -55,12 +63,14 @@ hardware = { graphics = let - base_packages = [ - pkgs.libvdpau-va-gl - pkgs.vaapiVdpau - pkgs.mesa.drivers + amdPackages = [ + (lib.mkIf (config.mods.intelgpu && lib.mkIf config.mods.vapi.enable) pkgs.vpl-gpu-rt) + (lib.mkIf (config.mods.intelgpu && lib.mkIf config.mods.vapi.enable) pkgs.intel-media-driver) + (lib.mkIf config.mods.vapi.enable pkgs.libvdpau-va-gl) + (lib.mkIf config.mods.vapi.enable pkgs.vaapiVdpau) + (lib.mkIf (config.mods.intelgpu || config.mods.amdgpu) pkgs.mesa.drivers) ]; - rocm_packages = [ + rocmPackages = [ pkgs.rocmPackages.clr.icd pkgs.rocm-opencl-runtime ]; @@ -68,10 +78,12 @@ { enable = true; enable32Bit = lib.mkDefault true; - extraPackages = base_packages ++ (lib.lists.optionals config.mods.vapi.rocm.enable rocm_packages); + extraPackages = + amdPackages + ++ (lib.lists.optionals (config.mods.vapi.rocm.enable && config.mods.gpu.amdgpu) rocmPackages); }; }; - } + }) // lib.optionalAttrs (options ? hardware.graphics) ( lib.mkIf config.mods.nvidia.enable { hardware.nvidia = { @@ -84,6 +96,5 @@ }; services.xserver.videoDrivers = [ "nvidia" ]; } - ) - ); + ); } diff --git a/modules/programs/greetd.nix b/modules/programs/greetd.nix index 4e1227e..24f328b 100644 --- a/modules/programs/greetd.nix +++ b/modules/programs/greetd.nix @@ -43,6 +43,20 @@ Resolution/refreshrate used by the monitor in the login screen. ''; }; + environments = lib.mkOption { + default = '' + Hyprland + ''; + # no idea if these are written correctly + example = '' + Niri + River + ''; + type = lib.types.lines; + description = '' + List of environments that should be available in the login prompt. + ''; + }; }; }; @@ -78,9 +92,7 @@ }; }; - environment.etc."greetd/environments".text = '' - Hyprland - ''; + environment.etc."greetd/environments".text = config.mods.greetd.environments; # should technically be the same, but this is configured instead in order to provide a decent out of the box login experience. environment.etc."greetd/hyprgreet.conf".text = '' diff --git a/modules/programs/home_packages.nix b/modules/programs/home_packages.nix index aa67cce..21858fd 100644 --- a/modules/programs/home_packages.nix +++ b/modules/programs/home_packages.nix @@ -52,6 +52,12 @@ type = with lib.types; nullOr package; description = "The email client"; }; + additionalBrowser = lib.mkOption { + default = pkgs.brave; + example = null; + type = with lib.types; nullOr package; + description = "Additional browser -> second to firefox, the only installed browser if firefox is disabled"; + }; }; config = (lib.optionalAttrs (options ? home.packages) { @@ -68,9 +74,11 @@ (lib.mkIf config.mods.home_packages.nextcloudClient nextcloud-client) (lib.mkIf (!isNull config.mods.home_packages.matrixClient) config.mods.home_packages.matrixClient) (lib.mkIf (!isNull config.mods.home_packages.mailClient) config.mods.home_packages.mailClient) + (lib.mkIf ( + !isNull config.mods.home_packages.additionalBrowser + ) config.mods.home_packages.additionalBrowser) adw-gtk3 bat - brave brightnessctl dbus fastfetch diff --git a/modules/programs/keepassxc.nix b/modules/programs/keepassxc.nix index fa7f24e..6bff531 100644 --- a/modules/programs/keepassxc.nix +++ b/modules/programs/keepassxc.nix @@ -22,9 +22,9 @@ cache_config = lib.mkOption { default = '' [General] - LastDatabases=/home/dashie/Music/Passwords.kdbx - LastActiveDatabase=/home/dashie/Music/Passwords.kdbx - LastOpenedDatabases=/home/dashie/Music/Passwords.kdbx + LastDatabases=/home/${config.conf.username}/Music/Passwords.kdbx + LastActiveDatabase=/home/${config.conf.username}/Music/Passwords.kdbx + LastOpenedDatabases=/home/${config.conf.username}/Music/Passwords.kdbx LastKeyFiles=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x42\0/\0h\0o\0m\0\x65\0/\0\x64\0\x61\0s\0h\0i\0\x65\0/\0M\0u\0s\0i\0\x63\0/\0P\0\x61\0s\0s\0w\0o\0r\0\x64\0s\0.\0k\0\x64\0\x62\0x\0\0\0\n\0\0\0\x42\0/\0h\0o\0m\0\x65\0/\0\x64\0\x61\0s\0h\0i\0\x65\0/\0M\0u\0s\0i\0\x63\0/\0l\0o\0g\0i\0n\0_\0k\0\x65\0y\0.\0k\0\x65\0y\0x) ''; example = ""; diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index a837613..335c132 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -69,10 +69,10 @@ in sync_with_monitor = "no"; background_opacity = "0.8"; - font_family = "${config.mods.stylix.monospace.name}"; - bold_font = "${config.mods.stylix.monospace.name} Extra Bold"; - italic_font = "${config.mods.stylix.monospace.name} Extra Italic"; - bold_italic_font = "${config.mods.stylix.monospace.name} Extra Bold Italic"; + font_family = "${config.mods.stylix.fonts.monospace.name}"; + bold_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold"; + italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Italic"; + bold_italic_font = "${config.mods.stylix.fonts.monospace.name} Extra Bold Italic"; background = base; foreground = "#" + scheme.base05; diff --git a/modules/programs/media.nix b/modules/programs/media.nix index 5530ff4..6fcbf4f 100644 --- a/modules/programs/media.nix +++ b/modules/programs/media.nix @@ -7,27 +7,26 @@ }: { options.mods.media_packages = { - enable = lib.mkOption { + useBasePackages = lib.mkOption { default = true; example = false; type = lib.types.bool; - description = "Default media packages"; + description = "Default media packages (If disabled, only the additional packages will be installed)"; }; - additional_packages = lib.mkOption { + additionalPackages = lib.mkOption { default = [ ]; example = [ pkgs.flatpak ]; - type = lib.types.str; + type = with lib.types; listOf package; description = '' Additional media packages. - Will be installed regardless of default media packages are installed. ''; }; }; config = ( lib.optionalAttrs (options ? home.packages) { - home.packages = config.mods.media_packages.additional_packages; + home.packages = config.mods.media_packages.additionalPackages; } - // (lib.mkIf config.mods.media_packages.enable ( + // (lib.mkIf config.mods.media_packages.useBasePackages ( lib.optionalAttrs (options ? home.packages) { home.packages = with pkgs; [ # base audio diff --git a/modules/programs/stylix.nix b/modules/programs/stylix.nix index 61ac943..9a84760 100644 --- a/modules/programs/stylix.nix +++ b/modules/programs/stylix.nix @@ -85,8 +85,8 @@ description = "font config"; }; }; - config = ( - lib.optionalAttrs (options ? stylix) { + config = + (lib.optionalAttrs (options ? stylix) { stylix = { enable = true; image = ../../base/black.jpg; @@ -104,7 +104,7 @@ "${pkgs.base16-schemes}/share/themes/${config.mods.stylix.colorscheme}.yaml" ); }; - } + }) // lib.optionalAttrs (options ? environment.systemPackages) { environment.systemPackages = [ config.mods.stylix.fonts.serif.package @@ -112,6 +112,5 @@ config.mods.stylix.fonts.monospace.package config.mods.stylix.fonts.emoji.package ]; - } - ); + }; } diff --git a/modules/programs/yazi/default.nix b/modules/programs/yazi/default.nix index 692faf0..692b72d 100644 --- a/modules/programs/yazi/default.nix +++ b/modules/programs/yazi/default.nix @@ -12,8 +12,38 @@ type = lib.types.bool; description = "Enables yazi"; }; + useDefaultConfig = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default yazi config (if disabled only additionalConfig is used)"; + }; + additionalConfig = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = "Additional config for yazi"; + }; + useDefaultKeymap = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Use default yazi keymap (if disabled only additionalKeymap is used)"; + }; + additionalKeymap = lib.mkOption { + default = { }; + example = { }; + type = with lib.types; attrsOf anything; + description = "Additional keymap for yazi"; + }; }; config = lib.mkIf config.mods.yazi.enable ( lib.optionalAttrs (options ? home.packages) { programs.yazi = import ./yazi.nix; } + // { + programs.yazi.settings = { + settings = config.mods.yazi.additionalKeymap; + keymap = config.mods.yazi.additionalConfig; + }; + } ); } diff --git a/modules/programs/yazi/yazi.nix b/modules/programs/yazi/yazi.nix index b8ead8c..236d422 100644 --- a/modules/programs/yazi/yazi.nix +++ b/modules/programs/yazi/yazi.nix @@ -1,3 +1,4 @@ +{ lib, config, ... }: { # don't ask.... enable = true; @@ -6,7 +7,6 @@ enabled = false; }; opener = { - folder = [ { run = ''open - R "$@"''; @@ -1000,234 +1000,4 @@ } ]; }; - # theme = { - # manager = { - # cwd = { - # fg = "#94e2d5"; - # }; - # - # # Hovered - # hovered = { - # reversed = true; - # }; - # preview_hovered = { underline = true; }; - # - # # Find - # find_keyword = { - # fg = "#f9e2af"; - # bold = true; - # italic = true; - # underline = true; - # }; - # find_position = { - # fg = "#f5c2e7"; - # bg = "reset"; - # bold = true; - # italic = true; - # }; - # - # # Marker - # marker_copied = { - # fg = "#a6e3a1"; - # bg = "#a6e3a1"; - # }; - # marker_cut = { - # fg = "#f38ba8"; - # bg = "#f38ba8"; - # }; - # marker_marked = { - # fg = "#f9e2af"; - # bg = "#f9e2af"; - # }; - # marker_selected = { - # fg = "#779EF0"; - # bg = "#89b4fa"; - # }; - # - # # Tab - # tab_active = { - # fg = "#1e1e2e"; - # bg = "#cdd6f4"; - # }; - # tab_inactive = { - # fg = "#cdd6f4"; - # bg = "#45475a"; - # }; - # tab_width = 1; - # - # # Count - # count_copied = { - # fg = "#1e1e2e"; - # bg = "#a6e3a1"; - # }; - # count_cut = { - # fg = "#1e1e2e"; - # bg = "#f38ba8"; - # }; - # count_selected = { - # fg = "#1e1e2e"; - # bg = "#89b4fa"; - # }; - # - # # Border - # border_symbol = "│"; - # border_style = { fg = "#7f849c"; }; - # - # }; - # status = { - # separator_open = ""; - # separator_close = ""; - # separator_style = { - # fg = "#45475a"; - # bg = "#45475a"; - # }; - # - # # Mode - # mode_normal = { - # fg = "#1e1e2e"; - # bg = "#89b4fa"; - # bold = true; - # }; - # mode_select = { - # fg = "#1e1e2e"; - # bg = "#a6e3a1"; - # bold = true; - # }; - # mode_unset = { - # fg = "#1e1e2e"; - # bg = "#f2cdcd"; - # bold = true; - # }; - # - # # Progress - # progress_label = { - # fg = "#ffffff"; - # bold = true; - # }; - # progress_normal = { - # fg = "#89b4fa"; - # bg = "#45475a"; - # }; - # progress_error = { - # fg = "#f38ba8"; - # bg = "#45475a"; - # }; - # - # # Permissions - # permissions_t = { fg = "#89b4fa"; }; - # permissions_r = { fg = "#f9e2af"; }; - # permissions_w = { fg = "#f38ba8"; }; - # permissions_x = { fg = "#a6e3a1"; }; - # permissions_s = { fg = "#7f849c"; }; - # }; - # - # input = { - # border = { - # fg = "#89b4fa"; - # }; - # title = { }; - # value = { }; - # selected = { reversed = true; }; - # }; - # select = { - # border = { - # fg = "#89b4fa"; - # }; - # active = { fg = "#f5c2e7"; }; - # inactive = { }; - # }; - # tasks = { - # border = { - # fg = "#89b4fa"; - # }; - # title = { }; - # hovered = { - # underline = true; - # }; - # }; - # which = { - # mask = { - # bg = "#313244"; - # }; - # cand = { fg = "#94e2d5"; }; - # rest = { fg = "#9399b2"; }; - # desc = { fg = "#f5c2e7"; }; - # separator = "  "; - # separator_style = { fg = "#585b70"; }; - # }; - # help = { - # on = { - # fg = "#f5c2e7"; - # }; - # exec = { fg = "#94e2d5"; }; - # desc = { fg = "#9399b2"; }; - # hovered = { - # bg = "#585b70"; - # bold = true; - # }; - # footer = { - # fg = "#45475a"; - # bg = "#cdd6f4"; - # }; - # }; - # filetype = { - # rules = [ - # # Images - # { - # mime = "image/*"; - # fg = "#94e2d5"; - # } - # - # # Videos - # { - # mime = "video/*"; - # fg = "#f9e2af"; - # } - # { - # mime = "audio/*"; - # fg = "#f9e2af"; - # } - # - # # Archives - # { - # mime = "application/zip"; - # fg = "#f5c2e7"; - # } - # { - # mime = "application/gzip"; - # fg = "#f5c2e7"; - # } - # { - # mime = "application/x-tar"; - # fg = "#f5c2e7"; - # } - # { - # mime = "application/x-bzip"; - # fg = "#f5c2e7"; - # } - # { - # mime = "application/x-bzip2"; - # fg = "#f5c2e7"; - # } - # { - # mime = "application/x-7z-compressed"; - # fg = "#f5c2e7"; - # } - # { - # mime = "application/x-rar"; - # fg = "#f5c2e7"; - # } - # - # # Fallback - # { - # name = "*"; - # fg = "#cdd6f4"; - # } - # { - # name = "*/"; - # fg = "#89b4fa"; - # } - # ]; - # }; - # }; }