From 9497b67ef9e6f397ba146cc4c12fec8e9ecae7b2 Mon Sep 17 00:00:00 2001 From: Collin Williams <96917990+bluedragon1221@users.noreply.github.com> Date: Fri, 5 Sep 2025 13:38:29 -0500 Subject: allow same configurations for fish in bash --- modules/terminal/system/programs/bash.nix | 32 +++++++++++++++++++++++ modules/terminal/system/programs/bat.nix | 17 +++++++++--- modules/terminal/system/programs/broot.nix | 27 +++++++++++-------- modules/terminal/system/programs/eza.nix | 17 +++++++++--- modules/terminal/system/programs/fish.nix | 22 ++++++++-------- modules/terminal/system/programs/fzf.nix | 17 +++++++++--- modules/terminal/system/programs/helix.nix | 25 +++++++++++------- modules/terminal/system/programs/starship.nix | 37 ++++++++++++++++----------- modules/terminal/system/programs/tmux.nix | 1 - 9 files changed, 136 insertions(+), 59 deletions(-) create mode 100644 modules/terminal/system/programs/bash.nix (limited to 'modules/terminal/system/programs') diff --git a/modules/terminal/system/programs/bash.nix b/modules/terminal/system/programs/bash.nix new file mode 100644 index 0000000..ed2c226 --- /dev/null +++ b/modules/terminal/system/programs/bash.nix @@ -0,0 +1,32 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.bash; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".bashrc".text = '' + eval "$(direnv hook bash)" + + for file in ~/.config/bash/conf.d/*; do source "$file"; done + ''; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + pay-respects + ]; + }; + }; + } diff --git a/modules/terminal/system/programs/bat.nix b/modules/terminal/system/programs/bat.nix index 6f53dd7..d954291 100644 --- a/modules/terminal/system/programs/bat.nix +++ b/modules/terminal/system/programs/bat.nix @@ -8,10 +8,19 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { - files.".config/fish/conf.d/bat.fish".text = '' - alias cat bat - set -gx BAT_THEME "base16" - ''; + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/bat.fish".text = '' + alias cat bat + set -gx BAT_THEME "base16" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/fish/conf.d/bat.bash".text = '' + alias cat="bat" + export BAT_THEME="base16" + ''; + }); packages = [pkgs.bat]; }; diff --git a/modules/terminal/system/programs/broot.nix b/modules/terminal/system/programs/broot.nix index b2060d8..6164044 100644 --- a/modules/terminal/system/programs/broot.nix +++ b/modules/terminal/system/programs/broot.nix @@ -115,16 +115,23 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { - files = { - ".config/broot/conf.toml" = { - generator = (pkgs.formats.toml {}).generate "conf.toml"; - value = conf; - }; - - ".config/fish/conf.d/broot.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable '' - ${pkgs.broot}/bin/broot --print-shell-function fish | source - ''; - }; + files = + { + ".config/broot/conf.toml" = { + generator = (pkgs.formats.toml {}).generate "conf.toml"; + value = conf; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/broot.fish".text = '' + broot --print-shell-function fish | source + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/broot.bash".text = '' + eval "$(broot --print-shell-function bash)" + ''; + }); packages = [pkgs.broot]; }; diff --git a/modules/terminal/system/programs/eza.nix b/modules/terminal/system/programs/eza.nix index 52c290d..acdcbc2 100644 --- a/modules/terminal/system/programs/eza.nix +++ b/modules/terminal/system/programs/eza.nix @@ -8,10 +8,19 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { - files.".config/fish/conf.d/eza.fish".text = '' - alias ls "eza -A -w 80 --group-directories-first -I '.git*'" - alias tree "eza -T" - ''; + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/eza.fish".text = '' + alias ls "eza -A -w 80 --group-directories-first -I '.git*'" + alias tree "eza -T" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/bash/conf.d/eza.bash".text = '' + alias ls="eza -A -w 80 --group-directories-first -I '.git*'" + alias tree="eza -T" + ''; + }); packages = [pkgs.eza]; }; diff --git a/modules/terminal/system/programs/fish.nix b/modules/terminal/system/programs/fish.nix index fe3ff88..a210cd5 100644 --- a/modules/terminal/system/programs/fish.nix +++ b/modules/terminal/system/programs/fish.nix @@ -5,22 +5,20 @@ ... }: let cfg = config.collinux.terminal.shells.fish; - - init = '' - set fish_greeting - - function fish_title - echo fish (prompt_pwd) - end - - direnv hook fish | source - pay-respects fish --alias | source - ''; in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { files = { - ".config/fish/config.fish".text = init; + ".config/fish/config.fish".text = '' + set fish_greeting + + function fish_title + echo fish (prompt_pwd) + end + + direnv hook fish | source + pay-respects fish --alias | source + ''; }; packages = with pkgs; [ diff --git a/modules/terminal/system/programs/fzf.nix b/modules/terminal/system/programs/fzf.nix index 486d4e2..fd86566 100644 --- a/modules/terminal/system/programs/fzf.nix +++ b/modules/terminal/system/programs/fzf.nix @@ -8,10 +8,19 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { - files.".config/fish/conf.d/fzf.fish".text = '' - ${pkgs.fzf}/bin/fzf --fish | source - set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" - ''; + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/fzf.fish".text = '' + fzf --fish | source + set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/fzf.bash".text = '' + eval "$(fzf --bash)" + export FZF_DEFAULT_OPTS="--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }); packages = [pkgs.fzf]; }; diff --git a/modules/terminal/system/programs/helix.nix b/modules/terminal/system/programs/helix.nix index 71dad76..54a6932 100644 --- a/modules/terminal/system/programs/helix.nix +++ b/modules/terminal/system/programs/helix.nix @@ -156,15 +156,22 @@ in generator = (pkgs.formats.toml {}).generate "toml_file"; inherit value; }; - in { - ".config/helix/config.toml" = t settings; - ".config/helix/languages.toml" = t languages; - ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; - - ".config/fish/conf.d/helix.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable '' - set -gx EDITOR hx - ''; - }; + in + { + ".config/helix/config.toml" = t settings; + ".config/helix/languages.toml" = t languages; + ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/helix.fish".text = '' + set -gx EDITOR hx + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/helix.bash".text = '' + EDITOR=hx + ''; + }); packages = [pkgs.helix]; }; diff --git a/modules/terminal/system/programs/starship.nix b/modules/terminal/system/programs/starship.nix index c70a132..f0134f0 100644 --- a/modules/terminal/system/programs/starship.nix +++ b/modules/terminal/system/programs/starship.nix @@ -36,21 +36,28 @@ in lib.mkIf cfg.enable { hjem.users."${config.collinux.user.name}" = { - files = { - ".config/starship.toml" = { - generator = (pkgs.formats.toml {}).generate "starship.toml"; - value = settings; - }; - - ".config/fish/conf.d/starship.fish".text = lib.mkIf config.collinux.terminal.shells.fish.enable '' - function starship_transient_prompt_func - starship module character - end - - starship init fish | source - enable_transience - ''; - }; + files = + { + ".config/starship.toml" = { + generator = (pkgs.formats.toml {}).generate "starship.toml"; + value = settings; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/starship.fish".text = '' + function starship_transient_prompt_func + starship module character + end + + starship init fish | source + enable_transience + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/starship.bash".text = '' + eval "$(starship init bash)" + ''; + }); packages = [pkgs.starship]; }; diff --git a/modules/terminal/system/programs/tmux.nix b/modules/terminal/system/programs/tmux.nix index 322a912..c349ded 100644 --- a/modules/terminal/system/programs/tmux.nix +++ b/modules/terminal/system/programs/tmux.nix @@ -242,7 +242,6 @@ tmux-conf = '' set -g mouse on - set -g default-terminal "tmux" # Panes bind-key -n C-w kill-pane -- cgit v1.3.1 From 7e7c8947fc2ff5598124c4a4c18bd28432fa017e Mon Sep 17 00:00:00 2001 From: Collin Williams <96917990+bluedragon1221@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:01:35 -0500 Subject: rework most of config; probably broke jupiter again; working to add ganymede (non-nixos) to this repo --- flake.nix | 17 +- hosts/mercury/config.nix | 24 +- hosts/mercury/hjem.nix | 14 + hosts/mercury/home.nix | 17 -- hosts/mercury/nixos.nix | 31 ++ hosts/mercury/system.nix | 30 -- lib/lib.nix | 2 + lib/nix-furnace/default.nix | 102 ------- lib/nix-furnace/mkSystem.nix | 105 +++++++ modules/boot/nixos/default.nix | 36 +++ modules/boot/nixos/plymouth.nix | 21 ++ modules/boot/system/default.nix | 36 --- modules/boot/system/plymouth.nix | 21 -- modules/desktop/hjem/default.nix | 12 + modules/desktop/hjem/gtk.nix | 37 +++ modules/desktop/hjem/programs/firefox.nix | 26 ++ modules/desktop/hjem/programs/foot.nix | 61 ++++ modules/desktop/hjem/wm/dunst.nix | 36 +++ modules/desktop/hjem/wm/fuzzel.nix | 49 +++ modules/desktop/hjem/wm/sway.nix | 110 +++++++ modules/desktop/home/default.nix | 2 +- modules/desktop/home/gtk.nix | 18 ++ modules/desktop/home/gtk/adwaita.nix | 33 -- modules/desktop/home/gtk/catppuccin.nix | 33 -- modules/desktop/home/gtk/default.nix | 26 -- modules/desktop/nixos/default.nix | 11 + modules/desktop/nixos/gnome.nix | 120 ++++++++ modules/desktop/nixos/greeters/gdm.nix | 13 + modules/desktop/nixos/greeters/greetd.nix | 19 ++ modules/desktop/nixos/programs/blackbox.nix | 31 ++ modules/desktop/nixos/programs/firefox.nix | 37 +++ modules/desktop/options.nix | 92 ++++-- modules/desktop/system/components/dunst.nix | 38 --- modules/desktop/system/components/fuzzel.nix | 50 ---- modules/desktop/system/default.nix | 13 - modules/desktop/system/environments/gnome.nix | 124 -------- modules/desktop/system/environments/sway.nix | 120 -------- modules/desktop/system/programs/blackbox.nix | 31 -- modules/desktop/system/programs/firefox.nix | 51 ---- modules/desktop/system/programs/foot.nix | 63 ---- modules/nix/nixos/default.nix | 30 ++ modules/nix/system/default.nix | 30 -- modules/services/nixos/audio.nix | 20 ++ modules/services/nixos/bluetooth.nix | 19 ++ modules/services/nixos/default.nix | 8 + modules/services/nixos/networking/default.nix | 18 ++ modules/services/nixos/networking/iwd.nix | 26 ++ .../services/nixos/networking/networkmanager.nix | 15 + modules/services/nixos/tailscale.nix | 15 + modules/services/system/audio.nix | 20 -- modules/services/system/bluetooth.nix | 19 -- modules/services/system/default.nix | 8 - modules/services/system/networking/default.nix | 18 -- modules/services/system/networking/iwd.nix | 26 -- .../services/system/networking/networkmanager.nix | 15 - modules/services/system/tailscale.nix | 15 - modules/terminal/hjem/default.nix | 15 + modules/terminal/hjem/programs/bash.nix | 29 ++ modules/terminal/hjem/programs/bat.nix | 25 ++ modules/terminal/hjem/programs/broot.nix | 136 +++++++++ modules/terminal/hjem/programs/cmus.nix | 95 ++++++ modules/terminal/hjem/programs/eza.nix | 25 ++ modules/terminal/hjem/programs/fish.nix | 35 +++ modules/terminal/hjem/programs/fzf.nix | 25 ++ modules/terminal/hjem/programs/git.nix | 29 ++ modules/terminal/hjem/programs/helix.nix | 165 ++++++++++ modules/terminal/hjem/programs/lazygit.nix | 39 +++ modules/terminal/hjem/programs/starship.nix | 62 ++++ modules/terminal/hjem/programs/tmux.nix | 330 ++++++++++++++++++++ modules/terminal/nixos/default.nix | 10 + modules/terminal/nixos/programs/bash.nix | 32 ++ modules/terminal/nixos/programs/bat.nix | 27 ++ modules/terminal/nixos/programs/broot.nix | 138 +++++++++ modules/terminal/nixos/programs/cmus.nix | 97 ++++++ modules/terminal/nixos/programs/eza.nix | 27 ++ modules/terminal/nixos/programs/fish.nix | 37 +++ modules/terminal/nixos/programs/fzf.nix | 27 ++ modules/terminal/nixos/programs/git.nix | 31 ++ modules/terminal/nixos/programs/helix.nix | 178 +++++++++++ modules/terminal/nixos/programs/lazygit.nix | 41 +++ modules/terminal/nixos/programs/starship.nix | 64 ++++ modules/terminal/nixos/programs/tmux.nix | 332 +++++++++++++++++++++ modules/terminal/system/default.nix | 24 -- modules/terminal/system/programs/bash.nix | 32 -- modules/terminal/system/programs/bat.nix | 27 -- modules/terminal/system/programs/broot.nix | 138 --------- modules/terminal/system/programs/cmus.nix | 97 ------ modules/terminal/system/programs/eza.nix | 27 -- modules/terminal/system/programs/fish.nix | 37 --- modules/terminal/system/programs/fzf.nix | 27 -- modules/terminal/system/programs/git.nix | 31 -- modules/terminal/system/programs/helix.nix | 178 ----------- modules/terminal/system/programs/lazygit.nix | 41 --- modules/terminal/system/programs/starship.nix | 64 ---- modules/terminal/system/programs/tmux.nix | 332 --------------------- modules/user/nixos/default.nix | 26 ++ modules/user/system/default.nix | 26 -- 97 files changed, 3114 insertions(+), 2058 deletions(-) create mode 100644 hosts/mercury/hjem.nix delete mode 100644 hosts/mercury/home.nix create mode 100644 hosts/mercury/nixos.nix delete mode 100644 hosts/mercury/system.nix delete mode 100644 lib/nix-furnace/default.nix create mode 100644 lib/nix-furnace/mkSystem.nix create mode 100644 modules/boot/nixos/default.nix create mode 100644 modules/boot/nixos/plymouth.nix delete mode 100644 modules/boot/system/default.nix delete mode 100644 modules/boot/system/plymouth.nix create mode 100644 modules/desktop/hjem/default.nix create mode 100644 modules/desktop/hjem/gtk.nix create mode 100644 modules/desktop/hjem/programs/firefox.nix create mode 100644 modules/desktop/hjem/programs/foot.nix create mode 100644 modules/desktop/hjem/wm/dunst.nix create mode 100644 modules/desktop/hjem/wm/fuzzel.nix create mode 100644 modules/desktop/hjem/wm/sway.nix create mode 100644 modules/desktop/home/gtk.nix delete mode 100644 modules/desktop/home/gtk/adwaita.nix delete mode 100644 modules/desktop/home/gtk/catppuccin.nix delete mode 100644 modules/desktop/home/gtk/default.nix create mode 100644 modules/desktop/nixos/default.nix create mode 100644 modules/desktop/nixos/gnome.nix create mode 100644 modules/desktop/nixos/greeters/gdm.nix create mode 100644 modules/desktop/nixos/greeters/greetd.nix create mode 100644 modules/desktop/nixos/programs/blackbox.nix create mode 100644 modules/desktop/nixos/programs/firefox.nix delete mode 100644 modules/desktop/system/components/dunst.nix delete mode 100644 modules/desktop/system/components/fuzzel.nix delete mode 100644 modules/desktop/system/default.nix delete mode 100644 modules/desktop/system/environments/gnome.nix delete mode 100644 modules/desktop/system/environments/sway.nix delete mode 100644 modules/desktop/system/programs/blackbox.nix delete mode 100644 modules/desktop/system/programs/firefox.nix delete mode 100644 modules/desktop/system/programs/foot.nix create mode 100644 modules/nix/nixos/default.nix delete mode 100644 modules/nix/system/default.nix create mode 100644 modules/services/nixos/audio.nix create mode 100644 modules/services/nixos/bluetooth.nix create mode 100644 modules/services/nixos/default.nix create mode 100644 modules/services/nixos/networking/default.nix create mode 100644 modules/services/nixos/networking/iwd.nix create mode 100644 modules/services/nixos/networking/networkmanager.nix create mode 100644 modules/services/nixos/tailscale.nix delete mode 100644 modules/services/system/audio.nix delete mode 100644 modules/services/system/bluetooth.nix delete mode 100644 modules/services/system/default.nix delete mode 100644 modules/services/system/networking/default.nix delete mode 100644 modules/services/system/networking/iwd.nix delete mode 100644 modules/services/system/networking/networkmanager.nix delete mode 100644 modules/services/system/tailscale.nix create mode 100644 modules/terminal/hjem/default.nix create mode 100644 modules/terminal/hjem/programs/bash.nix create mode 100644 modules/terminal/hjem/programs/bat.nix create mode 100644 modules/terminal/hjem/programs/broot.nix create mode 100644 modules/terminal/hjem/programs/cmus.nix create mode 100644 modules/terminal/hjem/programs/eza.nix create mode 100644 modules/terminal/hjem/programs/fish.nix create mode 100644 modules/terminal/hjem/programs/fzf.nix create mode 100644 modules/terminal/hjem/programs/git.nix create mode 100644 modules/terminal/hjem/programs/helix.nix create mode 100644 modules/terminal/hjem/programs/lazygit.nix create mode 100644 modules/terminal/hjem/programs/starship.nix create mode 100644 modules/terminal/hjem/programs/tmux.nix create mode 100644 modules/terminal/nixos/default.nix create mode 100644 modules/terminal/nixos/programs/bash.nix create mode 100644 modules/terminal/nixos/programs/bat.nix create mode 100644 modules/terminal/nixos/programs/broot.nix create mode 100644 modules/terminal/nixos/programs/cmus.nix create mode 100644 modules/terminal/nixos/programs/eza.nix create mode 100644 modules/terminal/nixos/programs/fish.nix create mode 100644 modules/terminal/nixos/programs/fzf.nix create mode 100644 modules/terminal/nixos/programs/git.nix create mode 100644 modules/terminal/nixos/programs/helix.nix create mode 100644 modules/terminal/nixos/programs/lazygit.nix create mode 100644 modules/terminal/nixos/programs/starship.nix create mode 100644 modules/terminal/nixos/programs/tmux.nix delete mode 100644 modules/terminal/system/default.nix delete mode 100644 modules/terminal/system/programs/bash.nix delete mode 100644 modules/terminal/system/programs/bat.nix delete mode 100644 modules/terminal/system/programs/broot.nix delete mode 100644 modules/terminal/system/programs/cmus.nix delete mode 100644 modules/terminal/system/programs/eza.nix delete mode 100644 modules/terminal/system/programs/fish.nix delete mode 100644 modules/terminal/system/programs/fzf.nix delete mode 100644 modules/terminal/system/programs/git.nix delete mode 100644 modules/terminal/system/programs/helix.nix delete mode 100644 modules/terminal/system/programs/lazygit.nix delete mode 100644 modules/terminal/system/programs/starship.nix delete mode 100644 modules/terminal/system/programs/tmux.nix create mode 100644 modules/user/nixos/default.nix delete mode 100644 modules/user/system/default.nix (limited to 'modules/terminal/system/programs') diff --git a/flake.nix b/flake.nix index 5a5c2b7..2075adf 100644 --- a/flake.nix +++ b/flake.nix @@ -25,9 +25,20 @@ }; }; - outputs = inputs: - (import ./lib/nix-furnace).mkFlake { + outputs = inputs: let + mkSystem = import ./lib/nix-furnace/mkSystem.nix; + in { + nixosConfigurations."mercury" = mkSystem { inherit inputs; - namespace = "collinux"; + hostname = "mercury"; + username = "collin"; + module_types = ["hjem" "nixos"]; }; + nixosConfigurations."jupiter" = mkSystem { + inherit inputs; + hostname = "jupiter"; + username = "collin"; + module_types = ["hjem" "home" "nixos"]; + }; + }; } diff --git a/hosts/mercury/config.nix b/hosts/mercury/config.nix index 3790951..4b5ac0d 100644 --- a/hosts/mercury/config.nix +++ b/hosts/mercury/config.nix @@ -1,15 +1,4 @@ -{inputs, ...}: { - nix-furnace = { - extraSystemModules = [ - inputs.hjem.nixosModules.default - ./system.nix - ./disks.nix - ]; - extraHomeModules = [ - ./home.nix - ]; - }; - +{ collinux = { theme = "catppuccin"; @@ -19,10 +8,15 @@ }; desktop = { - sway.enable = true; wallpaper = ./wallpaper.jpg; - components.fuzzel.enable = true; - components.dunst.enable = true; + + greetd.enable = true; + + sway = { + enable = true; + components.fuzzel.enable = true; + components.dunst.enable = true; + }; programs = { firefox.enable = true; diff --git a/hosts/mercury/hjem.nix b/hosts/mercury/hjem.nix new file mode 100644 index 0000000..b2182e9 --- /dev/null +++ b/hosts/mercury/hjem.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + packages = with pkgs; [ + # GUI apps + tor-browser # don't ask + obsidian + kdePackages.kleopatra + mpv + musescore + qutebrowser + + zotero + zathura + ]; +} diff --git a/hosts/mercury/home.nix b/hosts/mercury/home.nix deleted file mode 100644 index 5e80d16..0000000 --- a/hosts/mercury/home.nix +++ /dev/null @@ -1,17 +0,0 @@ -{pkgs, ...}: { - home.preferXdgDirectories = true; - home.packages = with pkgs; [ - # GUI apps - tor-browser # don't ask - obsidian - kdePackages.kleopatra - mpv - musescore - qutebrowser - - zotero - zathura - ]; - - home.stateVersion = "25.05"; -} diff --git a/hosts/mercury/nixos.nix b/hosts/mercury/nixos.nix new file mode 100644 index 0000000..5b1b113 --- /dev/null +++ b/hosts/mercury/nixos.nix @@ -0,0 +1,31 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [ + ./disks.nix + ./battery.nix + ./ai.nix + + inputs.nixos-facter-modules.nixosModules.facter + {facter.reportPath = ./facter.json;} + + inputs.lanzaboote.nixosModules.lanzaboote + ]; + + fonts = { + enableDefaultPackages = false; + packages = with pkgs; [ + ibm-plex + nerd-fonts.iosevka + ]; + }; + + networking.firewall.allowedUDPPorts = [445]; + networking.firewall.allowedTCPPorts = [8000]; + users.users.collin.packages = [pkgs.cifs-utils]; + fonts.fontDir.enable = true; + + system.stateVersion = "25.05"; +} diff --git a/hosts/mercury/system.nix b/hosts/mercury/system.nix deleted file mode 100644 index 0e982a0..0000000 --- a/hosts/mercury/system.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - pkgs, - inputs, - ... -}: { - imports = [ - ./battery.nix - ./ai.nix - - inputs.nixos-facter-modules.nixosModules.facter - {facter.reportPath = ./facter.json;} - - inputs.lanzaboote.nixosModules.lanzaboote - ]; - - fonts = { - enableDefaultPackages = false; - packages = with pkgs; [ - ibm-plex - nerd-fonts.iosevka - ]; - }; - - networking.firewall.allowedUDPPorts = [445]; - networking.firewall.allowedTCPPorts = [8000]; - users.users.collin.packages = [pkgs.cifs-utils]; - fonts.fontDir.enable = true; - - system.stateVersion = "25.05"; -} diff --git a/lib/lib.nix b/lib/lib.nix index 5310a6d..640f0ca 100644 --- a/lib/lib.nix +++ b/lib/lib.nix @@ -49,4 +49,6 @@ let in { inherit globimport; inherit options; + + flatten = builtins.foldl' (a: b: a ++ b) []; } diff --git a/lib/nix-furnace/default.nix b/lib/nix-furnace/default.nix deleted file mode 100644 index 303730e..0000000 --- a/lib/nix-furnace/default.nix +++ /dev/null @@ -1,102 +0,0 @@ -let - my-lib = import ../lib.nix; - inherit (my-lib.globimport) lazyImport getSubdirs getSubfiles; - - mkHomeImports = modName: [ - (lazyImport ../../modules/${modName}/options.nix) - (lazyImport ../../modules/${modName}/home/default.nix) - ]; - mkSystemImports = modName: [ - (lazyImport ../../modules/${modName}/options.nix) - (lazyImport ../../modules/${modName}/system/default.nix) - ]; - - mkModules = mapFn: { - imports = - [../../modules/options.nix] - ++ (builtins.foldl' (a: b: a ++ b) [] (builtins.map mapFn (getSubdirs ../../modules))); - }; - - mkHomeModules = mkModules mkHomeImports; - mkSystemModules = mkModules mkSystemImports; - - mkHost = { - hostname, - namespace, - inputs, - ... - }: let - preloadedConfig = import ../../hosts/${hostname}/config.nix {inherit inputs;}; - username = preloadedConfig."${namespace}".user.name; - - furnaceOptions = {lib, ...}: let - inherit (lib) mkOption types; - in { - options.nix-furnace = { - extraHomeModules = mkOption { - type = with types; listOf path; - default = []; - }; - - extraSystemModules = mkOption { - type = with types; listOf path; - default = []; - }; - }; - }; - - specialArgs = {inherit inputs my-lib;}; - in - inputs.nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = - [ - {networking.hostName = hostname;} - - ../../hosts/${hostname}/config.nix - - mkSystemModules - - furnaceOptions - - # Home-manager - inputs.home-manager.nixosModules.home-manager - { - home-manager = { - backupFileExtension = "bak"; - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = specialArgs; - users."${username}" = { - imports = - [ - mkHomeModules - - furnaceOptions - - ../../hosts/${hostname}/config.nix - ] - ++ preloadedConfig.nix-furnace.extraHomeModules; - }; - }; - } - ] - ++ preloadedConfig.nix-furnace.extraSystemModules; - }; - - mkFlake = { - namespace, - inputs, - ... - }: { - nixosConfigurations = - builtins.listToAttrs - (builtins.map (hostname: { - name = hostname; - value = mkHost {inherit inputs hostname namespace;}; - }) - (getSubdirs ../../hosts)); - }; -in { - inherit mkFlake; -} diff --git a/lib/nix-furnace/mkSystem.nix b/lib/nix-furnace/mkSystem.nix new file mode 100644 index 0000000..3285f3a --- /dev/null +++ b/lib/nix-furnace/mkSystem.nix @@ -0,0 +1,105 @@ +let + my-lib = import ../lib.nix; + inherit (my-lib.globimport) getSubdirs lazyImport; + + listModules = getSubdirs ../../modules; + + mkNixosSystem = { + inputs, + hostname, + username, + module_types, + }: + inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs my-lib;}; + modules = [ + {networking.hostName = hostname;} + + ../../hosts/${hostname}/config.nix + + # Nixos-sided modules + { + imports = + [ + ../../modules/options.nix + ../../hosts/${hostname}/config.nix + (lazyImport ../../hosts/${hostname}/nixos.nix) + ] + ++ (listModules + |> (builtins.map (modName: [ + (lazyImport ../../modules/${modName}/options.nix) + (lazyImport ../../modules/${modName}/nixos/default.nix) + ])) + |> my-lib.flatten); + } + + # Home-sided modules + ( + if (builtins.elem "home" module_types) + then { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; + home-manager = { + backupFileExtension = "bak"; + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = {inherit inputs my-lib;}; + users.${username} = { + imports = + [ + ../../modules/options.nix + ../../hosts/${hostname}/config.nix + (lazyImport ../../hosts/${hostname}/home.nix) + { + home.preferXdgDirectories = true; + } + ] + ++ (listModules + |> (builtins.map (modName: [ + (lazyImport ../../modules/${modName}/options.nix) + (lazyImport ../../modules/${modName}/home/default.nix) + ])) + |> my-lib.flatten); + }; + }; + } + else {} + ) + + # Hjem-sided modules + ( + if (builtins.elem "hjem" module_types) + then { + imports = [ + inputs.hjem.nixosModules.hjem + ]; + hjem = { + extraModules = + [ + ../../modules/options.nix + ../../hosts/${hostname}/config.nix + (lazyImport ../../hosts/${hostname}/hjem.nix) + ] + ++ (listModules + |> (builtins.map (modName: [ + (lazyImport ../../modules/${modName}/options.nix) + (lazyImport ../../modules/${modName}/hjem/default.nix) + ])) + |> my-lib.flatten); + specialArgs = {inherit inputs my-lib;}; + users.${username} = { + enable = true; + user = username; + directory = "/home/${username}"; + }; + }; + } + else {} + ) + + # This is where we would add nix-on-droid modules + ]; + }; +in + mkNixosSystem diff --git a/modules/boot/nixos/default.nix b/modules/boot/nixos/default.nix new file mode 100644 index 0000000..53f18be --- /dev/null +++ b/modules/boot/nixos/default.nix @@ -0,0 +1,36 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.boot; +in { + imports = [ + ./plymouth.nix + ]; + + boot = + { + initrd = { + verbose = false; + systemd.enable = true; + }; + loader = { + systemd-boot = lib.optionalAttrs (cfg.systemd-boot.enable && !cfg.secureBoot.enable) { + enable = true; + configurationLimit = 3; + }; + efi.canTouchEfiVariables = true; + timeout = 0; + }; + } + // (lib.optionalAttrs cfg.secureBoot.enable { + lanzaboote = { + enable = true; + pkiBundle = "/var/lib/sbctl"; + }; + }); + + environment.systemPackages = lib.mkIf cfg.secureBoot.enable [pkgs.sbctl]; +} diff --git a/modules/boot/nixos/plymouth.nix b/modules/boot/nixos/plymouth.nix new file mode 100644 index 0000000..5f7952b --- /dev/null +++ b/modules/boot/nixos/plymouth.nix @@ -0,0 +1,21 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.boot.plymouth; +in + lib.mkIf cfg.enable { + boot.plymouth = { + enable = true; + theme = + if (cfg.theme == "catppuccin") + then "catppuccin-macchiato" # for whatever reason catppuccin-mocha has errors + else "nixos-bgrt"; + themePackages = + if (cfg.theme == "catppuccin") + then [pkgs.catppuccin-plymouth] + else [pkgs.nixos-bgrt-plymouth]; + }; + } diff --git a/modules/boot/system/default.nix b/modules/boot/system/default.nix deleted file mode 100644 index 53f18be..0000000 --- a/modules/boot/system/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.boot; -in { - imports = [ - ./plymouth.nix - ]; - - boot = - { - initrd = { - verbose = false; - systemd.enable = true; - }; - loader = { - systemd-boot = lib.optionalAttrs (cfg.systemd-boot.enable && !cfg.secureBoot.enable) { - enable = true; - configurationLimit = 3; - }; - efi.canTouchEfiVariables = true; - timeout = 0; - }; - } - // (lib.optionalAttrs cfg.secureBoot.enable { - lanzaboote = { - enable = true; - pkiBundle = "/var/lib/sbctl"; - }; - }); - - environment.systemPackages = lib.mkIf cfg.secureBoot.enable [pkgs.sbctl]; -} diff --git a/modules/boot/system/plymouth.nix b/modules/boot/system/plymouth.nix deleted file mode 100644 index 5f7952b..0000000 --- a/modules/boot/system/plymouth.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.boot.plymouth; -in - lib.mkIf cfg.enable { - boot.plymouth = { - enable = true; - theme = - if (cfg.theme == "catppuccin") - then "catppuccin-macchiato" # for whatever reason catppuccin-mocha has errors - else "nixos-bgrt"; - themePackages = - if (cfg.theme == "catppuccin") - then [pkgs.catppuccin-plymouth] - else [pkgs.nixos-bgrt-plymouth]; - }; - } diff --git a/modules/desktop/hjem/default.nix b/modules/desktop/hjem/default.nix new file mode 100644 index 0000000..a1a28c5 --- /dev/null +++ b/modules/desktop/hjem/default.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ./gtk.nix + + ./wm/sway.nix + ./wm/dunst.nix + ./wm/fuzzel.nix + + ./programs/foot.nix + ./programs/firefox.nix + ]; +} diff --git a/modules/desktop/hjem/gtk.nix b/modules/desktop/hjem/gtk.nix new file mode 100644 index 0000000..bee5936 --- /dev/null +++ b/modules/desktop/hjem/gtk.nix @@ -0,0 +1,37 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.desktop.gtk; +in { + packages = with pkgs; [ + dconf + + papirus-icon-theme + cfg.cursor_data.package + cfg.theme_data.package + ]; + + xdg.config.files = let + value.Settings = { + gtk-cursor-theme-name = cfg.cursor_data.name; + gtk-cursor-size = 24; + gtk-icon-theme-name = "Papirus"; + gtk-theme-name = cfg.theme_data.name; + }; + in { + "gtk-3.0/settings.ini" = { + generator = lib.generators.toINI {}; + inherit value; + }; + "gtk-4.0/settings.ini" = { + generator = lib.generators.toINI {}; + inherit value; + }; + "gtk-4.0/gtk.css".text = '' + @import url("file://${cfg.theme_data.package}/gtk-4.0/gtk.css"); + ''; + }; +} diff --git a/modules/desktop/hjem/programs/firefox.nix b/modules/desktop/hjem/programs/firefox.nix new file mode 100644 index 0000000..73040d2 --- /dev/null +++ b/modules/desktop/hjem/programs/firefox.nix @@ -0,0 +1,26 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.desktop.programs.firefox; +in + lib.mkIf cfg.enable { + files.".mozilla/firefox/profiles.ini" = { + generator = lib.generators.toINI {}; + value = { + Profile0 = { + Name = "collin"; + IsRelative = 1; + Path = "collin"; + Default = 1; + }; + General = { + StartWithLastProfile = 1; + Version = 2; + }; + }; + }; + packages = [pkgs.firefox]; + } diff --git a/modules/desktop/hjem/programs/foot.nix b/modules/desktop/hjem/programs/foot.nix new file mode 100644 index 0000000..4d630c6 --- /dev/null +++ b/modules/desktop/hjem/programs/foot.nix @@ -0,0 +1,61 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.desktop.programs.foot; + + settings = { + main = { + font = "Iosevka Nerd Font:size=12"; + shell = "${pkgs.fish}/bin/fish"; + }; + + colors = { + foreground = "cdd6f4"; + background = "1e1e2e"; + cursor = "11111b f5e0dc"; + + regular0 = "45475a"; + regular1 = "f38ba8"; + regular2 = "a6e3a1"; + regular3 = "f9e2af"; + regular4 = "89b4fa"; + regular5 = "f5c2e7"; + regular6 = "94e2d5"; + regular7 = "bac2de"; + + bright0 = "585b70"; + bright1 = "f38ba8"; + bright2 = "a6e3a1"; + bright3 = "f9e2af"; + bright4 = "89b4fa"; + bright5 = "f5c2e7"; + bright6 = "94e2d5"; + bright7 = "a6adc8"; + + "16" = "fab387"; + "17" = "f5e0dc"; + + selection-foreground = "cdd6f4"; + selection-background = "414356"; + + search-box-no-match = "11111b f38ba8"; + search-box-match = "cdd6f4 313244"; + + jump-labels = "11111b fab387"; + urls = "89b4fa"; + }; + }; +in + lib.mkIf cfg.enable { + files = { + ".config/foot/foot.ini" = { + generator = lib.generators.toINI {}; + value = settings; + }; + }; + + packages = [pkgs.foot]; + } diff --git a/modules/desktop/hjem/wm/dunst.nix b/modules/desktop/hjem/wm/dunst.nix new file mode 100644 index 0000000..38a8240 --- /dev/null +++ b/modules/desktop/hjem/wm/dunst.nix @@ -0,0 +1,36 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.collinux.desktop.sway.components.dunst; + + settings = '' + [global] + frame_color = "#89b4fa" + separator_color = frame + highlight = "#89b4fa" + offset = "(8,8)" + origin = "top-right" + transparency = 10 + font = "Iosevka Nerd Font" + + [urgency_low] + background = "#1e1e2e" + foreground = "#cdd6f4" + + [urgency_normal] + background = "#1e1e2e" + foreground = "#cdd6f4" + + [urgency_critical] + background = "#1e1e2e" + foreground = "#cdd6f4" + frame_color = "#fab387" + ''; +in + lib.mkIf cfg.enable { + files.".config/dunst/dunstrc".text = settings; + packages = with pkgs; [dunst inotify-tools]; + } diff --git a/modules/desktop/hjem/wm/fuzzel.nix b/modules/desktop/hjem/wm/fuzzel.nix new file mode 100644 index 0000000..7b9d075 --- /dev/null +++ b/modules/desktop/hjem/wm/fuzzel.nix @@ -0,0 +1,49 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.collinux.desktop.sway.components.fuzzel; + + settings = { + main = { + prompt = ""; + dpi-aware = false; + + font = "Iosevka Nerd Font"; + line-height = 25; + lines = 10; + width = 30; + + horizontal-pad = 8; + vertical-pad = 8; + }; + border = { + radius = 0; + width = 2; + }; + + colors = { + background = "1e1e2edd"; + text = "cdd6f4ff"; + prompt = "bac2deff"; + placeholder = "7f849cff"; + input = "cdd6f4ff"; + match = "89b4faff"; + selection = "585b70ff"; + selection-text = "cdd6f4ff"; + selection-match = "89b4faff"; + counter = "7f849cff"; + border = "89b4faff"; + }; + }; +in + lib.mkIf cfg.enable { + files.".config/fuzzel/fuzzel.ini" = { + generator = lib.generators.toINI {}; + value = settings; + }; + + packages = [pkgs.fuzzel]; + } diff --git a/modules/desktop/hjem/wm/sway.nix b/modules/desktop/hjem/wm/sway.nix new file mode 100644 index 0000000..1cd7750 --- /dev/null +++ b/modules/desktop/hjem/wm/sway.nix @@ -0,0 +1,110 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.desktop.sway; + + colors = '' + set $rosewater #f5e0dc + set $flamingo #f2cdcd + set $pink #f5c2e7 + set $mauve #cba6f7 + set $red #f38ba8 + set $maroon #eba0ac + set $peach #fab387 + set $yellow #f9e2af + set $green #a6e3a1 + set $teal #94e2d5 + set $sky #89dceb + set $sapphire #74c7ec + set $blue #89b4fa + set $lavender #b4befe + set $text #cdd6f4 + set $subtext1 #bac2de + set $subtext0 #a6adc8 + set $overlay2 #9399b2 + set $overlay1 #7f849c + set $overlay0 #6c7086 + set $surface2 #585b70 + set $surface1 #45475a + set $surface0 #313244 + set $base #1e1e2e + set $mantle #181825 + set $crust #11111b + ''; + + settings = '' + exec ${pkgs.foot}/bin/foot --server + exec ${pkgs.swaybg}/bin/swaybg -i ${config.collinux.desktop.wallpaper} + exec ${pkgs.dunst}/bin/dunst + + include catppuccin-mocha + + # target title bg text indicator border + client.focused $lavender $base $text $rosewater $lavender + client.focused_inactive $overlay0 $base $text $rosewater $overlay0 + client.unfocused $overlay0 $base $text $rosewater $overlay0 + client.urgent $peach $base $peach $overlay0 $peach + client.placeholder $overlay0 $base $text $overlay0 $overlay0 + client.background $base + + input type:keyboard { + xkb_options caps:none + } + + bindsym Mod4+1 workspace number 1 + bindsym Mod4+2 workspace number 2 + bindsym Mod4+3 workspace number 3 + bindsym Mod4+4 workspace number 4 + bindsym Mod4+5 workspace number 5 + bindsym Mod4+6 workspace number 6 + bindsym Mod4+7 workspace number 7 + bindsym Mod4+8 workspace number 8 + bindsym Mod4+9 workspace number 9 + + bindsym Mod4+Shift+1 move container to workspace number 1 + bindsym Mod4+Shift+2 move container to workspace number 2 + bindsym Mod4+Shift+3 move container to workspace number 3 + bindsym Mod4+Shift+4 move container to workspace number 4 + bindsym Mod4+Shift+5 move container to workspace number 5 + bindsym Mod4+Shift+6 move container to workspace number 6 + bindsym Mod4+Shift+7 move container to workspace number 7 + bindsym Mod4+Shift+8 move container to workspace number 8 + bindsym Mod4+Shift+9 move container to workspace number 9 + + bindsym Mod4+Return exec ${pkgs.foot}/bin/footclient + bindsym Mod4+Shift+Return exec ${pkgs.foot}/bin/foot + bindsym Mod4+Space exec ${pkgs.fuzzel}/bin/fuzzel + bindsym Mod4+b exec ${pkgs.firefox}/bin/firefox + bindsym Mod4+Shift+b exec ${pkgs.qutebrowser}/bin/qutebrowser + bindsym Mod4+q kill + + bindsym XF86AudioRaiseVolume exec 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; dunstify -t 300 -h string:x-canonical-private-synchronous:audio "Volume: " -h "int:value:$(dec=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d\" \" -f2);echo "$dec * 100" | ${pkgs.bc}/bin/bc)"' + bindsym XF86AudioLowerVolume exec 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; dunstify -t 300 -h string:x-canonical-private-synchronous:audio "Volume: " -h "int:value:$(dec=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d\" \" -f2);echo "$dec * 100" | ${pkgs.bc}/bin/bc)"' + + bindsym XF86MonBrightnessUp exec 'brightnessctl set 5%+; dunstify -t 300 -h string:x-canonical-private-synchronous:brightness "Brightness: " -h "int:value:$(g=$(brightnessctl get);m=$(brightnessctl max);echo $((g * 100 / m)))"' + bindsym XF86MonBrightnessDown exec 'brightnessctl set 5%-; dunstify -t 300 -h string:x-canonical-private-synchronous:brightness "Brightness: " -h "int:value:$(g=$(brightnessctl get);m=$(brightnessctl max);echo $((g * 100 / m)))"' + + bindsym Home exec 'playerctl previous' + bindsym End exec 'playerctl play-pause' + bindsym Insert exec 'playerctl next' + + default_border pixel 2 + smart_borders on + smart_gaps on + ''; +in + lib.mkIf cfg.enable { + files = { + ".config/sway/config".text = settings; + ".config/sway/catppuccin-mocha".text = colors; + }; + + packages = with pkgs; [ + sway + brightnessctl + playerctl + ]; + } diff --git a/modules/desktop/home/default.nix b/modules/desktop/home/default.nix index be5e97f..7671378 100644 --- a/modules/desktop/home/default.nix +++ b/modules/desktop/home/default.nix @@ -1,5 +1,5 @@ { imports = [ - ./gtk + ./gtk.nix ]; } diff --git a/modules/desktop/home/gtk.nix b/modules/desktop/home/gtk.nix new file mode 100644 index 0000000..a8f6be0 --- /dev/null +++ b/modules/desktop/home/gtk.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: let + cfg = config.collinux.desktop.gtk; +in + lib.mkIf (cfg.enable && cfg.theme == "adwaita") { + dconf = { + enable = true; + settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + enable-hot-corners = false; + }; + }; + }; + } diff --git a/modules/desktop/home/gtk/adwaita.nix b/modules/desktop/home/gtk/adwaita.nix deleted file mode 100644 index 1a17d13..0000000 --- a/modules/desktop/home/gtk/adwaita.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.desktop.gtk; -in - lib.mkIf (cfg.theme == "adwaita") { - home.pointerCursor = { - gtk.enable = true; - dotIcons.enable = false; - - package = pkgs.vanilla-dmz; - name = "Vanilla-DMZ"; - size = 24; - }; - - gtk.theme = { - name = "adw-gtk3"; - package = pkgs.adw-gtk3; - }; - - dconf = { - enable = true; - settings = { - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - enable-hot-corners = false; - }; - }; - }; - } diff --git a/modules/desktop/home/gtk/catppuccin.nix b/modules/desktop/home/gtk/catppuccin.nix deleted file mode 100644 index 81f0d3d..0000000 --- a/modules/desktop/home/gtk/catppuccin.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.desktop.gtk; -in - lib.mkIf (cfg.theme == "catppuccin") { - home.pointerCursor = { - hyprcursor = { - enable = true; - size = 24; - }; - gtk.enable = true; - dotIcons.enable = false; - - package = pkgs.catppuccin-cursors.mochaDark; - name = "catppuccin-mocha-dark-cursors"; - size = 24; - }; - - gtk = { - theme = { - package = pkgs.catppuccin-gtk.override { - accents = ["blue"]; - variant = "mocha"; - size = "standard"; - }; - name = "catppuccin-mocha-blue-standard"; - }; - }; - } diff --git a/modules/desktop/home/gtk/default.nix b/modules/desktop/home/gtk/default.nix deleted file mode 100644 index 8dc00f2..0000000 --- a/modules/desktop/home/gtk/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.gtk; -in { - imports = [ - ./catppuccin.nix - ./adwaita.nix - ]; - - config = { - home.packages = [pkgs.dconf]; - - gtk = { - enable = true; - iconTheme = { - package = pkgs.papirus-icon-theme; - name = "Papirus"; - }; - gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; - }; - }; -} diff --git a/modules/desktop/nixos/default.nix b/modules/desktop/nixos/default.nix new file mode 100644 index 0000000..23deeca --- /dev/null +++ b/modules/desktop/nixos/default.nix @@ -0,0 +1,11 @@ +{...}: { + imports = [ + ./gnome.nix + + ./greeters/greetd.nix + ./greeters/gdm.nix + + ./programs/firefox.nix + ./programs/blackbox.nix + ]; +} diff --git a/modules/desktop/nixos/gnome.nix b/modules/desktop/nixos/gnome.nix new file mode 100644 index 0000000..967452e --- /dev/null +++ b/modules/desktop/nixos/gnome.nix @@ -0,0 +1,120 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.desktop.gnome; +in + lib.mkIf cfg.enable { + services.desktopManager.gnome.enable = true; + + environment.gnome.excludePackages = with pkgs; [ + orca + evince + # file-roller + geary + # gnome-disk-utility + seahorse + # sushi + # sysprof + # gnome-shell-extensions + adwaita-icon-theme + # nixos-background-info + gnome-backgrounds + # gnome-bluetooth + # gnome-color-manager + # gnome-control-center + # gnome-shell-extensions + gnome-tour # GNOME Shell detects the .desktop file on first log-in. + gnome-user-docs + # glib # for gsettings program + # gnome-menus + # gtk3.out # for gtk-launch program + # xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/ + # xdg-user-dirs-gtk # Used to create the default bookmarks + # + baobab + epiphany + gnome-text-editor + gnome-calculator + gnome-calendar + gnome-characters + # gnome-clocks + gnome-console + gnome-contacts + gnome-font-viewer + gnome-logs + gnome-maps + gnome-music + # gnome-system-monitor + gnome-weather + # loupe + # nautilus + gnome-connections + simple-scan + snapshot + totem + yelp + gnome-software + ]; + + hjem.users."${config.collinux.user.name}".packages = with pkgs.gnomeExtensions; [blur-my-shell dash-to-dock]; + + programs.dconf = { + enable = true; + profiles.user.databases = [ + { + settings = { + "org/gnome/mutter" = { + workspaces-only-on-primary = false; + }; + "org/gnome/shell/app-switcher" = { + current-workspace-only = true; + }; + + # Idle settings + "org/gnome/desktop/session" = { + idle-delay = lib.gvariant.mkInt16 0; + }; + "org/gnome/settings-daemon/plugins/power" = { + sleep-inactive-ac-type = "nothing"; + }; + + # Keybindings + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + binding = "Return"; + command = "blackbox"; + name = "Terminal"; + }; + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + ]; + }; + + # Background + "org/gnome/desktop/background" = rec { + picture-uri = "file://${pkgs.gnome-backgrounds}/share/backgrounds/gnome/blobs-d.svg"; + picture-uri-dark = picture-uri; + }; + + # Extensions + "org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = with pkgs.gnomeExtensions; [ + blur-my-shell.extensionUuid + dash-to-dock.extensionUuid + ]; + }; + + "org/gnome/shell/extensions/dash-to-dock" = { + dash-max-icon-size = lib.gvariant.mkInt16 48; + show-trash = false; + show-mounts = false; + }; + }; + } + ]; + }; + } diff --git a/modules/desktop/nixos/greeters/gdm.nix b/modules/desktop/nixos/greeters/gdm.nix new file mode 100644 index 0000000..598114a --- /dev/null +++ b/modules/desktop/nixos/greeters/gdm.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: let + cfg = config.collinux.desktop.gdm; +in + lib.mkIf cfg.enable { + services.displayManager.gdm = { + enable = true; + wayland = true; + }; + } diff --git a/modules/desktop/nixos/greeters/greetd.nix b/modules/desktop/nixos/greeters/greetd.nix new file mode 100644 index 0000000..42ff9a7 --- /dev/null +++ b/modules/desktop/nixos/greeters/greetd.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: let + cfg = config.collinux.desktop.greetd; +in + lib.mkIf cfg.enable { + services.greetd = { + enable = true; + settings = rec { + initial_session = { + command = lib.getExe cfg.command; + user = config.collinux.user.name; + }; + default_session = initial_session; + }; + }; + } diff --git a/modules/desktop/nixos/programs/blackbox.nix b/modules/desktop/nixos/programs/blackbox.nix new file mode 100644 index 0000000..37567b5 --- /dev/null +++ b/modules/desktop/nixos/programs/blackbox.nix @@ -0,0 +1,31 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.desktop.programs.blackbox; +in + lib.mkIf cfg.enable { + programs.dconf.profiles.user.databases = [ + { + settings = { + "com/raggesilver/BlackBox" = { + context-aware-header-bar = true; + fill-tabs = true; + notify-process-completion = true; + opacity = lib.gvariant.mkInt16 100; + pixel-scrolling = true; + pretty = true; + show-scrollbars = false; + terminal-padding = lib.gvariant.mkTuple (builtins.map lib.gvariant.mkInt16 [10 10 10 10]); + + floating-controls = false; + show-headerbar = true; + }; + }; + } + ]; + + hjem.users."${config.collinux.user.name}".packages = [pkgs.blackbox-terminal]; + } diff --git a/modules/desktop/nixos/programs/firefox.nix b/modules/desktop/nixos/programs/firefox.nix new file mode 100644 index 0000000..8ca4b30 --- /dev/null +++ b/modules/desktop/nixos/programs/firefox.nix @@ -0,0 +1,37 @@ +{ + lib, + config, + ... +}: let + cfg = config.collinux.desktop.programs.firefox; +in + lib.mkIf cfg.enable { + programs.firefox = { + enable = true; + policies = { + PasswordManagerEnabled = false; # use bitwarden instead + DisableAccounts = true; + DisablePocket = true; + + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + + ExtensionSettings = let + ext = name: { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi"; + }; + in + lib.mkMerge [ + { + "{446900e4-71c2-419f-a6a7-df9c091e268b}" = ext "bitwarden-password-manager"; + "uBlock0@raymondhill.net" = ext "uBlock0@raymondhill.net"; + "addon@darkreader.org" = ext "addon@darkreader.org"; + } + (lib.optionalAttrs (cfg.theme == "catppuccin") { + "{88b098c8-19be-421e-8ffa-85ddd1f3f004}" = ext "catppuccin-mocha-blue"; + }) + ]; + }; + }; + } diff --git a/modules/desktop/options.nix b/modules/desktop/options.nix index 9bc4099..9a60ff6 100644 --- a/modules/desktop/options.nix +++ b/modules/desktop/options.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, my-lib, @@ -9,32 +10,85 @@ in { options = { collinux.desktop = { - greeter = mkOption { - type = types.enum ["gdm" "greetd"]; - default = let - cfg = config.collinux.desktop; - in - if (cfg.sway.enable && !cfg.gnome.enable) - then "greetd" - else "gdm"; - }; - wallpaper = mkOption { - type = types.path; + type = with types; oneOf [str path]; + description = "File to use as the wallpaper on this machine"; }; - components = { - waybar = mkProgramOption "waybar"; - dunst = mkProgramOption "dunst"; - fuzzel = mkProgramOption "fuzzel"; + greetd = { + enable = mkEnableOption "greetd greeter"; + command = mkOption { + type = lib.types.package; + default = let + cfg = config.collinux.desktop; + in + if (cfg.sway.enable && !cfg.gnome.enable) + then pkgs.sway + else null; + }; }; + gdm.enable = mkEnableOption "gdm display manager"; - sway.enable = mkEnableOption "sway"; + sway = { + enable = mkEnableOption "sway"; + components = { + # waybar = mkProgramOption "waybar"; + dunst = mkProgramOption "dunst"; + fuzzel = mkProgramOption "fuzzel"; + }; + }; gnome.enable = mkEnableOption "gnome"; - gtk.theme = mkOption { - type = types.enum ["catppuccin" "adwaita"]; - default = config.collinux.theme; + gtk = { + theme = mkOption { + type = types.enum ["catppuccin" "adwaita"]; + default = config.collinux.theme; + }; + cursor_data = { + package = mkOption { + type = lib.types.package; + default = + if (config.collinux.desktop.gtk.theme == "catppuccin") + then pkgs.catppuccin-cursors.mochaDark + else if (config.collinux.desktop.gtk.theme == "adwaita") + then pkgs.vanilla-dmz + else null; + }; + name = mkOption { + type = lib.types.str; + default = + if (config.collinux.desktop.gtk.theme == "catppuccin") + then "catppuccin-mocha-dark-cursors" + else if (config.collinux.desktop.gtk.theme == "adwaita") + then "Vanilla-DMZ" + else null; + }; + }; + theme_data = { + package = mkOption { + type = lib.types.package; + default = + if (config.collinux.desktop.gtk.theme == "catppuccin") + then + (pkgs.catppuccin-gtk.override { + variant = "mocha"; + accents = ["blue"]; + size = "standard"; + }) + else if (config.collinux.desktop.gtk.theme == "adwaita") + then pkgs.adw-gtk3 + else ""; + }; + name = mkOption { + type = lib.types.str; + default = + if (config.collinux.desktop.gtk.theme == "catppuccin") + then "catppuccin-mocha-blue-standard" + else if (config.collinux.desktop.gtk.theme == "adwaita") + then "adw-gtk3" + else ""; + }; + }; }; programs = { diff --git a/modules/desktop/system/components/dunst.nix b/modules/desktop/system/components/dunst.nix deleted file mode 100644 index 1069087..0000000 --- a/modules/desktop/system/components/dunst.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.collinux.desktop.components.dunst; - - settings = '' - [global] - frame_color = "#89b4fa" - separator_color = frame - highlight = "#89b4fa" - offset = "(8,8)" - origin = "top-right" - transparency = 10 - font = "Iosevka Nerd Font" - - [urgency_low] - background = "#1e1e2e" - foreground = "#cdd6f4" - - [urgency_normal] - background = "#1e1e2e" - foreground = "#cdd6f4" - - [urgency_critical] - background = "#1e1e2e" - foreground = "#cdd6f4" - frame_color = "#fab387" - ''; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files.".config/dunst/dunstrc".text = settings; - packages = [pkgs.dunst pkgs.inotify-tools]; - }; - } diff --git a/modules/desktop/system/components/fuzzel.nix b/modules/desktop/system/components/fuzzel.nix deleted file mode 100644 index f5937c6..0000000 --- a/modules/desktop/system/components/fuzzel.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.collinux.desktop.components.fuzzel; - ini' = pkgs.formats.ini {}; - - settings = ini'.generate "fuzzel.ini" { - main = { - prompt = " "; - dpi-aware = false; - - font = "Iosevka Nerd Font"; - line-height = 25; - lines = 10; - width = 30; - - horizontal-pad = 8; - vertical-pad = 8; - }; - border = { - radius = 0; - width = 2; - }; - - colors = { - background = "1e1e2edd"; - text = "cdd6f4ff"; - prompt = "bac2deff"; - placeholder = "7f849cff"; - input = "cdd6f4ff"; - match = "89b4faff"; - selection = "585b70ff"; - selection-text = "cdd6f4ff"; - selection-match = "89b4faff"; - counter = "7f849cff"; - border = "89b4faff"; - }; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/fuzzel/fuzzel.ini".source = settings; - }; - packages = [pkgs.fuzzel]; - }; - } diff --git a/modules/desktop/system/default.nix b/modules/desktop/system/default.nix deleted file mode 100644 index efc39bc..0000000 --- a/modules/desktop/system/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{...}: { - imports = [ - ./environments/gnome.nix - ./environments/sway.nix - - ./programs/firefox.nix - ./programs/foot.nix - ./programs/blackbox.nix - - ./components/fuzzel.nix - ./components/dunst.nix - ]; -} diff --git a/modules/desktop/system/environments/gnome.nix b/modules/desktop/system/environments/gnome.nix deleted file mode 100644 index e298756..0000000 --- a/modules/desktop/system/environments/gnome.nix +++ /dev/null @@ -1,124 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.desktop.gnome; -in - lib.mkIf cfg.enable { - services.displayManager.gdm = { - enable = true; - wayland = true; - }; - services.desktopManager.gnome.enable = true; - - environment.gnome.excludePackages = with pkgs; [ - orca - evince - file-roller - geary - gnome-disk-utility - seahorse - # sushi - # sysprof - # gnome-shell-extensions - adwaita-icon-theme - # nixos-background-info - gnome-backgrounds - # gnome-bluetooth - # gnome-color-manager - # gnome-control-center - # gnome-shell-extensions - gnome-tour # GNOME Shell detects the .desktop file on first log-in. - gnome-user-docs - # glib # for gsettings program - # gnome-menus - # gtk3.out # for gtk-launch program - # xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/ - # xdg-user-dirs-gtk # Used to create the default bookmarks - # - baobab - epiphany - gnome-text-editor - gnome-calculator - gnome-calendar - gnome-characters - # gnome-clocks - gnome-console - gnome-contacts - gnome-font-viewer - gnome-logs - gnome-maps - gnome-music - # gnome-system-monitor - gnome-weather - # loupe - # nautilus - gnome-connections - simple-scan - snapshot - totem - yelp - gnome-software - ]; - - hjem.users."${config.collinux.user.name}".packages = with pkgs.gnomeExtensions; [blur-my-shell dash-to-dock]; - - programs.dconf = { - enable = true; - profiles.user.databases = [ - { - settings = { - "org/gnome/mutter" = { - workspaces-only-on-primary = false; - }; - "org/gnome/shell/app-switcher" = { - current-workspace-only = true; - }; - - # Idle settings - "org/gnome/desktop/session" = { - idle-delay = lib.gvariant.mkInt16 0; - }; - "org/gnome/settings-daemon/plugins/power" = { - sleep-inactive-ac-type = "nothing"; - }; - - # Keybindings - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { - binding = "Return"; - command = "blackbox"; - name = "Terminal"; - }; - "org/gnome/settings-daemon/plugins/media-keys" = { - custom-keybindings = [ - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" - ]; - }; - - # Background - "org/gnome/desktop/background" = rec { - picture-uri = "file://${pkgs.gnome-backgrounds}/share/backgrounds/gnome/blobs-d.svg"; - picture-uri-dark = picture-uri; - }; - - # Extensions - "org/gnome/shell" = { - disable-user-extensions = false; - enabled-extensions = with pkgs.gnomeExtensions; [ - blur-my-shell.extensionUuid - dash-to-dock.extensionUuid - ]; - }; - - "org/gnome/shell/extensions/dash-to-dock" = { - dash-max-icon-size = lib.gvariant.mkInt16 48; - show-trash = false; - show-mounts = false; - }; - }; - } - ]; - }; - } diff --git a/modules/desktop/system/environments/sway.nix b/modules/desktop/system/environments/sway.nix deleted file mode 100644 index dec071a..0000000 --- a/modules/desktop/system/environments/sway.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.desktop.sway; - - colors = '' - set $rosewater #f5e0dc - set $flamingo #f2cdcd - set $pink #f5c2e7 - set $mauve #cba6f7 - set $red #f38ba8 - set $maroon #eba0ac - set $peach #fab387 - set $yellow #f9e2af - set $green #a6e3a1 - set $teal #94e2d5 - set $sky #89dceb - set $sapphire #74c7ec - set $blue #89b4fa - set $lavender #b4befe - set $text #cdd6f4 - set $subtext1 #bac2de - set $subtext0 #a6adc8 - set $overlay2 #9399b2 - set $overlay1 #7f849c - set $overlay0 #6c7086 - set $surface2 #585b70 - set $surface1 #45475a - set $surface0 #313244 - set $base #1e1e2e - set $mantle #181825 - set $crust #11111b - ''; - - settings = '' - exec ${pkgs.foot}/bin/foot --server - exec ${pkgs.swaybg}/bin/swaybg -i ${config.collinux.desktop.wallpaper} - exec ${pkgs.dunst}/bin/dunst - - include catppuccin-mocha - - # target title bg text indicator border - client.focused $lavender $base $text $rosewater $lavender - client.focused_inactive $overlay0 $base $text $rosewater $overlay0 - client.unfocused $overlay0 $base $text $rosewater $overlay0 - client.urgent $peach $base $peach $overlay0 $peach - client.placeholder $overlay0 $base $text $overlay0 $overlay0 - client.background $base - - input type:keyboard { - xkb_options caps:none - } - - bindsym Mod4+1 workspace number 1 - bindsym Mod4+2 workspace number 2 - bindsym Mod4+3 workspace number 3 - bindsym Mod4+4 workspace number 4 - bindsym Mod4+5 workspace number 5 - bindsym Mod4+6 workspace number 6 - bindsym Mod4+7 workspace number 7 - bindsym Mod4+8 workspace number 8 - bindsym Mod4+9 workspace number 9 - - bindsym Mod4+Shift+1 move container to workspace number 1 - bindsym Mod4+Shift+2 move container to workspace number 2 - bindsym Mod4+Shift+3 move container to workspace number 3 - bindsym Mod4+Shift+4 move container to workspace number 4 - bindsym Mod4+Shift+5 move container to workspace number 5 - bindsym Mod4+Shift+6 move container to workspace number 6 - bindsym Mod4+Shift+7 move container to workspace number 7 - bindsym Mod4+Shift+8 move container to workspace number 8 - bindsym Mod4+Shift+9 move container to workspace number 9 - - bindsym Mod4+Return exec ${pkgs.foot}/bin/footclient - bindsym Mod4+Shift+Return exec ${pkgs.foot}/bin/foot - bindsym Mod4+Space exec ${pkgs.fuzzel}/bin/fuzzel - bindsym Mod4+b exec ${pkgs.firefox}/bin/firefox - bindsym Mod4+Shift+b exec ${pkgs.qutebrowser}/bin/qutebrowser - bindsym Mod4+q kill - - bindsym XF86AudioRaiseVolume exec 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; dunstify -t 300 -h string:x-canonical-private-synchronous:audio "Volume: " -h "int:value:$(dec=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d\" \" -f2);echo "$dec * 100" | bc)"' - bindsym XF86AudioLowerVolume exec 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; dunstify -t 300 -h string:x-canonical-private-synchronous:audio "Volume: " -h "int:value:$(dec=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d\" \" -f2);echo "$dec * 100" | bc)"' - - bindsym XF86MonBrightnessUp exec 'brightnessctl set 5%+; dunstify -t 300 -h string:x-canonical-private-synchronous:brightness "Brightness: " -h "int:value:$(g=$(brightnessctl get);m=$(brightnessctl max);echo $((g * 100 / m)))"' - bindsym XF86MonBrightnessDown exec 'brightnessctl set 5%-; dunstify -t 300 -h string:x-canonical-private-synchronous:brightness "Brightness: " -h "int:value:$(g=$(brightnessctl get);m=$(brightnessctl max);echo $((g * 100 / m)))"' - - bindsym Home exec 'playerctl previous' - bindsym End exec 'playerctl play-pause' - bindsym Insert exec 'playerctl next' - - default_border pixel 2 - smart_borders on - smart_gaps on - ''; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/sway/config".text = settings; - ".config/sway/catppuccin-mocha".text = colors; - }; - - packages = [pkgs.sway pkgs.bc pkgs.brightnessctl pkgs.playerctl]; - }; - - # Greetd - services.greetd = { - enable = true; - settings = rec { - initial_session = { - command = "${pkgs.sway}/bin/sway"; - user = config.collinux.user.name; - }; - default_session = initial_session; - }; - }; - } diff --git a/modules/desktop/system/programs/blackbox.nix b/modules/desktop/system/programs/blackbox.nix deleted file mode 100644 index 37567b5..0000000 --- a/modules/desktop/system/programs/blackbox.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.desktop.programs.blackbox; -in - lib.mkIf cfg.enable { - programs.dconf.profiles.user.databases = [ - { - settings = { - "com/raggesilver/BlackBox" = { - context-aware-header-bar = true; - fill-tabs = true; - notify-process-completion = true; - opacity = lib.gvariant.mkInt16 100; - pixel-scrolling = true; - pretty = true; - show-scrollbars = false; - terminal-padding = lib.gvariant.mkTuple (builtins.map lib.gvariant.mkInt16 [10 10 10 10]); - - floating-controls = false; - show-headerbar = true; - }; - }; - } - ]; - - hjem.users."${config.collinux.user.name}".packages = [pkgs.blackbox-terminal]; - } diff --git a/modules/desktop/system/programs/firefox.nix b/modules/desktop/system/programs/firefox.nix deleted file mode 100644 index b2d83f3..0000000 --- a/modules/desktop/system/programs/firefox.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - lib, - config, - ... -}: let - cfg = config.collinux.desktop.programs.firefox; -in - lib.mkIf cfg.enable { - programs.firefox = { - enable = true; - policies = { - PasswordManagerEnabled = false; # use bitwarden instead - DisableAccounts = true; - DisablePocket = true; - - OverrideFirstRunPage = ""; - OverridePostUpdatePage = ""; - - ExtensionSettings = let - ext = name: { - installation_mode = "force_installed"; - install_url = "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi"; - }; - in - lib.mkMerge [ - { - "{446900e4-71c2-419f-a6a7-df9c091e268b}" = ext "bitwarden-password-manager"; - "uBlock0@raymondhill.net" = ext "uBlock0@raymondhill.net"; - "addon@darkreader.org" = ext "addon@darkreader.org"; - } - (lib.optionalAttrs (cfg.theme == "catppuccin") { - "{88b098c8-19be-421e-8ffa-85ddd1f3f004}" = ext "catppuccin-mocha-blue"; - }) - ]; - }; - }; - - hjem.users."${config.collinux.user.name}".files = { - ".mozilla/firefox/profiles.ini".text = '' - [Profile0] - Name=collin - IsRelative=1 - Path=collin - Default=1 - - [General] - StartWithLastProfile=1 - Version=2 - ''; - }; - } diff --git a/modules/desktop/system/programs/foot.nix b/modules/desktop/system/programs/foot.nix deleted file mode 100644 index 1b99ce3..0000000 --- a/modules/desktop/system/programs/foot.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.desktop.programs.foot; - - settings = { - main = { - font = "Iosevka Nerd Font:size=12"; - shell = "${pkgs.fish}/bin/fish"; - }; - - colors = { - foreground = "cdd6f4"; - background = "1e1e2e"; - cursor = "11111b f5e0dc"; - - regular0 = "45475a"; - regular1 = "f38ba8"; - regular2 = "a6e3a1"; - regular3 = "f9e2af"; - regular4 = "89b4fa"; - regular5 = "f5c2e7"; - regular6 = "94e2d5"; - regular7 = "bac2de"; - - bright0 = "585b70"; - bright1 = "f38ba8"; - bright2 = "a6e3a1"; - bright3 = "f9e2af"; - bright4 = "89b4fa"; - bright5 = "f5c2e7"; - bright6 = "94e2d5"; - bright7 = "a6adc8"; - - "16" = "fab387"; - "17" = "f5e0dc"; - - selection-foreground = "cdd6f4"; - selection-background = "414356"; - - search-box-no-match = "11111b f38ba8"; - search-box-match = "cdd6f4 313244"; - - jump-labels = "11111b fab387"; - urls = "89b4fa"; - }; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/foot/foot.ini" = { - generator = lib.generators.toINI {}; - value = settings; - }; - }; - - packages = [pkgs.foot]; - }; - } diff --git a/modules/nix/nixos/default.nix b/modules/nix/nixos/default.nix new file mode 100644 index 0000000..9c5c51e --- /dev/null +++ b/modules/nix/nixos/default.nix @@ -0,0 +1,30 @@ +{config, pkgs, ...}: { + nix = { + gc.automatic = false; # use nh cleaner instead + + # Make builds run with low priority so my system stays responsive + daemonCPUSchedPolicy = "idle"; + daemonIOSchedClass = "idle"; + + settings = { + extra-experimental-features = ["nix-command" "flakes" "pipe-operators"]; + auto-optimise-store = true; + use-xdg-base-directories = true; + }; + }; + + # Disable channels + nix.channel.enable = false; + + nixpkgs = { + config.allowUnfree = true; + }; + + programs.nh = { + enable = true; + flake = "/home/collin/nixos"; + clean.enable = true; + }; + + hjem.users."${config.collinux.user.name}".packages = [pkgs.cached-nix-shell]; +} diff --git a/modules/nix/system/default.nix b/modules/nix/system/default.nix deleted file mode 100644 index 9c5c51e..0000000 --- a/modules/nix/system/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{config, pkgs, ...}: { - nix = { - gc.automatic = false; # use nh cleaner instead - - # Make builds run with low priority so my system stays responsive - daemonCPUSchedPolicy = "idle"; - daemonIOSchedClass = "idle"; - - settings = { - extra-experimental-features = ["nix-command" "flakes" "pipe-operators"]; - auto-optimise-store = true; - use-xdg-base-directories = true; - }; - }; - - # Disable channels - nix.channel.enable = false; - - nixpkgs = { - config.allowUnfree = true; - }; - - programs.nh = { - enable = true; - flake = "/home/collin/nixos"; - clean.enable = true; - }; - - hjem.users."${config.collinux.user.name}".packages = [pkgs.cached-nix-shell]; -} diff --git a/modules/services/nixos/audio.nix b/modules/services/nixos/audio.nix new file mode 100644 index 0000000..93f8289 --- /dev/null +++ b/modules/services/nixos/audio.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.services.audio; +in + lib.mkIf cfg.enable { + security.rtkit.enable = true; + services.pipewire = { + enable = true; + wireplumber.enable = true; + alsa.enable = true; + + pulse.enable = cfg.pulse.enable; + }; + + environment.systemPackages = [pkgs.pwvucontrol]; + } diff --git a/modules/services/nixos/bluetooth.nix b/modules/services/nixos/bluetooth.nix new file mode 100644 index 0000000..a86b5b3 --- /dev/null +++ b/modules/services/nixos/bluetooth.nix @@ -0,0 +1,19 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.services.bluetooth; +in + lib.mkIf cfg.enable { + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + + environment.systemPackages = [ + (lib.mkIf cfg.blueman.enable pkgs.blueman) + (lib.mkIf cfg.bluetuith.enable pkgs.bluetuith) + ]; + } diff --git a/modules/services/nixos/default.nix b/modules/services/nixos/default.nix new file mode 100644 index 0000000..b9ae4c7 --- /dev/null +++ b/modules/services/nixos/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./networking + ./audio.nix + ./bluetooth.nix + ./tailscale.nix + ]; +} diff --git a/modules/services/nixos/networking/default.nix b/modules/services/nixos/networking/default.nix new file mode 100644 index 0000000..68c794c --- /dev/null +++ b/modules/services/nixos/networking/default.nix @@ -0,0 +1,18 @@ +{ + imports = [ + ./iwd.nix + ./networkmanager.nix + ]; + + config = { + services.resolved = { + enable = true; + domains = [ + "10.0.0.1" + "10.0.0.10" + ]; + }; + + networking.resolvconf.enable = false; + }; +} diff --git a/modules/services/nixos/networking/iwd.nix b/modules/services/nixos/networking/iwd.nix new file mode 100644 index 0000000..d081792 --- /dev/null +++ b/modules/services/nixos/networking/iwd.nix @@ -0,0 +1,26 @@ +{ + lib, + config, + ... +}: let + cfg = config.collinux.services.networking; +in + lib.mkIf (cfg.enable && cfg.iwd.enable) { + networking = { + wireless.iwd = { + enable = true; + settings = { + General = { + EnableNetworkConfiguration = true; # use builtin dhcp client + AddressRandomization = "once"; + }; + Network.NameResolvingService = "systemd"; # either systemd or resolvconf + }; + }; + + # Disable default networking stuff + dhcpcd.enable = false; + useDHCP = false; + networkmanager.enable = false; + }; + } diff --git a/modules/services/nixos/networking/networkmanager.nix b/modules/services/nixos/networking/networkmanager.nix new file mode 100644 index 0000000..f22f922 --- /dev/null +++ b/modules/services/nixos/networking/networkmanager.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + ... +}: let + cfg = config.collinux.services.networking; +in + lib.mkIf (cfg.enable && cfg.networkmanager.enable) { + networking = { + nameservers = ["1.1.1.1" "1.0.0.1"]; + enableIPv6 = false; + + networkmanager.enable = true; + }; + } diff --git a/modules/services/nixos/tailscale.nix b/modules/services/nixos/tailscale.nix new file mode 100644 index 0000000..3fbd691 --- /dev/null +++ b/modules/services/nixos/tailscale.nix @@ -0,0 +1,15 @@ +{ + config, + pkgs, + lib, + ... +}: let + cfg = config.collinux.services.networking.tailscale; +in + lib.mkIf cfg.enable { + services.tailscale = { + enable = true; + useRoutingFeatures = "both"; + }; + environment.systemPackages = [pkgs.tailscale]; + } diff --git a/modules/services/system/audio.nix b/modules/services/system/audio.nix deleted file mode 100644 index 93f8289..0000000 --- a/modules/services/system/audio.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.services.audio; -in - lib.mkIf cfg.enable { - security.rtkit.enable = true; - services.pipewire = { - enable = true; - wireplumber.enable = true; - alsa.enable = true; - - pulse.enable = cfg.pulse.enable; - }; - - environment.systemPackages = [pkgs.pwvucontrol]; - } diff --git a/modules/services/system/bluetooth.nix b/modules/services/system/bluetooth.nix deleted file mode 100644 index a86b5b3..0000000 --- a/modules/services/system/bluetooth.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.services.bluetooth; -in - lib.mkIf cfg.enable { - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - - environment.systemPackages = [ - (lib.mkIf cfg.blueman.enable pkgs.blueman) - (lib.mkIf cfg.bluetuith.enable pkgs.bluetuith) - ]; - } diff --git a/modules/services/system/default.nix b/modules/services/system/default.nix deleted file mode 100644 index b9ae4c7..0000000 --- a/modules/services/system/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./networking - ./audio.nix - ./bluetooth.nix - ./tailscale.nix - ]; -} diff --git a/modules/services/system/networking/default.nix b/modules/services/system/networking/default.nix deleted file mode 100644 index 68c794c..0000000 --- a/modules/services/system/networking/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - imports = [ - ./iwd.nix - ./networkmanager.nix - ]; - - config = { - services.resolved = { - enable = true; - domains = [ - "10.0.0.1" - "10.0.0.10" - ]; - }; - - networking.resolvconf.enable = false; - }; -} diff --git a/modules/services/system/networking/iwd.nix b/modules/services/system/networking/iwd.nix deleted file mode 100644 index d081792..0000000 --- a/modules/services/system/networking/iwd.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - lib, - config, - ... -}: let - cfg = config.collinux.services.networking; -in - lib.mkIf (cfg.enable && cfg.iwd.enable) { - networking = { - wireless.iwd = { - enable = true; - settings = { - General = { - EnableNetworkConfiguration = true; # use builtin dhcp client - AddressRandomization = "once"; - }; - Network.NameResolvingService = "systemd"; # either systemd or resolvconf - }; - }; - - # Disable default networking stuff - dhcpcd.enable = false; - useDHCP = false; - networkmanager.enable = false; - }; - } diff --git a/modules/services/system/networking/networkmanager.nix b/modules/services/system/networking/networkmanager.nix deleted file mode 100644 index f22f922..0000000 --- a/modules/services/system/networking/networkmanager.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - config, - ... -}: let - cfg = config.collinux.services.networking; -in - lib.mkIf (cfg.enable && cfg.networkmanager.enable) { - networking = { - nameservers = ["1.1.1.1" "1.0.0.1"]; - enableIPv6 = false; - - networkmanager.enable = true; - }; - } diff --git a/modules/services/system/tailscale.nix b/modules/services/system/tailscale.nix deleted file mode 100644 index 3fbd691..0000000 --- a/modules/services/system/tailscale.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - cfg = config.collinux.services.networking.tailscale; -in - lib.mkIf cfg.enable { - services.tailscale = { - enable = true; - useRoutingFeatures = "both"; - }; - environment.systemPackages = [pkgs.tailscale]; - } diff --git a/modules/terminal/hjem/default.nix b/modules/terminal/hjem/default.nix new file mode 100644 index 0000000..7915319 --- /dev/null +++ b/modules/terminal/hjem/default.nix @@ -0,0 +1,15 @@ +{ + imports = [ + ./programs/fzf.nix + ./programs/bat.nix + ./programs/lazygit.nix + ./programs/eza.nix + ./programs/starship.nix + ./programs/git.nix + ./programs/tmux.nix + ./programs/broot.nix + ./programs/cmus.nix + ./programs/helix.nix + ./programs/fish.nix + ]; +} diff --git a/modules/terminal/hjem/programs/bash.nix b/modules/terminal/hjem/programs/bash.nix new file mode 100644 index 0000000..646cbf8 --- /dev/null +++ b/modules/terminal/hjem/programs/bash.nix @@ -0,0 +1,29 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.bash; +in + lib.mkIf cfg.enable { + files = { + ".bashrc".text = '' + eval "$(direnv hook bash)" + + for file in ~/.config/bash/conf.d/*; do source "$file"; done + ''; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + ]; + }; + } diff --git a/modules/terminal/hjem/programs/bat.nix b/modules/terminal/hjem/programs/bat.nix new file mode 100644 index 0000000..3d605cc --- /dev/null +++ b/modules/terminal/hjem/programs/bat.nix @@ -0,0 +1,25 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.bat; +in + lib.mkIf cfg.enable { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/bat.fish".text = '' + alias cat bat + set -gx BAT_THEME "base16" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/fish/conf.d/bat.bash".text = '' + alias cat="bat" + export BAT_THEME="base16" + ''; + }); + + packages = [pkgs.bat]; + } diff --git a/modules/terminal/hjem/programs/broot.nix b/modules/terminal/hjem/programs/broot.nix new file mode 100644 index 0000000..72098f8 --- /dev/null +++ b/modules/terminal/hjem/programs/broot.nix @@ -0,0 +1,136 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; + + conf = { + skin = catppuccin_skin; + verbs = [ + { + name = "open-code"; + key = "enter"; + execution = "$EDITOR +{line} {file}"; + working_dir = "{root}"; + apply_to = "file"; + leave_broot = true; + } + ]; + }; + + catppuccin_skin = { + input = "rgb(205, 214, 244) none"; + selected_line = "none rgb(88, 91, 112)"; + default = "rgb(205, 214, 244) none"; + tree = "rgb(108, 112, 134) none"; + parent = "rgb(116, 199, 236) none"; + file = "none none"; + + perm__ = "rgb(186, 194, 222) none"; + perm_r = "rgb(250, 179, 135) none"; + perm_w = "rgb(235, 160, 172) none"; + perm_x = "rgb(166, 227, 161) none"; + owner = "rgb(148, 226, 213) none"; + group = "rgb(137, 220, 235) none"; + + dates = "rgb(186, 194, 222) none"; + + directory = "rgb(180, 190, 254) none Bold"; + exe = "rgb(166, 227, 161) none"; + link = "rgb(249, 226, 175) none"; + pruning = "rgb(166, 173, 200) none Italic"; + + preview_title = "rgb(205, 214, 244) rgb(24, 24, 37)"; + preview = "rgb(205, 214, 244) rgb(24, 24, 37)"; + preview_line_number = "rgb(108, 112, 134) none"; + preview_separator = "rgb(108, 112, 134) none"; + + char_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + content_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + preview_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + + count = "rgb(249, 226, 175) none"; + sparse = "rgb(243, 139, 168) none"; + content_extract = "rgb(243, 139, 168) none Italic"; + + git_branch = "rgb(250, 179, 135) none"; + git_insertions = "rgb(250, 179, 135) none"; + git_deletions = "rgb(250, 179, 135) none"; + git_status_current = "rgb(250, 179, 135) none"; + git_status_modified = "rgb(250, 179, 135) none"; + git_status_new = "rgb(250, 179, 135) none Bold"; + git_status_ignored = "rgb(250, 179, 135) none"; + git_status_conflicted = "rgb(250, 179, 135) none"; + git_status_other = "rgb(250, 179, 135) none"; + staging_area_title = "rgb(250, 179, 135) none"; + + flag_label = "rgb(243, 139, 168) none"; + flag_value = "rgb(243, 139, 168) none Bold"; + + status_normal = "none rgb(24, 24, 37)"; + status_italic = "rgb(243, 139, 168) rgb(24, 24, 37) Italic"; + status_bold = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + status_ellipsis = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + status_error = "rgb(205, 214, 244) rgb(243, 139, 168)"; + status_job = "rgb(235, 160, 172) rgb(40, 38, 37)"; + status_code = "rgb(235, 160, 172) rgb(24, 24, 37) Italic"; + mode_command_mark = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + + help_paragraph = "rgb(205, 214, 244) none"; + help_headers = "rgb(243, 139, 168) none Bold"; + help_bold = "rgb(250, 179, 135) none Bold"; + help_italic = "rgb(249, 226, 175) none Italic"; + help_code = "rgb(166, 227, 161) rgb(49, 50, 68)"; + help_table_border = "rgb(108, 112, 134) none"; + + hex_null = "rgb(205, 214, 244) none"; + hex_ascii_graphic = "rgb(250, 179, 135) none"; + hex_ascii_whitespace = "rgb(166, 227, 161) none"; + hex_ascii_other = "rgb(148, 226, 213) none"; + hex_non_ascii = "rgb(243, 139, 168) none"; + + file_error = "rgb(251, 73, 52) none"; + + purpose_normal = "none none"; + purpose_italic = "rgb(177, 98, 134) none Italic"; + purpose_bold = "rgb(177, 98, 134) none Bold"; + purpose_ellipsis = "none none"; + + scrollbar_track = "rgb(49, 50, 68) none"; + scrollbar_thumb = "rgb(88, 91, 112) none"; + + good_to_bad_0 = "rgb(166, 227, 161) none"; + good_to_bad_1 = "rgb(148, 226, 213) none"; + good_to_bad_2 = "rgb(137, 220, 235) none"; + good_to_bad_3 = "rgb(116, 199, 236) none"; + good_to_bad_4 = "rgb(137, 180, 250) none"; + good_to_bad_5 = "rgb(180, 190, 254) none"; + good_to_bad_6 = "rgb(203, 166, 247) none"; + good_to_bad_7 = "rgb(250, 179, 135) none"; + good_to_bad_8 = "rgb(235, 160, 172) none"; + good_to_bad_9 = "rgb(243, 139, 168) none"; + }; +in + lib.mkIf cfg.enable { + files = + { + ".config/broot/conf.toml" = { + generator = (pkgs.formats.toml {}).generate "conf.toml"; + value = conf; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/broot.fish".text = '' + broot --print-shell-function fish | source + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/broot.bash".text = '' + eval "$(broot --print-shell-function bash)" + ''; + }); + + packages = [pkgs.broot]; + } diff --git a/modules/terminal/hjem/programs/cmus.nix b/modules/terminal/hjem/programs/cmus.nix new file mode 100644 index 0000000..afd2350 --- /dev/null +++ b/modules/terminal/hjem/programs/cmus.nix @@ -0,0 +1,95 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.cmus; + + scriptsDir = "~/.config/cmus/scripts"; + + scripts.statusDisplay = '' + while [ $# -ge 2 ]; do + eval _$1='$2' + shift + shift + done + + [ -d ~/.local/share/cmus ] || mkdir ~/.local/share/cmus + + if [ -n "$_file" ]; then + ${pkgs.ffmpeg}/bin/ffmpeg -i "$_file" -y -an -c:v copy ~/.local/share/cmus/curr_cover.jpg || rm ~/.local/share/cmus/curr_cover.jpg + fi + + ${pkgs.dunst}/bin/dunstify -t 2000 -u low -h string:x-canonical-private-synchronous:music -i ~/.local/share/cmus/curr_cover.jpg "$_status: $_title" "$_artist" + ''; + + cmus_theme = '' + set color_cmdline_bg=default + set color_cmdline_fg=default + set color_error=211 + set color_info=223 + set color_separator=8 + set color_statusline_bg=default + set color_statusline_fg=default + set color_titleline_bg=183 + set color_titleline_fg=8 + set color_titleline_attr=bold + set color_win_bg=default + set color_win_cur=117 + set color_win_cur_sel_bg=117 + set color_win_cur_sel_fg=235 + set color_win_dir=default + set color_win_fg=default + set color_win_inactive_cur_sel_bg=0 + set color_win_inactive_cur_sel_fg=default + set color_win_inactive_sel_bg=0 + set color_win_inactive_sel_fg=default + set color_win_sel_bg=15 + set color_win_sel_fg=235 + set color_win_title_bg=default + set color_win_title_fg=183 + set color_win_title_attr=bold + ''; + + cmus_rc = '' + ${ + if (cfg.theme == "catppuccin") + then "colorscheme catppuccin" + else "" + } + set status_display_program=${scriptsDir}/status.sh + ''; + + cava_config = + if cfg.theme == "catppuccin" + then '' + [color] + gradient=1 + gradient_color_1='#94e2d5' + gradient_color_2='#89dceb' + gradient_color_3='#74c7ec' + gradient_color_4='#89b4fa' + gradient_color_5='#cba6f7' + gradient_color_6='#f5c2e7' + gradient_color_7='#eba0ac' + gradient_color_8='#f38ba8' + '' + else ""; +in + lib.mkIf cfg.enable { + files = let + e = text: { + inherit text; + executable = true; + }; + in { + ".config/cmus/scripts/status.sh" = e scripts.statusDisplay; + + ".config/cmus/rc".text = cmus_rc; + ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme; + ".config/cava/config".text = cava_config; + }; + + packages = with pkgs; [cava cmus]; + } diff --git a/modules/terminal/hjem/programs/eza.nix b/modules/terminal/hjem/programs/eza.nix new file mode 100644 index 0000000..b900ceb --- /dev/null +++ b/modules/terminal/hjem/programs/eza.nix @@ -0,0 +1,25 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.eza; +in + lib.mkIf cfg.enable { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/eza.fish".text = '' + alias ls "eza -A -w 80 --group-directories-first -I '.git*'" + alias tree "eza -T" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/bash/conf.d/eza.bash".text = '' + alias ls="eza -A -w 80 --group-directories-first -I '.git*'" + alias tree="eza -T" + ''; + }); + + packages = [pkgs.eza]; + } diff --git a/modules/terminal/hjem/programs/fish.nix b/modules/terminal/hjem/programs/fish.nix new file mode 100644 index 0000000..1aa4a40 --- /dev/null +++ b/modules/terminal/hjem/programs/fish.nix @@ -0,0 +1,35 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; +in + lib.mkIf cfg.enable { + files = { + ".config/fish/config.fish".text = '' + set fish_greeting + + function fish_title + echo fish (prompt_pwd) + end + + direnv hook fish | source + pay-respects fish --alias | source + ''; + }; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + pay-respects + ]; + } diff --git a/modules/terminal/hjem/programs/fzf.nix b/modules/terminal/hjem/programs/fzf.nix new file mode 100644 index 0000000..5a51739 --- /dev/null +++ b/modules/terminal/hjem/programs/fzf.nix @@ -0,0 +1,25 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.fzf; +in + lib.mkIf cfg.enable { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/fzf.fish".text = '' + fzf --fish | source + set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/fzf.bash".text = '' + eval "$(fzf --bash)" + export FZF_DEFAULT_OPTS="--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }); + + packages = [pkgs.fzf]; + } diff --git a/modules/terminal/hjem/programs/git.nix b/modules/terminal/hjem/programs/git.nix new file mode 100644 index 0000000..d196f26 --- /dev/null +++ b/modules/terminal/hjem/programs/git.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.collinux.terminal.programs.git; + + git_config = { + alias = { + stage = "add"; + unstage = "restore --staged"; + }; + init.defaultBranch = "main"; + user = { + email = cfg.userEmail; + name = cfg.userName; + }; + }; +in { + files = { + ".config/git/config" = { + generator = lib.generators.toGitINI; + value = git_config; + }; + }; + + packages = [pkgs.git]; +} diff --git a/modules/terminal/hjem/programs/helix.nix b/modules/terminal/hjem/programs/helix.nix new file mode 100644 index 0000000..2c30881 --- /dev/null +++ b/modules/terminal/hjem/programs/helix.nix @@ -0,0 +1,165 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.helix; + + languages = { + language-server = { + rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; + + nil = { + command = "${pkgs.nil}/bin/nil"; + config = { + nil.nix.flake.autoArchive = true; + }; + }; + superhtml = { + command = "${pkgs.superhtml}/bin/superhtml"; + args = ["lsp"]; + }; + dhall-lsp-server.command = "${pkgs.dhall-lsp-server}/bin/dhall-lsp-server"; + }; + + language = [ + { + name = "nix"; + file-types = ["nix"]; + language-servers = ["nil"]; + indent = { + tab-width = 2; + unit = " "; + }; + formatter.command = "${pkgs.alejandra}/bin/alejandra"; + auto-format = true; + } + { + name = "html"; + file-types = ["html"]; + language-servers = ["superhtml"]; + auto-format = true; + } + ]; + }; + + theme = { + inherits = "catppuccin_mocha"; + "ui.background" = {}; + }; + + mkHelixConfig = { + theme, + hardMode ? false, + }: { + inherit theme; + editor = { + gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; + cursorline = true; + color-modes = true; + + mouse = !hardMode; + + lsp.display-inlay-hints = true; + + statusline = { + left = ["mode" "file-name" "spacer" "file-modification-indicator"]; + right = ["spinner" "spacer" "workspace-diagnostics" "file-type"]; + separator = "x"; + }; + + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + }; + keys = { + normal = + { + "C-space" = "expand_selection"; + "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"]; + "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"]; + "X" = ["extend_line_up" "extend_to_line_bounds"]; + "C-left" = "goto_line_start"; + "C-right" = "goto_line_end"; + ";" = "flip_selections"; + "esc" = ["collapse_selection" "keep_primary_selection"]; + + # I don't even use these anyway + "pageup" = "no_op"; + "pagedown" = "no_op"; + "home" = "no_op"; + "end" = "no_op"; + } + // ( + if hardMode + then { + "up" = "no_op"; + "down" = "no_op"; + "left" = "no_op"; + "right" = "no_op"; + } + else {} + ); + + insert = + { + "pageup" = "no_op"; + "pagedown" = "no_op"; + "home" = "no_op"; + "end" = "no_op"; + } + // ( + if hardMode + then { + "up" = "no_op"; + "down" = "no_op"; + "left" = "no_op"; + "right" = "no_op"; + } + else {} + ); + + select = { + "esc" = ["collapse_selection" "insert_mode"]; + }; + }; + }; + + settings = mkHelixConfig { + inherit (cfg) hardMode; + theme = + if cfg.theme == "catppuccin" + then "catppuccin_mocha_transparent" + else if cfg.theme == "adwaita" + then "adwaita_dark" + else ""; + }; +in + lib.mkIf cfg.enable { + files = let + t = value: { + generator = (pkgs.formats.toml {}).generate "toml_file"; + inherit value; + }; + in + { + ".config/helix/config.toml" = t settings; + ".config/helix/languages.toml" = t languages; + ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/helix.fish".text = '' + set -gx EDITOR hx + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/helix.bash".text = '' + EDITOR=hx + ''; + }); + + packages = [pkgs.helix]; + } diff --git a/modules/terminal/hjem/programs/lazygit.nix b/modules/terminal/hjem/programs/lazygit.nix new file mode 100644 index 0000000..a939446 --- /dev/null +++ b/modules/terminal/hjem/programs/lazygit.nix @@ -0,0 +1,39 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.lazygit; + + settings = { + git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy"; + gui = { + showRandomTip = false; + commitLength.show = false; + showListFooter = false; + showCommandLog = false; + showPanelJumps = false; + statusPanelView = "allBranchesLog"; + }; + update.method = "never"; + notARepository = "quit"; + + quitOnTopLevelReturn = true; + disableStartupPopups = true; + promptToReturnFromSubprocess = false; + + theme.inactiveBorderColor = ["#313244"]; + theme.activeBorderColor = ["#89b4fa"]; + }; +in + lib.mkIf cfg.enable { + files = { + ".config/lazygit/config.yml" = { + generator = lib.generators.toYAML {}; + value = settings; + }; + }; + + packages = [pkgs.lazygit]; + } diff --git a/modules/terminal/hjem/programs/starship.nix b/modules/terminal/hjem/programs/starship.nix new file mode 100644 index 0000000..e9d79b5 --- /dev/null +++ b/modules/terminal/hjem/programs/starship.nix @@ -0,0 +1,62 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.starship; + + settings = { + format = ''$directory$git_branch$git_status $character''; + + add_newline = false; + scan_timeout = 10; + + character = { + success_symbol = "[λ](green bold)"; + error_symbol = "[Σ](red bold)"; + }; + + git_branch.format = "[@$branch](underline)"; + + git_status = { + format = "$modified$staged$ahead$behind"; + modified = "[!](red bold)"; + staged = "[+](green bold)"; + ahead = "[/](green)"; + behind = "[\](red)"; + }; + + directory = { + format = "$path"; + truncation_length = 3; + truncate_to_repo = true; + }; + }; +in + lib.mkIf cfg.enable { + files = + { + ".config/starship.toml" = { + generator = (pkgs.formats.toml {}).generate "starship.toml"; + value = settings; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/starship.fish".text = '' + function starship_transient_prompt_func + starship module character + end + + starship init fish | source + enable_transience + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/starship.bash".text = '' + eval "$(starship init bash)" + ''; + }); + + packages = [pkgs.starship]; + } diff --git a/modules/terminal/hjem/programs/tmux.nix b/modules/terminal/hjem/programs/tmux.nix new file mode 100644 index 0000000..e20d041 --- /dev/null +++ b/modules/terminal/hjem/programs/tmux.nix @@ -0,0 +1,330 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.collinux.terminal.programs.tmux; + + scriptsDir = "~/.config/tmux/scripts"; + + scripts.minibuffer = '' + window_height="$(tmux display -p '#{window_height}')" + tmux display-popup -EB \ + -w 100% -h 16 \ + -x 0 -y "$(($window_height + 1))" \ + "$@" + ''; + + scripts.menu = '' + tmux display-menu \ + -x "#{window_width}" -y S \ + -b none \ + -s "bg=#313244,fg=#9399b2" \ + -S "bg=#313244" \ + -H "bg=#45475a fg=#b4befe" \ + "$@" + ''; + + scripts.paneSplit = '' + width=$(tmux display -p "#{pane_width}") + height=$(tmux display -p "#{pane_height}") + + if (( $(echo "$width / $height > 2.5" | bc -l) )); then + tmux split-window -h "$@" + else + tmux split-window -v "$@" + fi + ''; + + # -- SESSIONIZER -- + broot_sessionizer_config = { + imports = ["~/.config/broot/conf.toml"]; + quit_on_last_cancel = true; + verbs = [ + { + invocation = "sessionizer"; + external = ''bash -c -- "${scriptsDir}/sessionizer.sh '{file}'"''; + key = "enter"; + apply_to = "directory"; + leave_broot = true; + } + ]; + }; + + scripts.sessionizer = '' + selected="$1" + + session_name="$(basename "$selected" | tr '.' '_')" + + # if the session doesn't exist, create it + if tmux list-sessions -F '#{session_name}' | grep -vqx "$session_name"; then + tmux new-session -ds "$session_name" -c "$selected" + tmux set-option -t "$session_name" @default-path "$selected" + fi + + # switch to it + tmux switch -t "$session_name" + ''; + + scripts.newSession = '' + tmux switch-client -t "$(tmux new-session -dP)" + ''; + + scripts.sessionsMenu = '' + menu_items=( + "Switch Project" p "run-shell '${scriptsDir}/minibuffer.sh -d $HOME ${scriptsDir}/launch-sessionizer.sh'" + "New Unnamed Project" n "run-shell '${scriptsDir}/new-session.sh'" + ) + + # Get all tmux session names + mapfile -t sessions < <(tmux list-sessions -F "#{session_name}") + + # Only include up to 9 sessions + for i in "''\${!sessions[@]}"; do + (( i >= 9 )) && break # Stop after 9 sessions + + session="''\${sessions[$i]}" + key=$((i + 1)) # 1-based key + + menu_items+=("$session" "$key" "switch-client -t $session") + done + + # Display the menu + ${scriptsDir}/menu.sh -T "#[align=centre]Projects" "''\${menu_items[@]}" + ''; + + scripts.cleanSessions = '' + current="$(tmux display -p '#{session_name}')" + + tmux list-sessions -F '#{session_name}' | while read -r line; do + if [[ "$line" != "$current" && "$line" =~ ^[[:digit:]]+$ ]]; then + tmux kill-session -t "$line" + fi + done + ''; + + scripts.launchSessionizer = ''broot --only-folders --conf ~/.config/tmux/broot/sessionizer.toml''; + + # -- FIND FILE -- + broot_file_config = { + imports = ["~/.config/broot/conf.toml"]; + quit_on_last_cancel = true; + verbs = [ + { + invocation = "tmux-split"; + external = ["bash" "-c" ''${scriptsDir}/split.sh -c "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"'']; + key = "ctrl-s"; + apply_to = "file"; + leave_broot = true; + } + { + invocation = "tmux-window"; + external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"]; + key = "ctrl-w"; + apply_to = "file"; + leave_broot = true; + } + { + key = "enter"; + cmd = ":tmux-window"; + } + ]; + }; + + scripts.launchFindFile = ''broot --conf ~/.config/tmux/broot/file.toml''; + + # -- BAR -- + scripts.battery = '' + energy_now=$(cat /sys/class/power_supply/BAT0/energy_now) + energy_full=$(cat /sys/class/power_supply/BAT0/energy_full) + percentage=$((energy_now * 100 / energy_full)) + printf "%.0f%%" "$percentage" + ''; + + scripts.bar = '' + bg="#1e1e2e" + + tmux set -g status on + + tmux set -g status-position bottom + tmux set -g status-justify absolute-centre + tmux set -g status-bg "$bg" + + tmux set -g status-left-style fg=green,bold + tmux set -g status-left " #{client_session}" + + tmux set -g window-status-style fg=color243 + tmux set -g window-status-format " #I " + tmux set -g window-status-current-style fg=color12,bold + tmux set -g window-status-current-format " #I " + tmux set -g window-status-separator "" + + tmux set -g status-right "#[fg=color243]%l:%M #[fg=red]#(${scriptsDir}/battery.sh) " + + bg_dark="#181825" + + ## pane borders + tmux set -g pane-border-style fg=$bg_dark,bg=$bg_dark + tmux set -g pane-active-border-style fg=$bg_dark,bg=$bg_dark + + ## pane backgrounds + # Set the foreground/background color for the active window + tmux set -g window-active-style bg=$bg + + # Set the foreground/background color for all other windows + tmux set -g window-style bg=$bg_dark + ''; + + # -- FZF EXEC -- + scripts.tmuxDoc = '' + usage=$(tmux list-commands -F "#{command_list_name} #{command_list_usage}" "$1") + + man tmux | awk -v usage="$usage" ' + index($0, usage) > 0 { found=1 } + found { + print + if ($0 == "") exit + } + ' + ''; + + scripts.fzfExec = '' + all_cmds() { + tmux list-commands -F $'#{command_list_name}#{?command_list_alias,\n#{command_list_alias},}' + } + + selected_cmd=$(all_cmds | fzf --bind 'enter:accept-or-print-query,tab:replace-query,alt-backspace:clear-query' --prompt : --preview "~/.config/tmux/scripts/tmux-doc.sh $(printf '{}' | cut -d' ' -f1)") + test -z "$selected_cmd" && exit + + tmux $(echo "$selected_cmd" | sed "s@~@$HOME@g") + ''; + + # -- BUFFER SEARCH -- + scripts.searchBuffer = '' + trap 'rm -f -- "''\${scrollback:-}"' EXIT + scrollback="$(mktemp)" + + tmux capture-pane -e -p -S - > "$scrollback" + cat "$scrollback" | fzf --ansi + + exit 0 + ''; + + # -- PANE SEARCH -- + scripts.paneSearch = '' + LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" + FZF_COMMAND="fzf --delimiter=: --with-nth 4 --color=hl:2" + + # do not change + TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" + + # select pane + LINE=$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 + # split the result + args=(''\${LINE//:/ }) + # activate session/window/pane + tmux select-pane -t ''\${args[2]} && tmux select-window -t ''\${args[1]} && tmux switch-client -t ''\${args[0]} + ''; + + # -- LEADER MENU -- + scripts.leaderMenu = '' + ${scriptsDir}/menu.sh -T "#[align=centre]Prefix" \ + "+Projects" C-p "run-shell ${scriptsDir}/sessions-menu.sh" \ + "Find File" C-f "run-shell \"${scriptsDir}/minibuffer.sh -d '#{?@default-path,#{@default-path},#{pane_current_path}}' '${scriptsDir}/launch-find-file.sh'\"" \ + "Find Window" C-w "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/pane-search.sh'\"" \ + "Detach" C-d "detach" \ + "Lazygit" C-g "display-popup -E -w 80% -h 80% -x C -y C -d '#{?@default-path,#{@default-path},#{pane_current_path}}' lazygit" \ + "Search Buffer" / "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/search-buffer.sh'\"" \ + "Todo" C-o "display-popup -E -w 70% -h 70% -x C -y C 'hx ~/Documents/todo.txt'" \ + "Reload" C-r "source-file ~/.config/tmux/tmux.conf" + ''; + + tmux-conf = '' + set -g mouse on + + # Panes + bind-key -n C-w kill-pane + + bind -n C-Enter run-shell "${scriptsDir}/split.sh -c '#{?@default-path,#{@default-path},#{pane_current_path}}'" + + unbind -n MouseDown3Pane ## disable right click menu + bind-key -n M-z resize-pane -Z ## Pane zoom + set -g allow-rename on + set -g automatic-rename off + + # Windows + bind-key -n C-t new-window -c '#{?@default-path,#{@default-path},#{pane_current_path}}' + bind-key -n C-Tab next-window + bind-key -n C-S-Tab previous-window # doesn't work in foot :( + unbind n + unbind p + + set -g renumber-windows on + set -g base-index 1 + + bind-key -n C-x run-shell "${scriptsDir}/leader-menu.sh" + bind-key -n M-x run-shell "${scriptsDir}/minibuffer.sh -h 10 '${scriptsDir}/fzf-exec.sh'" + + set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh' + set-hook -ag client-session-changed 'run-shell ${scriptsDir}/clean-sessions.sh' + + # Statusbar + run-shell "${scriptsDir}/bar.sh" + + # Scrollback + set-window-option -g mode-keys vi + ''; +in + lib.mkIf cfg.enable { + files = let + e = text: { + inherit text; + executable = true; + }; + in { + # helpers + ".config/tmux/scripts/minibuffer.sh" = e scripts.minibuffer; + ".config/tmux/scripts/menu.sh" = e scripts.menu; + ".config/tmux/scripts/split.sh" = e scripts.paneSplit; + + # sessionizer + ".config/tmux/scripts/sessionizer.sh" = e scripts.sessionizer; + ".config/tmux/broot/sessionizer.toml" = { + generator = (pkgs.formats.toml {}).generate "sessionizer.toml"; + value = broot_sessionizer_config; + }; + ".config/tmux/scripts/launch-sessionizer.sh" = e scripts.launchSessionizer; + ".config/tmux/scripts/clean-sessions.sh" = e scripts.cleanSessions; + ".config/tmux/scripts/new-session.sh" = e scripts.newSession; + ".config/tmux/scripts/sessions-menu.sh" = e scripts.sessionsMenu; + + # find-file + ".config/tmux/scripts/launch-find-file.sh" = e scripts.launchFindFile; + ".config/tmux/broot/file.toml" = { + generator = (pkgs.formats.toml {}).generate "file.toml"; + value = broot_file_config; + }; + + # search buffer + ".config/tmux/scripts/search-buffer.sh" = e scripts.searchBuffer; + + # pane search + ".config/tmux/scripts/pane-search.sh" = e scripts.paneSearch; + + # fzf-exec + ".config/tmux/scripts/tmux-doc.sh" = e scripts.tmuxDoc; + ".config/tmux/scripts/fzf-exec.sh" = e scripts.fzfExec; + + # leader menu + ".config/tmux/scripts/leader-menu.sh" = e scripts.leaderMenu; + + # Bar + ".config/tmux/scripts/battery.sh" = e scripts.battery; + ".config/tmux/scripts/bar.sh" = e scripts.bar; + + ".config/tmux/tmux.conf".text = tmux-conf; + }; + + packages = [pkgs.tmux]; + } diff --git a/modules/terminal/nixos/default.nix b/modules/terminal/nixos/default.nix new file mode 100644 index 0000000..8118c63 --- /dev/null +++ b/modules/terminal/nixos/default.nix @@ -0,0 +1,10 @@ +{config, ...}: let + cfg = config.collinux.terminal.shells; +in { + programs.command-not-found.enable = false; # broken without nix-channels + + users.users."${config.collinux.user.name}" = { + shell = cfg.defaultShell; + ignoreShellProgramCheck = true; + }; +} diff --git a/modules/terminal/nixos/programs/bash.nix b/modules/terminal/nixos/programs/bash.nix new file mode 100644 index 0000000..ed2c226 --- /dev/null +++ b/modules/terminal/nixos/programs/bash.nix @@ -0,0 +1,32 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.bash; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".bashrc".text = '' + eval "$(direnv hook bash)" + + for file in ~/.config/bash/conf.d/*; do source "$file"; done + ''; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + pay-respects + ]; + }; + }; + } diff --git a/modules/terminal/nixos/programs/bat.nix b/modules/terminal/nixos/programs/bat.nix new file mode 100644 index 0000000..d954291 --- /dev/null +++ b/modules/terminal/nixos/programs/bat.nix @@ -0,0 +1,27 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.bat; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/bat.fish".text = '' + alias cat bat + set -gx BAT_THEME "base16" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/fish/conf.d/bat.bash".text = '' + alias cat="bat" + export BAT_THEME="base16" + ''; + }); + + packages = [pkgs.bat]; + }; + } diff --git a/modules/terminal/nixos/programs/broot.nix b/modules/terminal/nixos/programs/broot.nix new file mode 100644 index 0000000..6164044 --- /dev/null +++ b/modules/terminal/nixos/programs/broot.nix @@ -0,0 +1,138 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; + + conf = { + skin = catppuccin_skin; + verbs = [ + { + name = "open-code"; + key = "enter"; + execution = "$EDITOR +{line} {file}"; + working_dir = "{root}"; + apply_to = "file"; + leave_broot = true; + } + ]; + }; + + catppuccin_skin = { + input = "rgb(205, 214, 244) none"; + selected_line = "none rgb(88, 91, 112)"; + default = "rgb(205, 214, 244) none"; + tree = "rgb(108, 112, 134) none"; + parent = "rgb(116, 199, 236) none"; + file = "none none"; + + perm__ = "rgb(186, 194, 222) none"; + perm_r = "rgb(250, 179, 135) none"; + perm_w = "rgb(235, 160, 172) none"; + perm_x = "rgb(166, 227, 161) none"; + owner = "rgb(148, 226, 213) none"; + group = "rgb(137, 220, 235) none"; + + dates = "rgb(186, 194, 222) none"; + + directory = "rgb(180, 190, 254) none Bold"; + exe = "rgb(166, 227, 161) none"; + link = "rgb(249, 226, 175) none"; + pruning = "rgb(166, 173, 200) none Italic"; + + preview_title = "rgb(205, 214, 244) rgb(24, 24, 37)"; + preview = "rgb(205, 214, 244) rgb(24, 24, 37)"; + preview_line_number = "rgb(108, 112, 134) none"; + preview_separator = "rgb(108, 112, 134) none"; + + char_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + content_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + preview_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; + + count = "rgb(249, 226, 175) none"; + sparse = "rgb(243, 139, 168) none"; + content_extract = "rgb(243, 139, 168) none Italic"; + + git_branch = "rgb(250, 179, 135) none"; + git_insertions = "rgb(250, 179, 135) none"; + git_deletions = "rgb(250, 179, 135) none"; + git_status_current = "rgb(250, 179, 135) none"; + git_status_modified = "rgb(250, 179, 135) none"; + git_status_new = "rgb(250, 179, 135) none Bold"; + git_status_ignored = "rgb(250, 179, 135) none"; + git_status_conflicted = "rgb(250, 179, 135) none"; + git_status_other = "rgb(250, 179, 135) none"; + staging_area_title = "rgb(250, 179, 135) none"; + + flag_label = "rgb(243, 139, 168) none"; + flag_value = "rgb(243, 139, 168) none Bold"; + + status_normal = "none rgb(24, 24, 37)"; + status_italic = "rgb(243, 139, 168) rgb(24, 24, 37) Italic"; + status_bold = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + status_ellipsis = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + status_error = "rgb(205, 214, 244) rgb(243, 139, 168)"; + status_job = "rgb(235, 160, 172) rgb(40, 38, 37)"; + status_code = "rgb(235, 160, 172) rgb(24, 24, 37) Italic"; + mode_command_mark = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; + + help_paragraph = "rgb(205, 214, 244) none"; + help_headers = "rgb(243, 139, 168) none Bold"; + help_bold = "rgb(250, 179, 135) none Bold"; + help_italic = "rgb(249, 226, 175) none Italic"; + help_code = "rgb(166, 227, 161) rgb(49, 50, 68)"; + help_table_border = "rgb(108, 112, 134) none"; + + hex_null = "rgb(205, 214, 244) none"; + hex_ascii_graphic = "rgb(250, 179, 135) none"; + hex_ascii_whitespace = "rgb(166, 227, 161) none"; + hex_ascii_other = "rgb(148, 226, 213) none"; + hex_non_ascii = "rgb(243, 139, 168) none"; + + file_error = "rgb(251, 73, 52) none"; + + purpose_normal = "none none"; + purpose_italic = "rgb(177, 98, 134) none Italic"; + purpose_bold = "rgb(177, 98, 134) none Bold"; + purpose_ellipsis = "none none"; + + scrollbar_track = "rgb(49, 50, 68) none"; + scrollbar_thumb = "rgb(88, 91, 112) none"; + + good_to_bad_0 = "rgb(166, 227, 161) none"; + good_to_bad_1 = "rgb(148, 226, 213) none"; + good_to_bad_2 = "rgb(137, 220, 235) none"; + good_to_bad_3 = "rgb(116, 199, 236) none"; + good_to_bad_4 = "rgb(137, 180, 250) none"; + good_to_bad_5 = "rgb(180, 190, 254) none"; + good_to_bad_6 = "rgb(203, 166, 247) none"; + good_to_bad_7 = "rgb(250, 179, 135) none"; + good_to_bad_8 = "rgb(235, 160, 172) none"; + good_to_bad_9 = "rgb(243, 139, 168) none"; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + { + ".config/broot/conf.toml" = { + generator = (pkgs.formats.toml {}).generate "conf.toml"; + value = conf; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/broot.fish".text = '' + broot --print-shell-function fish | source + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/broot.bash".text = '' + eval "$(broot --print-shell-function bash)" + ''; + }); + + packages = [pkgs.broot]; + }; + } diff --git a/modules/terminal/nixos/programs/cmus.nix b/modules/terminal/nixos/programs/cmus.nix new file mode 100644 index 0000000..e5184ce --- /dev/null +++ b/modules/terminal/nixos/programs/cmus.nix @@ -0,0 +1,97 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.cmus; + + scriptsDir = "~/.config/cmus/scripts"; + + scripts.statusDisplay = '' + while [ $# -ge 2 ]; do + eval _$1='$2' + shift + shift + done + + [ -d ~/.local/share/cmus ] || mkdir ~/.local/share/cmus + + if [ -n "$_file" ]; then + ${pkgs.ffmpeg}/bin/ffmpeg -i "$_file" -y -an -c:v copy ~/.local/share/cmus/curr_cover.jpg || rm ~/.local/share/cmus/curr_cover.jpg + fi + + ${pkgs.dunst}/bin/dunstify -t 2000 -u low -h string:x-canonical-private-synchronous:music -i ~/.local/share/cmus/curr_cover.jpg "$_status: $_title" "$_artist" + ''; + + cmus_theme = '' + set color_cmdline_bg=default + set color_cmdline_fg=default + set color_error=211 + set color_info=223 + set color_separator=8 + set color_statusline_bg=default + set color_statusline_fg=default + set color_titleline_bg=183 + set color_titleline_fg=8 + set color_titleline_attr=bold + set color_win_bg=default + set color_win_cur=117 + set color_win_cur_sel_bg=117 + set color_win_cur_sel_fg=235 + set color_win_dir=default + set color_win_fg=default + set color_win_inactive_cur_sel_bg=0 + set color_win_inactive_cur_sel_fg=default + set color_win_inactive_sel_bg=0 + set color_win_inactive_sel_fg=default + set color_win_sel_bg=15 + set color_win_sel_fg=235 + set color_win_title_bg=default + set color_win_title_fg=183 + set color_win_title_attr=bold + ''; + + cmus_rc = '' + ${ + if (cfg.theme == "catppuccin") + then "colorscheme catppuccin" + else "" + } + set status_display_program=${scriptsDir}/status.sh + ''; + + cava_config = + if cfg.theme == "catppuccin" + then '' + [color] + gradient=1 + gradient_color_1='#94e2d5' + gradient_color_2='#89dceb' + gradient_color_3='#74c7ec' + gradient_color_4='#89b4fa' + gradient_color_5='#cba6f7' + gradient_color_6='#f5c2e7' + gradient_color_7='#eba0ac' + gradient_color_8='#f38ba8' + '' + else ""; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = let + e = text: { + inherit text; + executable = true; + }; + in { + ".config/cmus/scripts/status.sh" = e scripts.statusDisplay; + + ".config/cmus/rc".text = cmus_rc; + ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme; + ".config/cava/config".text = cava_config; + }; + + packages = with pkgs; [cava cmus]; + }; + } diff --git a/modules/terminal/nixos/programs/eza.nix b/modules/terminal/nixos/programs/eza.nix new file mode 100644 index 0000000..acdcbc2 --- /dev/null +++ b/modules/terminal/nixos/programs/eza.nix @@ -0,0 +1,27 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.eza; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/eza.fish".text = '' + alias ls "eza -A -w 80 --group-directories-first -I '.git*'" + alias tree "eza -T" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/bash/conf.d/eza.bash".text = '' + alias ls="eza -A -w 80 --group-directories-first -I '.git*'" + alias tree="eza -T" + ''; + }); + + packages = [pkgs.eza]; + }; + } diff --git a/modules/terminal/nixos/programs/fish.nix b/modules/terminal/nixos/programs/fish.nix new file mode 100644 index 0000000..a210cd5 --- /dev/null +++ b/modules/terminal/nixos/programs/fish.nix @@ -0,0 +1,37 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/fish/config.fish".text = '' + set fish_greeting + + function fish_title + echo fish (prompt_pwd) + end + + direnv hook fish | source + pay-respects fish --alias | source + ''; + }; + + packages = with pkgs; [ + fish + ripgrep + fd + moreutils + zip + unzip + btop + jq + direnv + pay-respects + ]; + }; + } diff --git a/modules/terminal/nixos/programs/fzf.nix b/modules/terminal/nixos/programs/fzf.nix new file mode 100644 index 0000000..fd86566 --- /dev/null +++ b/modules/terminal/nixos/programs/fzf.nix @@ -0,0 +1,27 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.fzf; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/fzf.fish".text = '' + fzf --fish | source + set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/fzf.bash".text = '' + eval "$(fzf --bash)" + export FZF_DEFAULT_OPTS="--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" + ''; + }); + + packages = [pkgs.fzf]; + }; + } diff --git a/modules/terminal/nixos/programs/git.nix b/modules/terminal/nixos/programs/git.nix new file mode 100644 index 0000000..9943e40 --- /dev/null +++ b/modules/terminal/nixos/programs/git.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.collinux.terminal.programs.git; + + git_config = { + alias = { + stage = "add"; + unstage = "restore --staged"; + }; + init.defaultBranch = "main"; + user = { + email = cfg.userEmail; + name = cfg.userName; + }; + }; +in { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/git/config" = { + generator = lib.generators.toGitINI; + value = git_config; + }; + }; + + packages = [pkgs.git]; + }; +} diff --git a/modules/terminal/nixos/programs/helix.nix b/modules/terminal/nixos/programs/helix.nix new file mode 100644 index 0000000..54a6932 --- /dev/null +++ b/modules/terminal/nixos/programs/helix.nix @@ -0,0 +1,178 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.helix; + + languages = { + language-server = { + rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; + + nil = { + command = "${pkgs.nil}/bin/nil"; + config = { + nil.nix.flake.autoArchive = true; + }; + }; + superhtml = { + command = "${pkgs.superhtml}/bin/superhtml"; + args = ["lsp"]; + }; + dhall-lsp-server.command = "${pkgs.dhall-lsp-server}/bin/dhall-lsp-server"; + }; + + language = [ + { + name = "nix"; + file-types = ["nix"]; + language-servers = ["nil"]; + indent = { + tab-width = 2; + unit = " "; + }; + formatter.command = "${pkgs.alejandra}/bin/alejandra"; + auto-format = true; + } + { + name = "html"; + file-types = ["html"]; + language-servers = ["superhtml"]; + auto-format = true; + } + ]; + }; + + theme = { + inherits = "catppuccin_mocha"; + "ui.background" = {}; + }; + + mkHelixConfig = { + theme, + hardMode ? false, + }: { + inherit theme; + editor = { + gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; + cursorline = true; + color-modes = true; + + mouse = !hardMode; + + lsp.display-inlay-hints = true; + + statusline = { + left = ["mode" "file-name" "spacer" "file-modification-indicator"]; + right = ["spinner" "spacer" "workspace-diagnostics" "file-type"]; + separator = "x"; + }; + + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + }; + keys = { + normal = + { + "C-space" = "expand_selection"; + "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"]; + "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"]; + "X" = ["extend_line_up" "extend_to_line_bounds"]; + "C-left" = "goto_line_start"; + "C-right" = "goto_line_end"; + ";" = "flip_selections"; + "esc" = ["collapse_selection" "keep_primary_selection"]; + + # I don't even use these anyway + "pageup" = "no_op"; + "pagedown" = "no_op"; + "home" = "no_op"; + "end" = "no_op"; + } + // ( + if hardMode + then { + "up" = "no_op"; + "down" = "no_op"; + "left" = "no_op"; + "right" = "no_op"; + } + else {} + ); + + insert = + { + "pageup" = "no_op"; + "pagedown" = "no_op"; + "home" = "no_op"; + "end" = "no_op"; + } + // ( + if hardMode + then { + "up" = "no_op"; + "down" = "no_op"; + "left" = "no_op"; + "right" = "no_op"; + } + else {} + ); + + select = { + "esc" = ["collapse_selection" "insert_mode"]; + }; + }; + }; + + settings = mkHelixConfig { + inherit (cfg) hardMode; + theme = + if cfg.theme == "catppuccin" + then "catppuccin_mocha_transparent" + else if cfg.theme == "adwaita" + then "adwaita_dark" + else ""; + }; +in + lib.mkIf cfg.enable { + nixpkgs.overlays = [ + (self: super: { + # rename window to filename when editing file + helix = self.writeShellScriptBin "hx" '' + file="$1" + printf '\033]2;%s\033\\' "hx $file" + exec ${super.helix}/bin/hx "$@" + ''; + }) + ]; + + hjem.users."${config.collinux.user.name}" = { + files = let + t = value: { + generator = (pkgs.formats.toml {}).generate "toml_file"; + inherit value; + }; + in + { + ".config/helix/config.toml" = t settings; + ".config/helix/languages.toml" = t languages; + ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/helix.fish".text = '' + set -gx EDITOR hx + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/helix.bash".text = '' + EDITOR=hx + ''; + }); + + packages = [pkgs.helix]; + }; + } diff --git a/modules/terminal/nixos/programs/lazygit.nix b/modules/terminal/nixos/programs/lazygit.nix new file mode 100644 index 0000000..e3e2b42 --- /dev/null +++ b/modules/terminal/nixos/programs/lazygit.nix @@ -0,0 +1,41 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.programs.lazygit; + + settings = { + git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy"; + gui = { + showRandomTip = false; + commitLength.show = false; + showListFooter = false; + showCommandLog = false; + showPanelJumps = false; + statusPanelView = "allBranchesLog"; + }; + update.method = "never"; + notARepository = "quit"; + + quitOnTopLevelReturn = true; + disableStartupPopups = true; + promptToReturnFromSubprocess = false; + + theme.inactiveBorderColor = ["#313244"]; + theme.activeBorderColor = ["#89b4fa"]; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/lazygit/config.yml" = { + generator = lib.generators.toYAML {}; + value = settings; + }; + }; + + packages = [pkgs.lazygit]; + }; + } diff --git a/modules/terminal/nixos/programs/starship.nix b/modules/terminal/nixos/programs/starship.nix new file mode 100644 index 0000000..f0134f0 --- /dev/null +++ b/modules/terminal/nixos/programs/starship.nix @@ -0,0 +1,64 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.collinux.terminal.programs.starship; + + settings = { + format = ''$directory$git_branch$git_status $character''; + + add_newline = false; + scan_timeout = 10; + + character = { + success_symbol = "[λ](green bold)"; + error_symbol = "[Σ](red bold)"; + }; + + git_branch.format = "[@$branch](underline)"; + + git_status = { + format = "$modified$staged$ahead$behind"; + modified = "[!](red bold)"; + staged = "[+](green bold)"; + ahead = "[/](green)"; + behind = "[\](red)"; + }; + + directory = { + format = "$path"; + truncation_length = 3; + truncate_to_repo = true; + }; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = + { + ".config/starship.toml" = { + generator = (pkgs.formats.toml {}).generate "starship.toml"; + value = settings; + }; + } + // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { + ".config/fish/conf.d/starship.fish".text = '' + function starship_transient_prompt_func + starship module character + end + + starship init fish | source + enable_transience + ''; + }) + // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { + ".config/bash/conf.d/starship.bash".text = '' + eval "$(starship init bash)" + ''; + }); + + packages = [pkgs.starship]; + }; + } diff --git a/modules/terminal/nixos/programs/tmux.nix b/modules/terminal/nixos/programs/tmux.nix new file mode 100644 index 0000000..c349ded --- /dev/null +++ b/modules/terminal/nixos/programs/tmux.nix @@ -0,0 +1,332 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.collinux.terminal.programs.tmux; + + scriptsDir = "~/.config/tmux/scripts"; + + scripts.minibuffer = '' + window_height="$(tmux display -p '#{window_height}')" + tmux display-popup -EB \ + -w 100% -h 16 \ + -x 0 -y "$(($window_height + 1))" \ + "$@" + ''; + + scripts.menu = '' + tmux display-menu \ + -x "#{window_width}" -y S \ + -b none \ + -s "bg=#313244,fg=#9399b2" \ + -S "bg=#313244" \ + -H "bg=#45475a fg=#b4befe" \ + "$@" + ''; + + scripts.paneSplit = '' + width=$(tmux display -p "#{pane_width}") + height=$(tmux display -p "#{pane_height}") + + if (( $(echo "$width / $height > 2.5" | bc -l) )); then + tmux split-window -h "$@" + else + tmux split-window -v "$@" + fi + ''; + + # -- SESSIONIZER -- + broot_sessionizer_config = { + imports = ["~/.config/broot/conf.toml"]; + quit_on_last_cancel = true; + verbs = [ + { + invocation = "sessionizer"; + external = ''bash -c -- "${scriptsDir}/sessionizer.sh '{file}'"''; + key = "enter"; + apply_to = "directory"; + leave_broot = true; + } + ]; + }; + + scripts.sessionizer = '' + selected="$1" + + session_name="$(basename "$selected" | tr '.' '_')" + + # if the session doesn't exist, create it + if tmux list-sessions -F '#{session_name}' | grep -vqx "$session_name"; then + tmux new-session -ds "$session_name" -c "$selected" + tmux set-option -t "$session_name" @default-path "$selected" + fi + + # switch to it + tmux switch -t "$session_name" + ''; + + scripts.newSession = '' + tmux switch-client -t "$(tmux new-session -dP)" + ''; + + scripts.sessionsMenu = '' + menu_items=( + "Switch Project" p "run-shell '${scriptsDir}/minibuffer.sh -d $HOME ${scriptsDir}/launch-sessionizer.sh'" + "New Unnamed Project" n "run-shell '${scriptsDir}/new-session.sh'" + ) + + # Get all tmux session names + mapfile -t sessions < <(tmux list-sessions -F "#{session_name}") + + # Only include up to 9 sessions + for i in "''\${!sessions[@]}"; do + (( i >= 9 )) && break # Stop after 9 sessions + + session="''\${sessions[$i]}" + key=$((i + 1)) # 1-based key + + menu_items+=("$session" "$key" "switch-client -t $session") + done + + # Display the menu + ${scriptsDir}/menu.sh -T "#[align=centre]Projects" "''\${menu_items[@]}" + ''; + + scripts.cleanSessions = '' + current="$(tmux display -p '#{session_name}')" + + tmux list-sessions -F '#{session_name}' | while read -r line; do + if [[ "$line" != "$current" && "$line" =~ ^[[:digit:]]+$ ]]; then + tmux kill-session -t "$line" + fi + done + ''; + + scripts.launchSessionizer = ''broot --only-folders --conf ~/.config/tmux/broot/sessionizer.toml''; + + # -- FIND FILE -- + broot_file_config = { + imports = ["~/.config/broot/conf.toml"]; + quit_on_last_cancel = true; + verbs = [ + { + invocation = "tmux-split"; + external = ["bash" "-c" ''${scriptsDir}/split.sh -c "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"'']; + key = "ctrl-s"; + apply_to = "file"; + leave_broot = true; + } + { + invocation = "tmux-window"; + external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"]; + key = "ctrl-w"; + apply_to = "file"; + leave_broot = true; + } + { + key = "enter"; + cmd = ":tmux-window"; + } + ]; + }; + + scripts.launchFindFile = ''broot --conf ~/.config/tmux/broot/file.toml''; + + # -- BAR -- + scripts.battery = '' + energy_now=$(cat /sys/class/power_supply/BAT0/energy_now) + energy_full=$(cat /sys/class/power_supply/BAT0/energy_full) + percentage=$((energy_now * 100 / energy_full)) + printf "%.0f%%" "$percentage" + ''; + + scripts.bar = '' + bg="#1e1e2e" + + tmux set -g status on + + tmux set -g status-position bottom + tmux set -g status-justify absolute-centre + tmux set -g status-bg "$bg" + + tmux set -g status-left-style fg=green,bold + tmux set -g status-left " #{client_session}" + + tmux set -g window-status-style fg=color243 + tmux set -g window-status-format " #I " + tmux set -g window-status-current-style fg=color12,bold + tmux set -g window-status-current-format " #I " + tmux set -g window-status-separator "" + + tmux set -g status-right "#[fg=color243]%l:%M #[fg=red]#(${scriptsDir}/battery.sh) " + + bg_dark="#181825" + + ## pane borders + tmux set -g pane-border-style fg=$bg_dark,bg=$bg_dark + tmux set -g pane-active-border-style fg=$bg_dark,bg=$bg_dark + + ## pane backgrounds + # Set the foreground/background color for the active window + tmux set -g window-active-style bg=$bg + + # Set the foreground/background color for all other windows + tmux set -g window-style bg=$bg_dark + ''; + + # -- FZF EXEC -- + scripts.tmuxDoc = '' + usage=$(tmux list-commands -F "#{command_list_name} #{command_list_usage}" "$1") + + man tmux | awk -v usage="$usage" ' + index($0, usage) > 0 { found=1 } + found { + print + if ($0 == "") exit + } + ' + ''; + + scripts.fzfExec = '' + all_cmds() { + tmux list-commands -F $'#{command_list_name}#{?command_list_alias,\n#{command_list_alias},}' + } + + selected_cmd=$(all_cmds | fzf --bind 'enter:accept-or-print-query,tab:replace-query,alt-backspace:clear-query' --prompt : --preview "~/.config/tmux/scripts/tmux-doc.sh $(printf '{}' | cut -d' ' -f1)") + test -z "$selected_cmd" && exit + + tmux $(echo "$selected_cmd" | sed "s@~@$HOME@g") + ''; + + # -- BUFFER SEARCH -- + scripts.searchBuffer = '' + trap 'rm -f -- "''\${scrollback:-}"' EXIT + scrollback="$(mktemp)" + + tmux capture-pane -e -p -S - > "$scrollback" + cat "$scrollback" | fzf --ansi + + exit 0 + ''; + + # -- PANE SEARCH -- + scripts.paneSearch = '' + LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" + FZF_COMMAND="fzf --delimiter=: --with-nth 4 --color=hl:2" + + # do not change + TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" + + # select pane + LINE=$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 + # split the result + args=(''\${LINE//:/ }) + # activate session/window/pane + tmux select-pane -t ''\${args[2]} && tmux select-window -t ''\${args[1]} && tmux switch-client -t ''\${args[0]} + ''; + + # -- LEADER MENU -- + scripts.leaderMenu = '' + ${scriptsDir}/menu.sh -T "#[align=centre]Prefix" \ + "+Projects" C-p "run-shell ${scriptsDir}/sessions-menu.sh" \ + "Find File" C-f "run-shell \"${scriptsDir}/minibuffer.sh -d '#{?@default-path,#{@default-path},#{pane_current_path}}' '${scriptsDir}/launch-find-file.sh'\"" \ + "Find Window" C-w "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/pane-search.sh'\"" \ + "Detach" C-d "detach" \ + "Lazygit" C-g "display-popup -E -w 80% -h 80% -x C -y C -d '#{?@default-path,#{@default-path},#{pane_current_path}}' lazygit" \ + "Search Buffer" / "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/search-buffer.sh'\"" \ + "Todo" C-o "display-popup -E -w 70% -h 70% -x C -y C 'hx ~/Documents/todo.txt'" \ + "Reload" C-r "source-file ~/.config/tmux/tmux.conf" + ''; + + tmux-conf = '' + set -g mouse on + + # Panes + bind-key -n C-w kill-pane + + bind -n C-Enter run-shell "${scriptsDir}/split.sh -c '#{?@default-path,#{@default-path},#{pane_current_path}}'" + + unbind -n MouseDown3Pane ## disable right click menu + bind-key -n M-z resize-pane -Z ## Pane zoom + set -g allow-rename on + set -g automatic-rename off + + # Windows + bind-key -n C-t new-window -c '#{?@default-path,#{@default-path},#{pane_current_path}}' + bind-key -n C-Tab next-window + bind-key -n C-S-Tab previous-window # doesn't work in foot :( + unbind n + unbind p + + set -g renumber-windows on + set -g base-index 1 + + bind-key -n C-x run-shell "${scriptsDir}/leader-menu.sh" + bind-key -n M-x run-shell "${scriptsDir}/minibuffer.sh -h 10 '${scriptsDir}/fzf-exec.sh'" + + set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh' + set-hook -ag client-session-changed 'run-shell ${scriptsDir}/clean-sessions.sh' + + # Statusbar + run-shell "${scriptsDir}/bar.sh" + + # Scrollback + set-window-option -g mode-keys vi + ''; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = let + e = text: { + inherit text; + executable = true; + }; + in { + # helpers + ".config/tmux/scripts/minibuffer.sh" = e scripts.minibuffer; + ".config/tmux/scripts/menu.sh" = e scripts.menu; + ".config/tmux/scripts/split.sh" = e scripts.paneSplit; + + # sessionizer + ".config/tmux/scripts/sessionizer.sh" = e scripts.sessionizer; + ".config/tmux/broot/sessionizer.toml" = { + generator = (pkgs.formats.toml {}).generate "sessionizer.toml"; + value = broot_sessionizer_config; + }; + ".config/tmux/scripts/launch-sessionizer.sh" = e scripts.launchSessionizer; + ".config/tmux/scripts/clean-sessions.sh" = e scripts.cleanSessions; + ".config/tmux/scripts/new-session.sh" = e scripts.newSession; + ".config/tmux/scripts/sessions-menu.sh" = e scripts.sessionsMenu; + + # find-file + ".config/tmux/scripts/launch-find-file.sh" = e scripts.launchFindFile; + ".config/tmux/broot/file.toml" = { + generator = (pkgs.formats.toml {}).generate "file.toml"; + value = broot_file_config; + }; + + # search buffer + ".config/tmux/scripts/search-buffer.sh" = e scripts.searchBuffer; + + # pane search + ".config/tmux/scripts/pane-search.sh" = e scripts.paneSearch; + + # fzf-exec + ".config/tmux/scripts/tmux-doc.sh" = e scripts.tmuxDoc; + ".config/tmux/scripts/fzf-exec.sh" = e scripts.fzfExec; + + # leader menu + ".config/tmux/scripts/leader-menu.sh" = e scripts.leaderMenu; + + # Bar + ".config/tmux/scripts/battery.sh" = e scripts.battery; + ".config/tmux/scripts/bar.sh" = e scripts.bar; + + ".config/tmux/tmux.conf".text = tmux-conf; + }; + + packages = [pkgs.tmux]; + }; + } diff --git a/modules/terminal/system/default.nix b/modules/terminal/system/default.nix deleted file mode 100644 index 120e967..0000000 --- a/modules/terminal/system/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{config, ...}: let - cfg = config.collinux.terminal.shells; -in { - imports = [ - ./programs/fzf.nix - ./programs/bat.nix - ./programs/lazygit.nix - ./programs/eza.nix - ./programs/starship.nix - ./programs/git.nix - ./programs/tmux.nix - ./programs/broot.nix - ./programs/cmus.nix - ./programs/helix.nix - ./programs/fish.nix - ]; - - programs.command-not-found.enable = false; # broken without nix-channels - - users.users."${config.collinux.user.name}" = { - shell = cfg.defaultShell; - ignoreShellProgramCheck = true; - }; -} diff --git a/modules/terminal/system/programs/bash.nix b/modules/terminal/system/programs/bash.nix deleted file mode 100644 index ed2c226..0000000 --- a/modules/terminal/system/programs/bash.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.shells.bash; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".bashrc".text = '' - eval "$(direnv hook bash)" - - for file in ~/.config/bash/conf.d/*; do source "$file"; done - ''; - - packages = with pkgs; [ - fish - ripgrep - fd - moreutils - zip - unzip - btop - jq - direnv - pay-respects - ]; - }; - }; - } diff --git a/modules/terminal/system/programs/bat.nix b/modules/terminal/system/programs/bat.nix deleted file mode 100644 index d954291..0000000 --- a/modules/terminal/system/programs/bat.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.bat; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/bat.fish".text = '' - alias cat bat - set -gx BAT_THEME "base16" - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/fish/conf.d/bat.bash".text = '' - alias cat="bat" - export BAT_THEME="base16" - ''; - }); - - packages = [pkgs.bat]; - }; - } diff --git a/modules/terminal/system/programs/broot.nix b/modules/terminal/system/programs/broot.nix deleted file mode 100644 index 6164044..0000000 --- a/modules/terminal/system/programs/broot.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.shells.fish; - - conf = { - skin = catppuccin_skin; - verbs = [ - { - name = "open-code"; - key = "enter"; - execution = "$EDITOR +{line} {file}"; - working_dir = "{root}"; - apply_to = "file"; - leave_broot = true; - } - ]; - }; - - catppuccin_skin = { - input = "rgb(205, 214, 244) none"; - selected_line = "none rgb(88, 91, 112)"; - default = "rgb(205, 214, 244) none"; - tree = "rgb(108, 112, 134) none"; - parent = "rgb(116, 199, 236) none"; - file = "none none"; - - perm__ = "rgb(186, 194, 222) none"; - perm_r = "rgb(250, 179, 135) none"; - perm_w = "rgb(235, 160, 172) none"; - perm_x = "rgb(166, 227, 161) none"; - owner = "rgb(148, 226, 213) none"; - group = "rgb(137, 220, 235) none"; - - dates = "rgb(186, 194, 222) none"; - - directory = "rgb(180, 190, 254) none Bold"; - exe = "rgb(166, 227, 161) none"; - link = "rgb(249, 226, 175) none"; - pruning = "rgb(166, 173, 200) none Italic"; - - preview_title = "rgb(205, 214, 244) rgb(24, 24, 37)"; - preview = "rgb(205, 214, 244) rgb(24, 24, 37)"; - preview_line_number = "rgb(108, 112, 134) none"; - preview_separator = "rgb(108, 112, 134) none"; - - char_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; - content_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; - preview_match = "rgb(249, 226, 175) rgb(69, 71, 90) Bold Italic"; - - count = "rgb(249, 226, 175) none"; - sparse = "rgb(243, 139, 168) none"; - content_extract = "rgb(243, 139, 168) none Italic"; - - git_branch = "rgb(250, 179, 135) none"; - git_insertions = "rgb(250, 179, 135) none"; - git_deletions = "rgb(250, 179, 135) none"; - git_status_current = "rgb(250, 179, 135) none"; - git_status_modified = "rgb(250, 179, 135) none"; - git_status_new = "rgb(250, 179, 135) none Bold"; - git_status_ignored = "rgb(250, 179, 135) none"; - git_status_conflicted = "rgb(250, 179, 135) none"; - git_status_other = "rgb(250, 179, 135) none"; - staging_area_title = "rgb(250, 179, 135) none"; - - flag_label = "rgb(243, 139, 168) none"; - flag_value = "rgb(243, 139, 168) none Bold"; - - status_normal = "none rgb(24, 24, 37)"; - status_italic = "rgb(243, 139, 168) rgb(24, 24, 37) Italic"; - status_bold = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; - status_ellipsis = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; - status_error = "rgb(205, 214, 244) rgb(243, 139, 168)"; - status_job = "rgb(235, 160, 172) rgb(40, 38, 37)"; - status_code = "rgb(235, 160, 172) rgb(24, 24, 37) Italic"; - mode_command_mark = "rgb(235, 160, 172) rgb(24, 24, 37) Bold"; - - help_paragraph = "rgb(205, 214, 244) none"; - help_headers = "rgb(243, 139, 168) none Bold"; - help_bold = "rgb(250, 179, 135) none Bold"; - help_italic = "rgb(249, 226, 175) none Italic"; - help_code = "rgb(166, 227, 161) rgb(49, 50, 68)"; - help_table_border = "rgb(108, 112, 134) none"; - - hex_null = "rgb(205, 214, 244) none"; - hex_ascii_graphic = "rgb(250, 179, 135) none"; - hex_ascii_whitespace = "rgb(166, 227, 161) none"; - hex_ascii_other = "rgb(148, 226, 213) none"; - hex_non_ascii = "rgb(243, 139, 168) none"; - - file_error = "rgb(251, 73, 52) none"; - - purpose_normal = "none none"; - purpose_italic = "rgb(177, 98, 134) none Italic"; - purpose_bold = "rgb(177, 98, 134) none Bold"; - purpose_ellipsis = "none none"; - - scrollbar_track = "rgb(49, 50, 68) none"; - scrollbar_thumb = "rgb(88, 91, 112) none"; - - good_to_bad_0 = "rgb(166, 227, 161) none"; - good_to_bad_1 = "rgb(148, 226, 213) none"; - good_to_bad_2 = "rgb(137, 220, 235) none"; - good_to_bad_3 = "rgb(116, 199, 236) none"; - good_to_bad_4 = "rgb(137, 180, 250) none"; - good_to_bad_5 = "rgb(180, 190, 254) none"; - good_to_bad_6 = "rgb(203, 166, 247) none"; - good_to_bad_7 = "rgb(250, 179, 135) none"; - good_to_bad_8 = "rgb(235, 160, 172) none"; - good_to_bad_9 = "rgb(243, 139, 168) none"; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - { - ".config/broot/conf.toml" = { - generator = (pkgs.formats.toml {}).generate "conf.toml"; - value = conf; - }; - } - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/broot.fish".text = '' - broot --print-shell-function fish | source - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/broot.bash".text = '' - eval "$(broot --print-shell-function bash)" - ''; - }); - - packages = [pkgs.broot]; - }; - } diff --git a/modules/terminal/system/programs/cmus.nix b/modules/terminal/system/programs/cmus.nix deleted file mode 100644 index e5184ce..0000000 --- a/modules/terminal/system/programs/cmus.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.cmus; - - scriptsDir = "~/.config/cmus/scripts"; - - scripts.statusDisplay = '' - while [ $# -ge 2 ]; do - eval _$1='$2' - shift - shift - done - - [ -d ~/.local/share/cmus ] || mkdir ~/.local/share/cmus - - if [ -n "$_file" ]; then - ${pkgs.ffmpeg}/bin/ffmpeg -i "$_file" -y -an -c:v copy ~/.local/share/cmus/curr_cover.jpg || rm ~/.local/share/cmus/curr_cover.jpg - fi - - ${pkgs.dunst}/bin/dunstify -t 2000 -u low -h string:x-canonical-private-synchronous:music -i ~/.local/share/cmus/curr_cover.jpg "$_status: $_title" "$_artist" - ''; - - cmus_theme = '' - set color_cmdline_bg=default - set color_cmdline_fg=default - set color_error=211 - set color_info=223 - set color_separator=8 - set color_statusline_bg=default - set color_statusline_fg=default - set color_titleline_bg=183 - set color_titleline_fg=8 - set color_titleline_attr=bold - set color_win_bg=default - set color_win_cur=117 - set color_win_cur_sel_bg=117 - set color_win_cur_sel_fg=235 - set color_win_dir=default - set color_win_fg=default - set color_win_inactive_cur_sel_bg=0 - set color_win_inactive_cur_sel_fg=default - set color_win_inactive_sel_bg=0 - set color_win_inactive_sel_fg=default - set color_win_sel_bg=15 - set color_win_sel_fg=235 - set color_win_title_bg=default - set color_win_title_fg=183 - set color_win_title_attr=bold - ''; - - cmus_rc = '' - ${ - if (cfg.theme == "catppuccin") - then "colorscheme catppuccin" - else "" - } - set status_display_program=${scriptsDir}/status.sh - ''; - - cava_config = - if cfg.theme == "catppuccin" - then '' - [color] - gradient=1 - gradient_color_1='#94e2d5' - gradient_color_2='#89dceb' - gradient_color_3='#74c7ec' - gradient_color_4='#89b4fa' - gradient_color_5='#cba6f7' - gradient_color_6='#f5c2e7' - gradient_color_7='#eba0ac' - gradient_color_8='#f38ba8' - '' - else ""; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = let - e = text: { - inherit text; - executable = true; - }; - in { - ".config/cmus/scripts/status.sh" = e scripts.statusDisplay; - - ".config/cmus/rc".text = cmus_rc; - ".config/cmus/catppuccin.theme".text = lib.mkIf (cfg.theme == "catppuccin") cmus_theme; - ".config/cava/config".text = cava_config; - }; - - packages = with pkgs; [cava cmus]; - }; - } diff --git a/modules/terminal/system/programs/eza.nix b/modules/terminal/system/programs/eza.nix deleted file mode 100644 index acdcbc2..0000000 --- a/modules/terminal/system/programs/eza.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.eza; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/eza.fish".text = '' - alias ls "eza -A -w 80 --group-directories-first -I '.git*'" - alias tree "eza -T" - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/bash/conf.d/eza.bash".text = '' - alias ls="eza -A -w 80 --group-directories-first -I '.git*'" - alias tree="eza -T" - ''; - }); - - packages = [pkgs.eza]; - }; - } diff --git a/modules/terminal/system/programs/fish.nix b/modules/terminal/system/programs/fish.nix deleted file mode 100644 index a210cd5..0000000 --- a/modules/terminal/system/programs/fish.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.shells.fish; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/fish/config.fish".text = '' - set fish_greeting - - function fish_title - echo fish (prompt_pwd) - end - - direnv hook fish | source - pay-respects fish --alias | source - ''; - }; - - packages = with pkgs; [ - fish - ripgrep - fd - moreutils - zip - unzip - btop - jq - direnv - pay-respects - ]; - }; - } diff --git a/modules/terminal/system/programs/fzf.nix b/modules/terminal/system/programs/fzf.nix deleted file mode 100644 index fd86566..0000000 --- a/modules/terminal/system/programs/fzf.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.fzf; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/fzf.fish".text = '' - fzf --fish | source - set -gx FZF_DEFAULT_OPTS "--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/fzf.bash".text = '' - eval "$(fzf --bash)" - export FZF_DEFAULT_OPTS="--color bg:#1E1E2E,bg+:#313244,border:#313244,fg:#CDD6F4,fg+:#CDD6F4,header:#F38BA8,hl:#F38BA8,hl+:#F38BA8,info:#CBA6F7,label:#CDD6F4,marker:#B4BEFE,pointer:#F5E0DC,prompt:#CBA6F7,selected-bg:#45475A,spinner:#F5E0DC" - ''; - }); - - packages = [pkgs.fzf]; - }; - } diff --git a/modules/terminal/system/programs/git.nix b/modules/terminal/system/programs/git.nix deleted file mode 100644 index 9943e40..0000000 --- a/modules/terminal/system/programs/git.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.collinux.terminal.programs.git; - - git_config = { - alias = { - stage = "add"; - unstage = "restore --staged"; - }; - init.defaultBranch = "main"; - user = { - email = cfg.userEmail; - name = cfg.userName; - }; - }; -in { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/git/config" = { - generator = lib.generators.toGitINI; - value = git_config; - }; - }; - - packages = [pkgs.git]; - }; -} diff --git a/modules/terminal/system/programs/helix.nix b/modules/terminal/system/programs/helix.nix deleted file mode 100644 index 54a6932..0000000 --- a/modules/terminal/system/programs/helix.nix +++ /dev/null @@ -1,178 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.helix; - - languages = { - language-server = { - rust-analyzer.command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; - - nil = { - command = "${pkgs.nil}/bin/nil"; - config = { - nil.nix.flake.autoArchive = true; - }; - }; - superhtml = { - command = "${pkgs.superhtml}/bin/superhtml"; - args = ["lsp"]; - }; - dhall-lsp-server.command = "${pkgs.dhall-lsp-server}/bin/dhall-lsp-server"; - }; - - language = [ - { - name = "nix"; - file-types = ["nix"]; - language-servers = ["nil"]; - indent = { - tab-width = 2; - unit = " "; - }; - formatter.command = "${pkgs.alejandra}/bin/alejandra"; - auto-format = true; - } - { - name = "html"; - file-types = ["html"]; - language-servers = ["superhtml"]; - auto-format = true; - } - ]; - }; - - theme = { - inherits = "catppuccin_mocha"; - "ui.background" = {}; - }; - - mkHelixConfig = { - theme, - hardMode ? false, - }: { - inherit theme; - editor = { - gutters = ["diff" "diagnostics" "line-numbers" "spacer" "spacer"]; - cursorline = true; - color-modes = true; - - mouse = !hardMode; - - lsp.display-inlay-hints = true; - - statusline = { - left = ["mode" "file-name" "spacer" "file-modification-indicator"]; - right = ["spinner" "spacer" "workspace-diagnostics" "file-type"]; - separator = "x"; - }; - - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - }; - keys = { - normal = - { - "C-space" = "expand_selection"; - "A-j" = ["extend_to_line_bounds" "delete_selection" "paste_after"]; - "A-k" = ["extend_to_line_bounds" "delete_selection" "move_line_up" "paste_before"]; - "X" = ["extend_line_up" "extend_to_line_bounds"]; - "C-left" = "goto_line_start"; - "C-right" = "goto_line_end"; - ";" = "flip_selections"; - "esc" = ["collapse_selection" "keep_primary_selection"]; - - # I don't even use these anyway - "pageup" = "no_op"; - "pagedown" = "no_op"; - "home" = "no_op"; - "end" = "no_op"; - } - // ( - if hardMode - then { - "up" = "no_op"; - "down" = "no_op"; - "left" = "no_op"; - "right" = "no_op"; - } - else {} - ); - - insert = - { - "pageup" = "no_op"; - "pagedown" = "no_op"; - "home" = "no_op"; - "end" = "no_op"; - } - // ( - if hardMode - then { - "up" = "no_op"; - "down" = "no_op"; - "left" = "no_op"; - "right" = "no_op"; - } - else {} - ); - - select = { - "esc" = ["collapse_selection" "insert_mode"]; - }; - }; - }; - - settings = mkHelixConfig { - inherit (cfg) hardMode; - theme = - if cfg.theme == "catppuccin" - then "catppuccin_mocha_transparent" - else if cfg.theme == "adwaita" - then "adwaita_dark" - else ""; - }; -in - lib.mkIf cfg.enable { - nixpkgs.overlays = [ - (self: super: { - # rename window to filename when editing file - helix = self.writeShellScriptBin "hx" '' - file="$1" - printf '\033]2;%s\033\\' "hx $file" - exec ${super.helix}/bin/hx "$@" - ''; - }) - ]; - - hjem.users."${config.collinux.user.name}" = { - files = let - t = value: { - generator = (pkgs.formats.toml {}).generate "toml_file"; - inherit value; - }; - in - { - ".config/helix/config.toml" = t settings; - ".config/helix/languages.toml" = t languages; - ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme; - } - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/helix.fish".text = '' - set -gx EDITOR hx - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/helix.bash".text = '' - EDITOR=hx - ''; - }); - - packages = [pkgs.helix]; - }; - } diff --git a/modules/terminal/system/programs/lazygit.nix b/modules/terminal/system/programs/lazygit.nix deleted file mode 100644 index e3e2b42..0000000 --- a/modules/terminal/system/programs/lazygit.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.collinux.terminal.programs.lazygit; - - settings = { - git.paging.pager = "${pkgs.diff-so-fancy}/bin/diff-so-fancy"; - gui = { - showRandomTip = false; - commitLength.show = false; - showListFooter = false; - showCommandLog = false; - showPanelJumps = false; - statusPanelView = "allBranchesLog"; - }; - update.method = "never"; - notARepository = "quit"; - - quitOnTopLevelReturn = true; - disableStartupPopups = true; - promptToReturnFromSubprocess = false; - - theme.inactiveBorderColor = ["#313244"]; - theme.activeBorderColor = ["#89b4fa"]; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = { - ".config/lazygit/config.yml" = { - generator = lib.generators.toYAML {}; - value = settings; - }; - }; - - packages = [pkgs.lazygit]; - }; - } diff --git a/modules/terminal/system/programs/starship.nix b/modules/terminal/system/programs/starship.nix deleted file mode 100644 index f0134f0..0000000 --- a/modules/terminal/system/programs/starship.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.collinux.terminal.programs.starship; - - settings = { - format = ''$directory$git_branch$git_status $character''; - - add_newline = false; - scan_timeout = 10; - - character = { - success_symbol = "[λ](green bold)"; - error_symbol = "[Σ](red bold)"; - }; - - git_branch.format = "[@$branch](underline)"; - - git_status = { - format = "$modified$staged$ahead$behind"; - modified = "[!](red bold)"; - staged = "[+](green bold)"; - ahead = "[/](green)"; - behind = "[\](red)"; - }; - - directory = { - format = "$path"; - truncation_length = 3; - truncate_to_repo = true; - }; - }; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = - { - ".config/starship.toml" = { - generator = (pkgs.formats.toml {}).generate "starship.toml"; - value = settings; - }; - } - // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable { - ".config/fish/conf.d/starship.fish".text = '' - function starship_transient_prompt_func - starship module character - end - - starship init fish | source - enable_transience - ''; - }) - // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable { - ".config/bash/conf.d/starship.bash".text = '' - eval "$(starship init bash)" - ''; - }); - - packages = [pkgs.starship]; - }; - } diff --git a/modules/terminal/system/programs/tmux.nix b/modules/terminal/system/programs/tmux.nix deleted file mode 100644 index c349ded..0000000 --- a/modules/terminal/system/programs/tmux.nix +++ /dev/null @@ -1,332 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.collinux.terminal.programs.tmux; - - scriptsDir = "~/.config/tmux/scripts"; - - scripts.minibuffer = '' - window_height="$(tmux display -p '#{window_height}')" - tmux display-popup -EB \ - -w 100% -h 16 \ - -x 0 -y "$(($window_height + 1))" \ - "$@" - ''; - - scripts.menu = '' - tmux display-menu \ - -x "#{window_width}" -y S \ - -b none \ - -s "bg=#313244,fg=#9399b2" \ - -S "bg=#313244" \ - -H "bg=#45475a fg=#b4befe" \ - "$@" - ''; - - scripts.paneSplit = '' - width=$(tmux display -p "#{pane_width}") - height=$(tmux display -p "#{pane_height}") - - if (( $(echo "$width / $height > 2.5" | bc -l) )); then - tmux split-window -h "$@" - else - tmux split-window -v "$@" - fi - ''; - - # -- SESSIONIZER -- - broot_sessionizer_config = { - imports = ["~/.config/broot/conf.toml"]; - quit_on_last_cancel = true; - verbs = [ - { - invocation = "sessionizer"; - external = ''bash -c -- "${scriptsDir}/sessionizer.sh '{file}'"''; - key = "enter"; - apply_to = "directory"; - leave_broot = true; - } - ]; - }; - - scripts.sessionizer = '' - selected="$1" - - session_name="$(basename "$selected" | tr '.' '_')" - - # if the session doesn't exist, create it - if tmux list-sessions -F '#{session_name}' | grep -vqx "$session_name"; then - tmux new-session -ds "$session_name" -c "$selected" - tmux set-option -t "$session_name" @default-path "$selected" - fi - - # switch to it - tmux switch -t "$session_name" - ''; - - scripts.newSession = '' - tmux switch-client -t "$(tmux new-session -dP)" - ''; - - scripts.sessionsMenu = '' - menu_items=( - "Switch Project" p "run-shell '${scriptsDir}/minibuffer.sh -d $HOME ${scriptsDir}/launch-sessionizer.sh'" - "New Unnamed Project" n "run-shell '${scriptsDir}/new-session.sh'" - ) - - # Get all tmux session names - mapfile -t sessions < <(tmux list-sessions -F "#{session_name}") - - # Only include up to 9 sessions - for i in "''\${!sessions[@]}"; do - (( i >= 9 )) && break # Stop after 9 sessions - - session="''\${sessions[$i]}" - key=$((i + 1)) # 1-based key - - menu_items+=("$session" "$key" "switch-client -t $session") - done - - # Display the menu - ${scriptsDir}/menu.sh -T "#[align=centre]Projects" "''\${menu_items[@]}" - ''; - - scripts.cleanSessions = '' - current="$(tmux display -p '#{session_name}')" - - tmux list-sessions -F '#{session_name}' | while read -r line; do - if [[ "$line" != "$current" && "$line" =~ ^[[:digit:]]+$ ]]; then - tmux kill-session -t "$line" - fi - done - ''; - - scripts.launchSessionizer = ''broot --only-folders --conf ~/.config/tmux/broot/sessionizer.toml''; - - # -- FIND FILE -- - broot_file_config = { - imports = ["~/.config/broot/conf.toml"]; - quit_on_last_cancel = true; - verbs = [ - { - invocation = "tmux-split"; - external = ["bash" "-c" ''${scriptsDir}/split.sh -c "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"'']; - key = "ctrl-s"; - apply_to = "file"; - leave_broot = true; - } - { - invocation = "tmux-window"; - external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "hx '{file}'"]; - key = "ctrl-w"; - apply_to = "file"; - leave_broot = true; - } - { - key = "enter"; - cmd = ":tmux-window"; - } - ]; - }; - - scripts.launchFindFile = ''broot --conf ~/.config/tmux/broot/file.toml''; - - # -- BAR -- - scripts.battery = '' - energy_now=$(cat /sys/class/power_supply/BAT0/energy_now) - energy_full=$(cat /sys/class/power_supply/BAT0/energy_full) - percentage=$((energy_now * 100 / energy_full)) - printf "%.0f%%" "$percentage" - ''; - - scripts.bar = '' - bg="#1e1e2e" - - tmux set -g status on - - tmux set -g status-position bottom - tmux set -g status-justify absolute-centre - tmux set -g status-bg "$bg" - - tmux set -g status-left-style fg=green,bold - tmux set -g status-left " #{client_session}" - - tmux set -g window-status-style fg=color243 - tmux set -g window-status-format " #I " - tmux set -g window-status-current-style fg=color12,bold - tmux set -g window-status-current-format " #I " - tmux set -g window-status-separator "" - - tmux set -g status-right "#[fg=color243]%l:%M #[fg=red]#(${scriptsDir}/battery.sh) " - - bg_dark="#181825" - - ## pane borders - tmux set -g pane-border-style fg=$bg_dark,bg=$bg_dark - tmux set -g pane-active-border-style fg=$bg_dark,bg=$bg_dark - - ## pane backgrounds - # Set the foreground/background color for the active window - tmux set -g window-active-style bg=$bg - - # Set the foreground/background color for all other windows - tmux set -g window-style bg=$bg_dark - ''; - - # -- FZF EXEC -- - scripts.tmuxDoc = '' - usage=$(tmux list-commands -F "#{command_list_name} #{command_list_usage}" "$1") - - man tmux | awk -v usage="$usage" ' - index($0, usage) > 0 { found=1 } - found { - print - if ($0 == "") exit - } - ' - ''; - - scripts.fzfExec = '' - all_cmds() { - tmux list-commands -F $'#{command_list_name}#{?command_list_alias,\n#{command_list_alias},}' - } - - selected_cmd=$(all_cmds | fzf --bind 'enter:accept-or-print-query,tab:replace-query,alt-backspace:clear-query' --prompt : --preview "~/.config/tmux/scripts/tmux-doc.sh $(printf '{}' | cut -d' ' -f1)") - test -z "$selected_cmd" && exit - - tmux $(echo "$selected_cmd" | sed "s@~@$HOME@g") - ''; - - # -- BUFFER SEARCH -- - scripts.searchBuffer = '' - trap 'rm -f -- "''\${scrollback:-}"' EXIT - scrollback="$(mktemp)" - - tmux capture-pane -e -p -S - > "$scrollback" - cat "$scrollback" | fzf --ansi - - exit 0 - ''; - - # -- PANE SEARCH -- - scripts.paneSearch = '' - LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" - FZF_COMMAND="fzf --delimiter=: --with-nth 4 --color=hl:2" - - # do not change - TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" - - # select pane - LINE=$(tmux list-panes -a -F "$TARGET_SPEC $LIST_DATA" | $FZF_COMMAND) || exit 0 - # split the result - args=(''\${LINE//:/ }) - # activate session/window/pane - tmux select-pane -t ''\${args[2]} && tmux select-window -t ''\${args[1]} && tmux switch-client -t ''\${args[0]} - ''; - - # -- LEADER MENU -- - scripts.leaderMenu = '' - ${scriptsDir}/menu.sh -T "#[align=centre]Prefix" \ - "+Projects" C-p "run-shell ${scriptsDir}/sessions-menu.sh" \ - "Find File" C-f "run-shell \"${scriptsDir}/minibuffer.sh -d '#{?@default-path,#{@default-path},#{pane_current_path}}' '${scriptsDir}/launch-find-file.sh'\"" \ - "Find Window" C-w "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/pane-search.sh'\"" \ - "Detach" C-d "detach" \ - "Lazygit" C-g "display-popup -E -w 80% -h 80% -x C -y C -d '#{?@default-path,#{@default-path},#{pane_current_path}}' lazygit" \ - "Search Buffer" / "run-shell \"${scriptsDir}/minibuffer.sh '${scriptsDir}/search-buffer.sh'\"" \ - "Todo" C-o "display-popup -E -w 70% -h 70% -x C -y C 'hx ~/Documents/todo.txt'" \ - "Reload" C-r "source-file ~/.config/tmux/tmux.conf" - ''; - - tmux-conf = '' - set -g mouse on - - # Panes - bind-key -n C-w kill-pane - - bind -n C-Enter run-shell "${scriptsDir}/split.sh -c '#{?@default-path,#{@default-path},#{pane_current_path}}'" - - unbind -n MouseDown3Pane ## disable right click menu - bind-key -n M-z resize-pane -Z ## Pane zoom - set -g allow-rename on - set -g automatic-rename off - - # Windows - bind-key -n C-t new-window -c '#{?@default-path,#{@default-path},#{pane_current_path}}' - bind-key -n C-Tab next-window - bind-key -n C-S-Tab previous-window # doesn't work in foot :( - unbind n - unbind p - - set -g renumber-windows on - set -g base-index 1 - - bind-key -n C-x run-shell "${scriptsDir}/leader-menu.sh" - bind-key -n M-x run-shell "${scriptsDir}/minibuffer.sh -h 10 '${scriptsDir}/fzf-exec.sh'" - - set-hook -ag client-detached 'run-shell ${scriptsDir}/clean-sessions.sh' - set-hook -ag client-session-changed 'run-shell ${scriptsDir}/clean-sessions.sh' - - # Statusbar - run-shell "${scriptsDir}/bar.sh" - - # Scrollback - set-window-option -g mode-keys vi - ''; -in - lib.mkIf cfg.enable { - hjem.users."${config.collinux.user.name}" = { - files = let - e = text: { - inherit text; - executable = true; - }; - in { - # helpers - ".config/tmux/scripts/minibuffer.sh" = e scripts.minibuffer; - ".config/tmux/scripts/menu.sh" = e scripts.menu; - ".config/tmux/scripts/split.sh" = e scripts.paneSplit; - - # sessionizer - ".config/tmux/scripts/sessionizer.sh" = e scripts.sessionizer; - ".config/tmux/broot/sessionizer.toml" = { - generator = (pkgs.formats.toml {}).generate "sessionizer.toml"; - value = broot_sessionizer_config; - }; - ".config/tmux/scripts/launch-sessionizer.sh" = e scripts.launchSessionizer; - ".config/tmux/scripts/clean-sessions.sh" = e scripts.cleanSessions; - ".config/tmux/scripts/new-session.sh" = e scripts.newSession; - ".config/tmux/scripts/sessions-menu.sh" = e scripts.sessionsMenu; - - # find-file - ".config/tmux/scripts/launch-find-file.sh" = e scripts.launchFindFile; - ".config/tmux/broot/file.toml" = { - generator = (pkgs.formats.toml {}).generate "file.toml"; - value = broot_file_config; - }; - - # search buffer - ".config/tmux/scripts/search-buffer.sh" = e scripts.searchBuffer; - - # pane search - ".config/tmux/scripts/pane-search.sh" = e scripts.paneSearch; - - # fzf-exec - ".config/tmux/scripts/tmux-doc.sh" = e scripts.tmuxDoc; - ".config/tmux/scripts/fzf-exec.sh" = e scripts.fzfExec; - - # leader menu - ".config/tmux/scripts/leader-menu.sh" = e scripts.leaderMenu; - - # Bar - ".config/tmux/scripts/battery.sh" = e scripts.battery; - ".config/tmux/scripts/bar.sh" = e scripts.bar; - - ".config/tmux/tmux.conf".text = tmux-conf; - }; - - packages = [pkgs.tmux]; - }; - } diff --git a/modules/user/nixos/default.nix b/modules/user/nixos/default.nix new file mode 100644 index 0000000..8692652 --- /dev/null +++ b/modules/user/nixos/default.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + ... +}: let + cfg = config.collinux.user; +in { + users.users."${cfg.name}" = { + isNormalUser = true; + description = cfg.name; + extraGroups = ["networkmanager" "disks" "input" "video"] ++ (lib.optional cfg.isAdmin "wheel"); + hashedPassword = cfg.password; + }; + security.sudo-rs.enable = true; + + time.timeZone = "America/Chicago"; + + hjem = { + clobberByDefault = true; + users."${cfg.name}" = { + enable = true; + directory = "/home/${cfg.name}"; + user = cfg.name; + }; + }; +} diff --git a/modules/user/system/default.nix b/modules/user/system/default.nix deleted file mode 100644 index 8692652..0000000 --- a/modules/user/system/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - ... -}: let - cfg = config.collinux.user; -in { - users.users."${cfg.name}" = { - isNormalUser = true; - description = cfg.name; - extraGroups = ["networkmanager" "disks" "input" "video"] ++ (lib.optional cfg.isAdmin "wheel"); - hashedPassword = cfg.password; - }; - security.sudo-rs.enable = true; - - time.timeZone = "America/Chicago"; - - hjem = { - clobberByDefault = true; - users."${cfg.name}" = { - enable = true; - directory = "/home/${cfg.name}"; - user = cfg.name; - }; - }; -} -- cgit v1.3.1