diff --git a/README.md b/README.md index 1cbe37a..2bcaa37 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,10 @@ Here is a minimal required configuration (the TODOs mention a required change): # variables for system conf = { # TODO change this to your monitor and your pc name + # should be something like DP-1 monitor = "YOURMONITOR"; + username = "YOURNAME"; + # the name of your system hostname = "YOURNAME"; # TODO only needed when you use intel -> amd is default # cpu = "intel"; @@ -113,3 +116,5 @@ For package lists, please check the individual modules, as the lists can be long - yazi: Installs yazi and sets custom keybinds - teams: For the poor souls that have to use this.... - sops: Enables sops-nix +- fish: Enables and configures fish shell +- kitty: Enables and configures kitty terminal diff --git a/modules/conf.nix b/modules/conf.nix index c730f54..3f307f0 100644 --- a/modules/conf.nix +++ b/modules/conf.nix @@ -101,9 +101,8 @@ ''; }; - build-command = lib.mkOption { - default = - "sudo nixos-rebuild switch --flake /home/${config.conf.username}/gits/dotFiles/."; + nixos-config-path = lib.mkOption { + default = "/home/${config.conf.username}/gits/nixos/."; example = "yourpath/."; type = lib.types.str; description = '' diff --git a/modules/programs/base_packages.nix b/modules/programs/base_packages.nix index 5041c1a..74f2bd0 100644 --- a/modules/programs/base_packages.nix +++ b/modules/programs/base_packages.nix @@ -68,32 +68,36 @@ }; }; - services.upower.enable = true; - services.dbus.enable = true; - services.dbus.packages = with pkgs; [ gnome2.GConf ]; - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - - programs.fish.enable = true; - programs.fish.promptInit = '' - ${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source - ''; - programs.nix-ld.enable = true; - programs.nix-ld.libraries = with pkgs; [ jdk zlib ]; - programs.direnv = { - package = pkgs.direnv; - silent = false; - loadInNixShell = true; - direnvrcExtra = ""; - nix-direnv = { + services = { + upower.enable = true; + dbus = { enable = true; - package = pkgs.nix-direnv; + packages = with pkgs; [ gnome2.GConf ]; + }; + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; }; }; - programs.ssh.startAgent = true; - programs.gnupg.agent.enable = true; + + programs = { + nix-ld = { + enable = true; + nix-ld.libraries = with pkgs; [ jdk zlib ]; + }; + direnv = { + package = pkgs.direnv; + silent = false; + loadInNixShell = true; + direnvrcExtra = ""; + nix-direnv = { + enable = true; + package = pkgs.nix-direnv; + }; + }; + ssh.startAgent = true; + gnupg.agent.enable = true; + }; }))); } diff --git a/modules/programs/default.nix b/modules/programs/default.nix index a3bc58c..df2e130 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -6,6 +6,7 @@ ./coding.nix ./drives.nix ./firefox.nix + ./fish.nix ./flatpak.nix ./gaming.nix ./git.nix @@ -26,7 +27,7 @@ ./stylix.nix ./teams.nix ./virtualbox.nix - ./yazi ./xone.nix + ./yazi ]; } diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix new file mode 100644 index 0000000..07f3397 --- /dev/null +++ b/modules/programs/fish.nix @@ -0,0 +1,151 @@ +{ lib, config, options, pkgs, ... }: { + options.mods.fish = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables fish"; + }; + }; + config = lib.mkIf config.mods.fish.enable + (lib.optionalAttrs (options ? programs.fish) { fish = { enable = true; }; } + // lib.optionalAttrs (options ? xdg.configFile) { + xdg.configFile."fish/config.fish" = { + text = '' + 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' + 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 + + # ============================================================================= + # + # Commands for zoxide. Disable these using --no-cmd. + # + + 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 + ''; + }; + }); +} diff --git a/modules/programs/home_packages.nix b/modules/programs/home_packages.nix index 0967394..131c73a 100644 --- a/modules/programs/home_packages.nix +++ b/modules/programs/home_packages.nix @@ -63,21 +63,28 @@ brightnessctl ]; + xdg.configFile."direnv/direnv.toml".source = + (pkgs.formats.toml { }).generate "direnv" { + global = { warn_timeout = "-1s"; }; + }; + #my own programs - programs.oxicalc.enable = true; - programs.oxinoti.enable = true; - programs.oxidash.enable = true; - programs.oxishut.enable = true; - programs.oxipaste.enable = true; - programs.hyprdock.enable = true; - programs.ReSet.enable = true; - programs.ReSet.config.plugins = [ - inputs.reset-plugins.packages."x86_64-linux".monitor - inputs.reset-plugins.packages."x86_64-linux".keyboard - ]; - programs.ReSet.config.plugin_config = { - Keyboard = { - path = "/home/${config.conf.username}/.config/reset/keyboard.conf"; + programs = { + oxicalc.enable = true; + oxinoti.enable = true; + oxidash.enable = true; + oxishut.enable = true; + oxipaste.enable = true; + hyprdock.enable = true; + ReSet.enable = true; + ReSet.config.plugins = [ + inputs.reset-plugins.packages."x86_64-linux".monitor + inputs.reset-plugins.packages."x86_64-linux".keyboard + ]; + ReSet.config.plugin_config = { + Keyboard = { + path = "/home/${config.conf.username}/.config/reset/keyboard.conf"; + }; }; }; }))); diff --git a/modules/programs/hyprland/hyprland.nix b/modules/programs/hyprland/hyprland.nix index b5358fd..50dd979 100644 --- a/modules/programs/hyprland/hyprland.nix +++ b/modules/programs/hyprland/hyprland.nix @@ -77,8 +77,6 @@ wayland.windowManager.hyprland.settings = lib.mkIf config.mods.hyprland.use_default_config { "$mod" = "SUPER"; - "source" = - "/home/${config.conf.username}/.config/reset/keyboard.conf"; bindm = [ "$mod, mouse:272, movewindow" "$mod, mouse:273, resizewindow" ]; diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix new file mode 100644 index 0000000..07224c9 --- /dev/null +++ b/modules/programs/kitty.nix @@ -0,0 +1,94 @@ +{ lib, config, options, pkgs, inputs, ... }: +let + base16 = pkgs.callPackage inputs.base16.lib { }; + scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); + hexTable = { + "0" = "1"; + "1" = "0"; + "2" = "1"; + "3" = "2"; + "4" = "3"; + "5" = "4"; + "6" = "5"; + "7" = "6"; + "8" = "7"; + "9" = "8"; + "a" = "9"; + "b" = "a"; + "c" = "b"; + "d" = "c"; + "e" = "d"; + "f" = "e"; + }; + base = "#" + lib.strings.concatStrings + ((lib.lists.take 5 (lib.strings.stringToCharacters scheme.base00)) ++ [ + hexTable."${(lib.lists.last + (lib.strings.stringToCharacters scheme.base00))}" + ]); +in { + options.mods.kitty = { + enable = lib.mkOption { + default = true; + example = false; + type = lib.types.bool; + description = "Enables kitty"; + }; + }; + config = lib.mkIf config.mods.kitty.enable + (lib.optionalAttrs (options ? home.packages) { + stylix.targets.kitty = { enable = false; }; + programs.kitty = { + enable = true; + settings = { + enable_audio_bell = "no"; + window_alert_on_bell = "no"; + cursor_blink_interval = "0"; + window_padding_width = "1"; + shell_integration = "yes"; + sync_with_monitor = "no"; + background_opacity = "0.8"; + + font_family = "JetBrainsMono Nerd Font Mono"; + bold_font = "JetBrainsMono Nerd Font Mono Extra Bold"; + italic_font = "JetBrainsMono Nerd Font Mono Extra Italic"; + bold_italic_font = "JetBrainsMono Nerd Font Mono Extra Bold Italic"; + + background = base; + foreground = "#" + scheme.base05; + selection_foreground = "#" + scheme.base05; + selection_background = base; + url_color = "#" + scheme.base04; + cursor = "#" + scheme.base05; + active_border_color = "#" + scheme.base03; + inactive_border_color = "#" + scheme.base01; + active_tab_background = base; + active_tab_foreground = "#" + scheme.base05; + inactive_tab_background = "#" + scheme.base01; + inactive_tab_foreground = "#" + scheme.base04; + tab_bar_background = "#" + scheme.base01; + + color0 = base; + color1 = "#" + scheme.base08; + color2 = "#" + scheme.base0B; + color3 = "#" + scheme.base0A; + color4 = "#" + scheme.base0D; + color5 = "#" + scheme.base0E; + color6 = "#" + scheme.base0C; + color7 = "#" + scheme.base05; + + color8 = "#" + scheme.base03; + color9 = "#" + scheme.base08; + color10 = "#" + scheme.base0B; + color11 = "#" + scheme.base0A; + color12 = "#" + scheme.base0D; + color13 = "#" + scheme.base0E; + color14 = "#" + scheme.base0C; + color15 = "#" + scheme.base07; + + shell = "fish"; + }; + + }; + }); +} + diff --git a/programs/individual_configs/default.nix b/programs/individual_configs/default.nix deleted file mode 100644 index 28f20fe..0000000 --- a/programs/individual_configs/default.nix +++ /dev/null @@ -1 +0,0 @@ -{ imports = [ ./kitty.nix ./fish.nix ./direnv.nix ./neovide.nix ]; } diff --git a/programs/individual_configs/direnv.nix b/programs/individual_configs/direnv.nix deleted file mode 100644 index 25f8586..0000000 --- a/programs/individual_configs/direnv.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: { - xdg.configFile."direnv/direnv.toml".source = - (pkgs.formats.toml { }).generate "direnv" { - global = { warn_timeout = "-1s"; }; - }; -} diff --git a/programs/individual_configs/fish.nix b/programs/individual_configs/fish.nix deleted file mode 100644 index 9acd841..0000000 --- a/programs/individual_configs/fish.nix +++ /dev/null @@ -1,139 +0,0 @@ -{ config, ... }: { - xdg.configFile."fish/config.fish" = { - text = '' - if status is-interactive - # Commands to run in interactive sessions can go here - end - - # ============================================================================= - # - # Utility functions for zoxide. - # - - export NIX_PATH="$NIX_PATH:$HOME/gits/dotFiles/." - - set EDITOR "neovide --no-fork" - - alias rebuild='${config.conf.build-command}' - 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' - 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 - - # ============================================================================= - # - # Commands for zoxide. Disable these using --no-cmd. - # - - 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 - ''; - }; -} diff --git a/programs/individual_configs/kitty.nix b/programs/individual_configs/kitty.nix deleted file mode 100644 index b22bbef..0000000 --- a/programs/individual_configs/kitty.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ lib, config, inputs, pkgs, ... }: -let - base16 = pkgs.callPackage inputs.base16.lib { }; - scheme = (base16.mkSchemeAttrs config.stylix.base16Scheme); - hexTable = { - "0" = "1"; - "1" = "0"; - "2" = "1"; - "3" = "2"; - "4" = "3"; - "5" = "4"; - "6" = "5"; - "7" = "6"; - "8" = "7"; - "9" = "8"; - "a" = "9"; - "b" = "a"; - "c" = "b"; - "d" = "c"; - "e" = "d"; - "f" = "e"; - }; - base = "#" + lib.strings.concatStrings - ((lib.lists.take 5 (lib.strings.stringToCharacters scheme.base00)) ++ [ - hexTable."${(lib.lists.last - (lib.strings.stringToCharacters scheme.base00))}" - ]); -in { - - stylix.targets.kitty = { enable = false; }; - programs.kitty = { - enable = true; - - settings = { - enable_audio_bell = "no"; - window_alert_on_bell = "no"; - cursor_blink_interval = "0"; - window_padding_width = "1"; - shell_integration = "yes"; - sync_with_monitor = "no"; - background_opacity = "0.8"; - - font_family = "JetBrainsMono Nerd Font Mono"; - bold_font = "JetBrainsMono Nerd Font Mono Extra Bold"; - italic_font = "JetBrainsMono Nerd Font Mono Extra Italic"; - bold_italic_font = "JetBrainsMono Nerd Font Mono Extra Bold Italic"; - - background = base; - foreground = "#" + scheme.base05; - selection_foreground = "#" + scheme.base05; - selection_background = base; - url_color = "#" + scheme.base04; - cursor = "#" + scheme.base05; - active_border_color = "#" + scheme.base03; - inactive_border_color = "#" + scheme.base01; - active_tab_background = base; - active_tab_foreground = "#" + scheme.base05; - inactive_tab_background = "#" + scheme.base01; - inactive_tab_foreground = "#" + scheme.base04; - tab_bar_background = "#" + scheme.base01; - - color0 = base; - color1 = "#" + scheme.base08; - color2 = "#" + scheme.base0B; - color3 = "#" + scheme.base0A; - color4 = "#" + scheme.base0D; - color5 = "#" + scheme.base0E; - color6 = "#" + scheme.base0C; - color7 = "#" + scheme.base05; - - color8 = "#" + scheme.base03; - color9 = "#" + scheme.base08; - color10 = "#" + scheme.base0B; - color11 = "#" + scheme.base0A; - color12 = "#" + scheme.base0D; - color13 = "#" + scheme.base0E; - color14 = "#" + scheme.base0C; - color15 = "#" + scheme.base07; - - shell = "fish"; - }; - - }; -} diff --git a/programs/individual_configs/neovide.nix b/programs/individual_configs/neovide.nix deleted file mode 100644 index 729dfbf..0000000 --- a/programs/individual_configs/neovide.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, ... }: { - xdg.configFile."neovide/config.toml".source = - (pkgs.formats.toml { }).generate "neovide" { }; -}