aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/boot/nixos/default.nix10
-rw-r--r--modules/desktop/hjem/default.nix2
-rw-r--r--modules/desktop/hjem/gtk.nix27
-rw-r--r--modules/desktop/hjem/programs/foot.nix59
-rw-r--r--modules/desktop/hjem/programs/research.nix47
-rw-r--r--modules/desktop/hjem/wm/default.nix147
-rw-r--r--modules/desktop/hjem/wm/dunst.nix27
-rw-r--r--modules/desktop/hjem/wm/fuzzel.nix28
-rw-r--r--modules/desktop/hjem/wm/niri.nix119
-rw-r--r--modules/desktop/hjem/wm/sway.nix10
-rw-r--r--modules/desktop/nixos/greeters/greetd.nix2
-rw-r--r--modules/desktop/nixos/programs/firefox.nix15
-rw-r--r--modules/desktop/options.nix33
-rw-r--r--modules/nix/nixos/default.nix6
-rw-r--r--modules/options.nix95
-rw-r--r--modules/services/nixos/audio.nix2
-rw-r--r--modules/services/nixos/networking/default.nix2
-rw-r--r--modules/terminal/hjem/default.nix2
-rw-r--r--modules/terminal/hjem/programs/bash.nix27
-rw-r--r--modules/terminal/hjem/programs/cmus.nix74
-rw-r--r--modules/terminal/hjem/programs/fish.nix15
-rw-r--r--modules/terminal/hjem/programs/fzf.nix16
-rw-r--r--modules/terminal/hjem/programs/helix.nix12
-rw-r--r--modules/terminal/hjem/programs/starship.nix5
-rw-r--r--modules/terminal/hjem/programs/tmux.nix363
-rw-r--r--modules/terminal/nixos/bash.nix16
-rw-r--r--modules/terminal/nixos/default.nix4
-rw-r--r--modules/terminal/options.nix16
-rw-r--r--modules/user/nixos/default.nix2
29 files changed, 676 insertions, 507 deletions
diff --git a/modules/boot/nixos/default.nix b/modules/boot/nixos/default.nix
index 66f31fc..06e68c3 100644
--- a/modules/boot/nixos/default.nix
+++ b/modules/boot/nixos/default.nix
@@ -24,7 +24,7 @@ in {
configurationLimit = 3;
};
efi.canTouchEfiVariables = true;
- timeout = 0;
+ timeout = 0; # hold space to show boot menu
};
}
// (lib.optionalAttrs cfg.secureBoot.enable {
@@ -34,5 +34,11 @@ in {
};
});
- environment.systemPackages = lib.mkIf cfg.secureBoot.enable [pkgs.sbctl];
+ environment.systemPackages =
+ (
+ if cfg.secureBoot.enable
+ then [pkgs.sbctl]
+ else []
+ )
+ ++ [pkgs.efibootmgr];
}
diff --git a/modules/desktop/hjem/default.nix b/modules/desktop/hjem/default.nix
index f7dd95e..12623ef 100644
--- a/modules/desktop/hjem/default.nix
+++ b/modules/desktop/hjem/default.nix
@@ -3,6 +3,8 @@
./gtk.nix
./wm/sway.nix
+ ./wm/niri.nix
+ ./wm/default.nix
./wm/dunst.nix
./wm/fuzzel.nix
diff --git a/modules/desktop/hjem/gtk.nix b/modules/desktop/hjem/gtk.nix
index 3ea3b37..4665bac 100644
--- a/modules/desktop/hjem/gtk.nix
+++ b/modules/desktop/hjem/gtk.nix
@@ -22,17 +22,20 @@ in
gtk-icon-theme-name = "Papirus";
gtk-theme-name = cfg.theme_data.name;
};
- in {
- "gtk-3.0/settings.ini" = {
- generator = lib.generators.toINI {};
- inherit value;
+ in
+ {
+ "gtk-3.0/settings.ini" = {
+ generator = lib.generators.toINI {};
+ inherit value;
+ };
+ "gtk-4.0/settings.ini" = {
+ generator = lib.generators.toINI {};
+ inherit value;
+ };
+ }
+ // lib.optionalAttrs (cfg.theme == "catppuccin") {
+ "gtk-4.0/gtk.css".text = ''
+ @import url("file://${cfg.theme_data.package}/share/themes/catppuccin-mocha-blue-standard/gtk-4.0/gtk.css");
+ '';
};
- "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/foot.nix b/modules/desktop/hjem/programs/foot.nix
index 4d630c6..c05e22c 100644
--- a/modules/desktop/hjem/programs/foot.nix
+++ b/modules/desktop/hjem/programs/foot.nix
@@ -12,40 +12,33 @@
shell = "${pkgs.fish}/bin/fish";
};
- colors = {
- foreground = "cdd6f4";
- background = "1e1e2e";
- cursor = "11111b f5e0dc";
+ colors = with config.collinux.palette; {
+ alpha = "0.6";
- 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";
+ foreground = base05;
+ background = base00;
+ regular0 = base01;
+ regular1 = base08;
+ regular2 = base11;
+ regular3 = base10;
+ regular4 = base13;
+ regular5 = base14;
+ regular6 = base12;
+ regular7 = base06;
+ bright0 = base02;
+ bright1 = base08;
+ bright2 = base11;
+ bright3 = base10;
+ bright4 = base13;
+ bright5 = base14;
+ bright6 = base12;
+ bright7 = base07;
+ "16" = base09;
+ "17" = base15;
+ "18" = base01;
+ "19" = base02;
+ "20" = base04;
+ "21" = base06;
};
};
in
diff --git a/modules/desktop/hjem/programs/research.nix b/modules/desktop/hjem/programs/research.nix
index 3bfde76..1d31479 100644
--- a/modules/desktop/hjem/programs/research.nix
+++ b/modules/desktop/hjem/programs/research.nix
@@ -11,6 +11,7 @@ in
zotero
zathura
xournalpp
+ ocrmypdf
];
files = {
".config/xournalpp/toolbar.ini" = {
@@ -22,5 +23,51 @@ in
};
};
};
+
+ ".config/zathura/zathurarc".text = lib.mkIf (config.collinux.theme == "adwaita") ''
+ set font "Iosevka Nerd Font 11.5"
+
+ set recolor 'true'
+ set recolor-keephue 'false'
+ set recolor-reverse-video 'false'
+
+ # flipped to make dark mode
+ set recolor-lightcolor rgba(0,0,0,0)
+ set recolor-darkcolor '#DEDDDA'
+
+ set completion-fg '#DEDDDA'
+ set completion-bg '#303030'
+ set completion-group-fg '#33B2A4'
+ set completion-group-bg '#303030'
+ set completion-highlight-fg '#303030'
+ set completion-highlight-bg '#DEDDDA'
+
+ set default-fg '#DEDDDA'
+ set default-bg rgba(29,29,29,0.6)
+
+ set inputbar-fg '#DEDDDA'
+ set inputbar-bg '#303030'
+
+ set notification-fg '#DEDDDA'
+ set notification-bg '#303030'
+ set notification-error-fg '#DEDDDA'
+ set notification-error-bg '#E01B24'
+ set notification-warning-fg '#DEDDDA'
+ set notification-warning-bg '#E01B24'
+
+ set statusbar-fg '#DEDDDA'
+ set statusbar-bg '#303030'
+
+ set highlight-color '#33B2A4'
+ set highlight-active-color '#33B2A4'
+
+ set render-loading-fg '#DEDDDA'
+ set render-loading-bg '#303030'
+
+ set index-fg '#DEDDDA'
+ set index-bg '#303030'
+ set index-active-fg '#303030'
+ set index-active-bg '#DEDDDA'
+ '';
};
}
diff --git a/modules/desktop/hjem/wm/default.nix b/modules/desktop/hjem/wm/default.nix
new file mode 100644
index 0000000..a5575ad
--- /dev/null
+++ b/modules/desktop/hjem/wm/default.nix
@@ -0,0 +1,147 @@
+{pkgs, ...}: {
+ files.".config/util.lua" = {
+ text = let
+ lua = pkgs.lua.withPackages (p: [p.lua-subprocess]);
+ in
+ # lua
+ ''
+ #!${lua}/bin/lua
+ local subprocess = require("subprocess")
+
+ local function get_volume()
+ local proc, err = subprocess.popen({
+ "wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@",
+ stdout = subprocess.PIPE,
+ stderr = subprocess.PIPE
+ })
+ if not proc then
+ error("Failed to run wpctl get-volume: " .. tostring(err))
+ end
+
+ local out = proc.stdout:read("*a") or ""
+ local _, _, code = proc:wait()
+ if (code or 0) ~= 0 then
+ local errout = proc.stderr and proc.stderr:read("*a") or ""
+ error(("wpctl get-volume failed (code %d): %s"):format(code, errout))
+ end
+
+ local num = out:match("^Volume:%s*([%d%.]+)")
+ if not num then
+ error("Unexpected wpctl output: " .. out)
+ end
+
+ return tonumber(num) * 100
+ end
+
+ local function notify_volume()
+ local ok, reason, code = subprocess.call({
+ "dunstify", "-t", "300",
+ "-h", "string:x-canonical-private-synchronous:audio",
+ "Volume:", "-h", "int:value:"..get_volume()
+ })
+ if not ok then
+ io.stderr:write(("dunstify failed (%s, code %s)\n"):format(reason or "?", code or "?"))
+ end
+ end
+
+ local function set_volume(vol)
+ local ok, reason, code = subprocess.call({
+ "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", vol
+ })
+ if not ok then
+ io.stderr:write(("wpctl set-volume failed (%s, code %s)\n"):format(reason or "?", code or "?"))
+ end
+ end
+
+ local function get_brightness()
+ local proc = subprocess.popen({
+ "${pkgs.brightnessctl}/bin/brightnessctl", "-e", "get",
+ stdout = subprocess.PIPE
+ })
+ if not proc then error("Failed to run brightnessctl get") end
+ local cur = tonumber(proc.stdout:read("*a"))
+ proc:wait()
+ if not cur then error("Failed to parse brightnessctl get output") end
+
+ local proc2 = subprocess.popen({
+ "${pkgs.brightnessctl}/bin/brightnessctl", "-e", "max",
+ stdout = subprocess.PIPE
+ })
+ if not proc2 then error("Failed to run brightnessctl max") end
+ local max = tonumber(proc2.stdout:read("*a"))
+ proc2:wait()
+ if not max or max == 0 then error("Failed to parse brightnessctl max output") end
+
+ return (cur / max) * 100
+ end
+
+ local function notify_brightness()
+ local ok, reason, code = subprocess.call({
+ "dunstify", "-t", "300",
+ "-h", "string:x-canonical-private-synchronous:brightness",
+ "Brightness", "-h", "int:value:"..get_brightness()
+ })
+ if not ok then
+ io.stderr:write(("dunstify failed (%s, code %s)\n"):format(reason or "?", code or "?"))
+ end
+ end
+
+ local function set_brightness(brightness)
+ local ok, reason, code = subprocess.call({
+ "${pkgs.brightnessctl}/bin/brightnessctl", "-e", "set", brightness
+ })
+ if not ok then
+ io.stderr:write(("brightnessctl set failed (%s, code %s)\n"):format(reason or "?", code or "?"))
+ end
+ end
+
+ local function list_music_players()
+ local proc = subprocess.popen({
+ "${pkgs.playerctl}/bin/playerctl", "-l",
+ stdout = subprocess.PIPE
+ })
+ if not proc then error("Failed to run playerctl -l") end
+
+ local cur = proc.stdout:lines()
+
+ local out = {}
+ for i in cur do
+ table.insert(out, i)
+ end
+
+ return out
+ end
+
+ local function toggle_music()
+ local ok, reason, code = subprocess.call({
+ "${pkgs.playerctl}/bin/playerctl", "play-pause",
+ })
+ if not ok then
+ io.stderr:write(("playerctl play-pause failed (%s, code %s)\n"):format(reason or "?", code or "?"))
+ end
+ end
+
+ -- main logic
+ if arg[2] and arg[2]:match("^(%d+)%%([%+%-])$") then
+ if arg[1] == "vol" then
+ set_volume(arg[2])
+ notify_volume()
+ elseif arg[1] == "brightness" then
+ set_brightness(arg[2])
+ notify_brightness()
+ else
+ error(("arg[2] '%s' incorrect format. Should look like 5%%+ or 10%%-"):format(tostring(arg[2])))
+ end
+ elseif arg[1] and arg[1] == "music" then
+ if arg[2] == "play" then
+ toggle_music()
+ else
+ error(("Invalid arg[2]: '%s'. should be `play`"):format(arg[3]))
+ end
+ else
+ error("Unknown command: " .. tostring(arg[1]))
+ end
+ '';
+ executable = true;
+ };
+}
diff --git a/modules/desktop/hjem/wm/dunst.nix b/modules/desktop/hjem/wm/dunst.nix
index 38a8240..9366975 100644
--- a/modules/desktop/hjem/wm/dunst.nix
+++ b/modules/desktop/hjem/wm/dunst.nix
@@ -4,30 +4,31 @@
pkgs,
...
}: let
- cfg = config.collinux.desktop.sway.components.dunst;
+ cfg = config.collinux.desktop.wm.components.dunst;
- settings = ''
+ settings = with config.collinux.palette; ''
[global]
- frame_color = "#89b4fa"
+ frame_color = "#ffffff00"
separator_color = frame
- highlight = "#89b4fa"
+
+ highlight = "#${base13}"
+
+ font = "Iosevka Nerd Font"
offset = "(8,8)"
origin = "top-right"
- transparency = 10
- font = "Iosevka Nerd Font"
[urgency_low]
- background = "#1e1e2e"
- foreground = "#cdd6f4"
+ background = "#${base00}99"
+ foreground = "#${base05}ff"
[urgency_normal]
- background = "#1e1e2e"
- foreground = "#cdd6f4"
+ background = "#${base00}99"
+ foreground = "#${base05}ff"
[urgency_critical]
- background = "#1e1e2e"
- foreground = "#cdd6f4"
- frame_color = "#fab387"
+ background = "#${base00}99"
+ foreground = "#${base05}ff"
+ frame_color = "#${base08}"
'';
in
lib.mkIf cfg.enable {
diff --git a/modules/desktop/hjem/wm/fuzzel.nix b/modules/desktop/hjem/wm/fuzzel.nix
index 7b9d075..ab11d6b 100644
--- a/modules/desktop/hjem/wm/fuzzel.nix
+++ b/modules/desktop/hjem/wm/fuzzel.nix
@@ -4,7 +4,7 @@
pkgs,
...
}: let
- cfg = config.collinux.desktop.sway.components.fuzzel;
+ cfg = config.collinux.desktop.wm.components.fuzzel;
settings = {
main = {
@@ -21,21 +21,21 @@
};
border = {
radius = 0;
- width = 2;
+ width = 3;
};
- 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";
+ colors = with config.collinux.palette; {
+ background = "${base00}99";
+ border = "ffffff00";
+ input = base05;
+ match = base13;
+ placeholder = base03;
+ text = base04;
+ prompt = base04;
+
+ selection = "${base01}5a";
+ selection-match = base13;
+ selection-text = base05;
};
};
in
diff --git a/modules/desktop/hjem/wm/niri.nix b/modules/desktop/hjem/wm/niri.nix
new file mode 100644
index 0000000..4449f82
--- /dev/null
+++ b/modules/desktop/hjem/wm/niri.nix
@@ -0,0 +1,119 @@
+{
+ pkgs,
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.collinux.desktop.wm.niri;
+in
+ lib.mkIf cfg.enable {
+ files.".config/niri/config.kdl".text = ''
+ spawn-sh-at-startup "${config.collinux.desktop.wallpaper_cmd}"
+ spawn-at-startup "${pkgs.playerctl}/bin/playerctld daemon"
+ spawn-at-startup "dunst"
+
+ prefer-no-csd
+ environment {
+ GTK_CSD "1"
+ }
+
+ output "eDP-1" {
+ scale 1.0
+ }
+
+ input {
+ focus-follows-mouse
+ }
+
+ hotkey-overlay {
+ skip-at-startup
+ hide-not-bound
+ }
+
+ binds {
+ Mod+Q { close-window; }
+
+ Mod+Space { spawn "fuzzel"; }
+ Mod+Return { spawn "foot"; }
+ Mod+B { spawn "firefox"; }
+
+ Mod+m { maximize-column; }
+
+ XF86MonBrightnessUp { spawn "~/.config/util.lua" "brightness" "5%+"; }
+ XF86MonBrightnessDown { spawn "~/.config/util.lua" "brightness" "5%-"; }
+ XF86AudioRaiseVolume { spawn "~/.config/util.lua" "vol" "5%+"; }
+ XF86AudioLowerVolume { spawn "~/.config/util.lua" "vol" "5%-"; }
+ }
+
+ gestures {
+ hot-corners {
+ off
+ }
+ }
+
+ overview {
+ zoom 0.66
+ workspace-shadow {
+ off
+ }
+ }
+
+ layout {
+ gaps 12
+
+ focus-ring {
+ off
+ }
+
+ border {
+ width 3
+ active-color "#ffffff00"
+ inactive-color "#ffffff00"
+ urgent-color "#ffffff00"
+ }
+
+ struts {
+ left 16
+ right 16
+ top 16
+ bottom 16
+ }
+
+ background-color "transparent"
+ }
+
+ layer-rule {
+ match namespace="^wallpaper$"
+ place-within-backdrop true
+ }
+
+ layer-rule {
+ match namespace="^launcher$"
+ shadow {
+ on
+ }
+ }
+
+ layer-rule {
+ match namespace="^notifications$"
+ shadow {
+ on
+ }
+ }
+
+ window-rule {
+ match app-id="firefox"
+ open-maximized true
+ }
+
+ window-rule {
+ match is-focused=true
+ shadow {
+ on
+ }
+ }
+
+ '';
+
+ packages = [pkgs.niri pkgs.xwayland-satellite];
+ }
diff --git a/modules/desktop/hjem/wm/sway.nix b/modules/desktop/hjem/wm/sway.nix
index 1cd7750..367cd0d 100644
--- a/modules/desktop/hjem/wm/sway.nix
+++ b/modules/desktop/hjem/wm/sway.nix
@@ -4,7 +4,7 @@
lib,
...
}: let
- cfg = config.collinux.desktop.sway;
+ cfg = config.collinux.desktop.wm.sway;
colors = ''
set $rosewater #f5e0dc
@@ -36,7 +36,6 @@
'';
settings = ''
- exec ${pkgs.foot}/bin/foot --server
exec ${pkgs.swaybg}/bin/swaybg -i ${config.collinux.desktop.wallpaper}
exec ${pkgs.dunst}/bin/dunst
@@ -74,13 +73,15 @@
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+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 Mod4+Shift+s exec '${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" ~/Pictures/$(date +"%s_grim.png")'
+ bindsym Mod4+Alt+s exec '${pkgs.hyprpicker}/bin/hyprpicker'
+
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)"'
@@ -106,5 +107,6 @@ in
sway
brightnessctl
playerctl
+ wl-clipboard
];
}
diff --git a/modules/desktop/nixos/greeters/greetd.nix b/modules/desktop/nixos/greeters/greetd.nix
index 42ff9a7..b612c86 100644
--- a/modules/desktop/nixos/greeters/greetd.nix
+++ b/modules/desktop/nixos/greeters/greetd.nix
@@ -10,7 +10,7 @@ in
enable = true;
settings = rec {
initial_session = {
- command = lib.getExe cfg.command;
+ command = cfg.command;
user = config.collinux.user.name;
};
default_session = initial_session;
diff --git a/modules/desktop/nixos/programs/firefox.nix b/modules/desktop/nixos/programs/firefox.nix
index 29ef8cb..c8edca1 100644
--- a/modules/desktop/nixos/programs/firefox.nix
+++ b/modules/desktop/nixos/programs/firefox.nix
@@ -16,7 +16,7 @@ in
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
- Homepage = "";
+ Homepage = "about:blank";
NewTabPage = false;
@@ -34,6 +34,13 @@ in
);
"browser.tabs.hoverPreview.enabled" = opt 0;
+ "browser.theme.content-theme" = opt 0;
+ "browser.theme.toolbar-theme" = opt 0;
+ "browser.display.background_color.dark" =
+ if cfg.theme == "adwaita"
+ then opt "#1d1d1d"
+ else opt "";
+
"browser.tabs.loadBookmarksInTabs" = opt true;
"browser.toolbars.bookmarks.visibility" = opt "never";
"browser.uiCustomization.state" = opt (lib.replaceStrings ["\n" " "] ["" ""] ''
@@ -84,7 +91,7 @@ in
"accessibility.force_disabled" = opt 1;
"browser.aboutConfig.showWarning" = opt false;
- "startup.homepage_welcome_url" = opt "";
+ "startup.homepage_welcome_url" = opt "about:blank";
"trailhead.firstrun.didSeeAboutWelcome" = opt true;
"datareporting.policy.dataSubmissionPolicyBypassNotification" = opt true;
"browser.startup.homepage" = opt "about:blank";
@@ -110,10 +117,14 @@ in
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = ext "bitwarden-password-manager";
"uBlock0@raymondhill.net" = ext "uBlock0@raymondhill.net";
"addon@darkreader.org" = ext "addon@darkreader.org";
+ "*" = {installation_mode = "blocked";}; # force uninstall inactive extensions
}
// (lib.optionalAttrs (cfg.theme == "catppuccin") {
"{88b098c8-19be-421e-8ffa-85ddd1f3f004}" = ext "catppuccin-mocha-blue";
})
+ // (lib.optionalAttrs (cfg.theme == "adwaita") {
+ "{f1128560-8b23-46c1-aa6f-fb3e79f23cf3}" = ext "gnome-adwaita-gtk4-dark";
+ })
// (lib.optionalAttrs (cfg.extensions.zotero.enable) {
"zotero@chnm.gmu.edu" = {
installation_mode = "force_installed";
diff --git a/modules/desktop/options.nix b/modules/desktop/options.nix
index 994b13d..741f79b 100644
--- a/modules/desktop/options.nix
+++ b/modules/desktop/options.nix
@@ -14,23 +14,31 @@ in {
type = with types; oneOf [str path];
description = "File to use as the wallpaper on this machine";
};
+ wallpaper_cmd = mkOption {
+ type = types.str;
+ default = "${lib.getExe pkgs.wbg} -s ${config.collinux.desktop.wallpaper}";
+ };
greetd = {
enable = mkEnableOption "greetd greeter";
command = mkOption {
- type = lib.types.package;
+ type = lib.types.str;
default = let
cfg = config.collinux.desktop;
in
- if (cfg.sway.enable && !cfg.gnome.enable)
- then pkgs.sway
+ if (cfg.wm.sway.enable && !cfg.gnome.enable && !cfg.wm.niri.enable)
+ then lib.getExe pkgs.sway
+ else if (cfg.wm.niri.enable && !cfg.gnome.enable && !cfg.wm.sway.enable)
+ then "${pkgs.niri}/bin/niri-session"
else null;
};
};
gdm.enable = mkEnableOption "gdm display manager";
- sway = {
- enable = mkEnableOption "sway";
+ wm = {
+ sway.enable = mkEnableOption "sway";
+ niri.enable = mkEnableOption "niri";
+
components = {
# waybar = mkProgramOption "waybar";
dunst = mkProgramOption "dunst";
@@ -42,7 +50,7 @@ in {
gtk = {
enable = mkEnableOption "gtk theming";
theme = mkOption {
- type = types.enum ["catppuccin" "adwaita"];
+ type = types.enum ["catppuccin" "adwaita" "kanagawa"];
default = config.collinux.theme;
};
cursor_data = {
@@ -100,7 +108,7 @@ in {
default = config.collinux.user.name;
};
theme = mkOption {
- type = types.enum ["none" "catppuccin" "adwaita"];
+ type = types.enum ["none" "catppuccin" "adwaita" "kanagawa"];
default = config.collinux.theme;
};
extensions.zotero.enable = mkOption {
@@ -109,7 +117,7 @@ in {
};
};
- foot.enable = mkEnableOption "foot";
+ foot = mkProgramOption "foot";
blackbox.enable = mkEnableOption "blackbox";
alacritty.enable = mkEnableOption "alacritty";
@@ -117,4 +125,13 @@ in {
};
};
};
+
+ config = {
+ assertions = [
+ {
+ assertion = with config.collinux.desktop; !(gdm.enable && greetd.enable);
+ message = "Can't enable gdm and greetd at the same time";
+ }
+ ];
+ };
}
diff --git a/modules/nix/nixos/default.nix b/modules/nix/nixos/default.nix
index 9c5c51e..07e7f44 100644
--- a/modules/nix/nixos/default.nix
+++ b/modules/nix/nixos/default.nix
@@ -1,4 +1,8 @@
-{config, pkgs, ...}: {
+{
+ config,
+ pkgs,
+ ...
+}: {
nix = {
gc.automatic = false; # use nh cleaner instead
diff --git a/modules/options.nix b/modules/options.nix
index b890831..65de32e 100644
--- a/modules/options.nix
+++ b/modules/options.nix
@@ -1,9 +1,100 @@
-{lib, ...}: let
+{
+ lib,
+ config,
+ ...
+}: let
inherit (lib) mkOption types;
in {
options = {
collinux.theme = mkOption {
- type = types.enum ["catppuccin" "adwaita"];
+ type = types.enum ["catppuccin" "adwaita" "kanagawa"];
};
+
+ collinux.palette = let
+ colorOption = lib.mkOption {
+ type = lib.types.strMatching "^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$";
+ };
+ in
+ lib.mkOption {
+ type = lib.types.submodule {
+ options = {
+ base00 = colorOption;
+ base01 = colorOption;
+ base02 = colorOption;
+ base03 = colorOption;
+ base04 = colorOption;
+ base05 = colorOption;
+ base06 = colorOption;
+ base07 = colorOption;
+ base08 = colorOption;
+ base09 = colorOption;
+ base10 = colorOption;
+ base11 = colorOption;
+ base12 = colorOption;
+ base13 = colorOption;
+ base14 = colorOption;
+ base15 = colorOption;
+ };
+ };
+ default =
+ if (config.collinux.theme == "catppuccin")
+ then {
+ base00 = "1E1E2E";
+ base01 = "181825";
+ base02 = "313244";
+ base03 = "45475A";
+ base04 = "585B70";
+ base05 = "CDD6F4";
+ base06 = "F5E0DC";
+ base07 = "B4BEFE";
+ base08 = "F38BA8";
+ base09 = "FAB387";
+ base10 = "F9E2AF";
+ base11 = "A6E3A1";
+ base12 = "94E2D5";
+ base13 = "89B4FA";
+ base14 = "CBA6F7";
+ base15 = "F2CDCD";
+ }
+ else if (config.collinux.theme == "adwaita")
+ then {
+ base00 = "1D1D1D";
+ base01 = "303030";
+ base02 = "3D3846";
+ base03 = "77767B";
+ base04 = "B0AFAC";
+ base05 = "DEDDDA";
+ base06 = "F6F5F4";
+ base07 = "FCFCFC";
+ base08 = "E01B24";
+ base09 = "FF7800";
+ base10 = "F5C211";
+ base11 = "33D17A";
+ base12 = "33B2A4";
+ base13 = "3584E4";
+ base14 = "9141AC";
+ base15 = "986A44";
+ }
+ else if (config.collinux.theme == "kanagawa")
+ then {
+ base00 = "1F1F28";
+ base01 = "16161D";
+ base02 = "223249";
+ base03 = "54546D";
+ base04 = "727169";
+ base05 = "DCD7BA";
+ base06 = "C8C093";
+ base07 = "717C7C";
+ base08 = "C34043";
+ base09 = "FFA066";
+ base10 = "C0A36E";
+ base11 = "76946A";
+ base12 = "6A9589";
+ base13 = "7E9CD8";
+ base14 = "957FB8";
+ base15 = "D27E99";
+ }
+ else {};
+ };
};
}
diff --git a/modules/services/nixos/audio.nix b/modules/services/nixos/audio.nix
index 273f1a4..93f8289 100644
--- a/modules/services/nixos/audio.nix
+++ b/modules/services/nixos/audio.nix
@@ -7,7 +7,7 @@
cfg = config.collinux.services.audio;
in
lib.mkIf cfg.enable {
- security.rtkit.enable = false;
+ security.rtkit.enable = true;
services.pipewire = {
enable = true;
wireplumber.enable = true;
diff --git a/modules/services/nixos/networking/default.nix b/modules/services/nixos/networking/default.nix
index 68c794c..de22f8b 100644
--- a/modules/services/nixos/networking/default.nix
+++ b/modules/services/nixos/networking/default.nix
@@ -14,5 +14,7 @@
};
networking.resolvconf.enable = false;
+
+ systemd.network.wait-online.enable = false;
};
}
diff --git a/modules/terminal/hjem/default.nix b/modules/terminal/hjem/default.nix
index 7915319..681c3b3 100644
--- a/modules/terminal/hjem/default.nix
+++ b/modules/terminal/hjem/default.nix
@@ -10,6 +10,8 @@
./programs/broot.nix
./programs/cmus.nix
./programs/helix.nix
+
./programs/fish.nix
+ ./programs/bash.nix
];
}
diff --git a/modules/terminal/hjem/programs/bash.nix b/modules/terminal/hjem/programs/bash.nix
index 646cbf8..fe6f21d 100644
--- a/modules/terminal/hjem/programs/bash.nix
+++ b/modules/terminal/hjem/programs/bash.nix
@@ -8,22 +8,23 @@
in
lib.mkIf cfg.enable {
files = {
- ".bashrc".text = ''
+ ".config/bash/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
- ];
};
+
+ packages = with pkgs; [
+ fish
+ ripgrep
+ fd
+ wget
+ moreutils
+ zip
+ unzip
+ btop
+ jq
+ direnv
+ ];
}
diff --git a/modules/terminal/hjem/programs/cmus.nix b/modules/terminal/hjem/programs/cmus.nix
index afd2350..7a5ac81 100644
--- a/modules/terminal/hjem/programs/cmus.nix
+++ b/modules/terminal/hjem/programs/cmus.nix
@@ -25,57 +25,34 @@
'';
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
+ set color_cmdline_error=lightred
+ set color_cmdline_info=lightyellow
+ set color_cmdline_fg=lightred
+ set color_cmdline_bg=237
+ set color_separator=238
+ set color_statusline_bg=blue
+ set color_statusline_fg=233
+ set color_titleline_bg=237
+ set color_titleline_fg=white
+ set color_win_bg=black
+ set color_win_fg=241
+ set color_win_cur=lightgreen
+ set color_win_cur_sel_bg=green
+ set color_win_cur_sel_fg=233
+ set color_win_dir=lightblue
+ set color_win_fg=white
+ set color_win_inactive_cur_sel_bg=016
+ set color_win_inactive_cur_sel_fg=233
+ set color_win_sel_bg=237
+ set color_win_sel_fg=white
+ set color_win_title_bg=237
+ set color_win_title_fg=lightred
'';
cmus_rc = ''
- ${
- if (cfg.theme == "catppuccin")
- then "colorscheme catppuccin"
- else ""
- }
+ colorscheme all
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
@@ -87,9 +64,8 @@ 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;
+ ".config/cmus/all.theme".text = cmus_theme;
};
- packages = with pkgs; [cava cmus];
+ packages = [pkgs.cmus];
}
diff --git a/modules/terminal/hjem/programs/fish.nix b/modules/terminal/hjem/programs/fish.nix
index 1aa4a40..2fdc184 100644
--- a/modules/terminal/hjem/programs/fish.nix
+++ b/modules/terminal/hjem/programs/fish.nix
@@ -8,6 +8,20 @@
in
lib.mkIf cfg.enable {
files = {
+ ".config/fish/conf.d/xdg.fish".text =
+ # fish
+ ''
+ set -gx XDG_DATA_HOME "$HOME/.local/share"
+ set -gx XDG_CONFIG_HOME "$HOME/.config"
+ set -gx XDG_STATE_HOME "$HOME/.local/state"
+ set -gx XDG_CACHE_HOME "$HOME/.cache"
+
+ alias wget "wget --hsts-file=/dev/null"
+ set -gx GOPATH "$XDG_DATA_HOME/go"
+ set -gx GRADLE_USER_HOME "$XDG_DATA_HOME/gradle"
+ set -gx CARGO_HOME "$XDG_DATA_HOME/cargo"
+ '';
+
".config/fish/config.fish".text = ''
set fish_greeting
@@ -24,6 +38,7 @@ in
fish
ripgrep
fd
+ wget
moreutils
zip
unzip
diff --git a/modules/terminal/hjem/programs/fzf.nix b/modules/terminal/hjem/programs/fzf.nix
index 5a51739..f697a24 100644
--- a/modules/terminal/hjem/programs/fzf.nix
+++ b/modules/terminal/hjem/programs/fzf.nix
@@ -8,18 +8,24 @@
in
lib.mkIf cfg.enable {
files =
- (lib.optionalAttrs config.collinux.terminal.shells.fish.enable {
+ lib.optionalAttrs config.collinux.terminal.shells.fish.enable (with config.collinux.palette; {
".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"
+ set -Ux FZF_DEFAULT_OPTS "$FZF_NON_COLOR_OPTS"\
+ " --color=bg+:#${base01},bg:#${base00},spinner:#${base12},hl:#${base13}"\
+ " --color=fg:#${base04},header:#${base13},info:#${base10},pointer:#${base12}"\
+ " --color=marker:#${base12},fg+:#${base06},prompt:#${base10},hl+:#${base13}"
'';
})
- // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable {
+ // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable (with config.collinux.palette; {
".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"
+ export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS"\
+ " --color=bg+:#${base01},bg:#${base00},spinner:#${base12},hl:#${base13}"\
+ " --color=fg:#${base04},header:#${base13},info:#${base10},pointer:#${base12}"\
+ " --color=marker:#${base12},fg+:#${base06},prompt:#${base10},hl+:#${base13}"
'';
- });
+ }));
packages = [pkgs.fzf];
}
diff --git a/modules/terminal/hjem/programs/helix.nix b/modules/terminal/hjem/programs/helix.nix
index e66877b..80279c4 100644
--- a/modules/terminal/hjem/programs/helix.nix
+++ b/modules/terminal/hjem/programs/helix.nix
@@ -44,8 +44,8 @@
];
};
- theme = {
- inherits = "catppuccin_mocha";
+ mkTransparentBackground = inherits: {
+ inherit inherits;
"ui.background" = {};
};
@@ -134,7 +134,9 @@
if cfg.theme == "catppuccin"
then "catppuccin_mocha_transparent"
else if cfg.theme == "adwaita"
- then "adwaita-dark"
+ then "adwaita_dark_transparent"
+ else if cfg.theme == "kanagawa"
+ then "kanagawa_transparent"
else "";
};
in
@@ -148,7 +150,9 @@ in
{
".config/helix/config.toml" = t settings;
".config/helix/languages.toml" = t languages;
- ".config/helix/themes/catppuccin_mocha_transparent.toml" = t theme;
+ ".config/helix/themes/catppuccin_mocha_transparent.toml" = t (mkTransparentBackground "catppuccin_mocha");
+ ".config/helix/themes/adwaita_dark_transparent.toml" = t (mkTransparentBackground "adwaita-dark");
+ ".config/helix/themes/kanagawa_transparent.toml" = t (mkTransparentBackground "kanagawa");
}
// (lib.optionalAttrs config.collinux.terminal.shells.fish.enable {
".config/fish/conf.d/helix.fish".text = ''
diff --git a/modules/terminal/hjem/programs/starship.nix b/modules/terminal/hjem/programs/starship.nix
index e9d79b5..7f537d9 100644
--- a/modules/terminal/hjem/programs/starship.nix
+++ b/modules/terminal/hjem/programs/starship.nix
@@ -51,11 +51,6 @@ in
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
index 738e729..152c443 100644
--- a/modules/terminal/hjem/programs/tmux.nix
+++ b/modules/terminal/hjem/programs/tmux.nix
@@ -1,339 +1,44 @@
{
+ pkgs,
+ inputs,
lib,
config,
- pkgs,
...
}: let
cfg = config.collinux.terminal.programs.tmux;
+in {
+ imports = [
+ inputs.tmux-tsunami.hjemModules.tsunami
+ ];
- 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" | ${pkgs.bc}/bin/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 = ''${pkgs.broot}/bin/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 = ''${pkgs.broot}/bin/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) "
- '';
-
- scripts.catpuccinNoBorders =
- if (cfg.theme == "catppuccin")
- then ''
- bg_dark="#181825"
+ config = lib.mkIf cfg.enable {
+ tsunami = {
+ enable = true;
- ## 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
+ theme =
+ if (cfg.theme == "catppuccin")
+ then {
+ bg = "#1e1e2e";
+ bg_dark = "#181825";
+ }
+ else if (cfg.theme == "adwaita")
+ then {
+ bg = "#1d1d1d";
+ bg_dark = "#171717";
+ }
+ else {};
- ## 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
- ''
- else ''
- tmux set -g status-bg "#262626"
- '';
-
- # -- 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 | ${pkgs.fzf}/bin/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"
- run-shell "${scriptsDir}/catppuccin-borders.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/scripts/catppuccin-borders.sh" = e scripts.catpuccinNoBorders;
-
- ".config/tmux/tmux.conf".text = tmux-conf;
+ keys.leader = [
+ {
+ name = "Lazygit";
+ key = "C-g";
+ exec = "display-popup -E -w 80% -h 80% -x C -y C -d '#{?@default-path,#{@default-path},#{pane_current_path}}' ${lib.getExe pkgs.lazygit}";
+ }
+ ];
+ confs."main" = ''
+ set -g mouse on
+ set-window-option -g mode-keys vi
+ '';
};
-
- packages = [pkgs.tmux];
- }
+ };
+}
diff --git a/modules/terminal/nixos/bash.nix b/modules/terminal/nixos/bash.nix
new file mode 100644
index 0000000..393ab94
--- /dev/null
+++ b/modules/terminal/nixos/bash.nix
@@ -0,0 +1,16 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.collinux.terminal.shells.bash;
+in
+ lib.mkIf cfg.enable {
+ environment.etc = {
+ "bashrc.local".text = ''
+ if [ -s "''${XDG_CONFIG_HOME:-$HOME/.config}/bash/bashrc" ]; then
+ . "''${XDG_CONFIG_HOME:-$HOME/.config}/bash/bashrc"
+ fi
+ '';
+ };
+ }
diff --git a/modules/terminal/nixos/default.nix b/modules/terminal/nixos/default.nix
index 8118c63..4ececfa 100644
--- a/modules/terminal/nixos/default.nix
+++ b/modules/terminal/nixos/default.nix
@@ -1,6 +1,10 @@
{config, ...}: let
cfg = config.collinux.terminal.shells;
in {
+ imports = [
+ ./bash.nix
+ ];
+
programs.command-not-found.enable = false; # broken without nix-channels
users.users."${config.collinux.user.name}" = {
diff --git a/modules/terminal/options.nix b/modules/terminal/options.nix
index 47f2057..e55ab1b 100644
--- a/modules/terminal/options.nix
+++ b/modules/terminal/options.nix
@@ -6,15 +6,10 @@
...
}: let
inherit (lib) mkOption mkEnableOption types;
- inherit (my-lib.options {inherit lib config;}) mkProgramOption' mkProgramOption;
+ inherit (my-lib.options {inherit lib config;}) mkProgramOption;
in {
options = {
collinux.terminal = {
- theme = mkOption {
- type = types.enum ["catppuccin" "adwaita"];
- default = config.collinux.theme;
- };
-
shells = {
fish = mkProgramOption "fish shell";
bash = mkProgramOption "bash shell";
@@ -36,7 +31,7 @@ in {
starship = mkProgramOption "starship prompt";
lazygit.enable = mkEnableOption "lazygit";
- cmus = mkProgramOption "cmus";
+ cmus.enable = mkEnableOption "cmus";
nh.enable = mkEnableOption "nh nix helper";
git = {
@@ -50,7 +45,12 @@ in {
};
};
- helix = mkProgramOption' "helix text editor" {
+ helix = {
+ enable = mkEnableOption "helix text editor";
+ theme = mkOption {
+ type = lib.types.enum ["catppuccin" "adwaita" "kanagawa"];
+ default = config.collinux.theme;
+ };
hardMode = mkOption {
type = types.bool;
description = "Disable arrow keys and mouse";
diff --git a/modules/user/nixos/default.nix b/modules/user/nixos/default.nix
index 8692652..05afe37 100644
--- a/modules/user/nixos/default.nix
+++ b/modules/user/nixos/default.nix
@@ -8,7 +8,7 @@ in {
users.users."${cfg.name}" = {
isNormalUser = true;
description = cfg.name;
- extraGroups = ["networkmanager" "disks" "input" "video"] ++ (lib.optional cfg.isAdmin "wheel");
+ extraGroups = ["networkmanager" "pipewire" "disks" "input" "video" "dialout" "kvm"] ++ (lib.optional cfg.isAdmin "wheel");
hashedPassword = cfg.password;
};
security.sudo-rs.enable = true;