From 280a559e01a264a34b40e1fdabd95b77a83c9236 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 29 Sep 2023 16:57:26 -0500 Subject: [PATCH 1/3] WIP desktop config port to nix --- fish/interactiveShellInit.fish | 6 +- flake.lock | 14 +- flake.nix | 4 +- home/linux.nix | 294 ++++++++++++++++++++++++++++----- home/user.nix | 192 +++++++++++++++++++-- modules/desktop-usage.nix | 1 + modules/sway.nix | 2 +- nixos.nix | 15 +- nixos/common.nix | 3 +- nixos/musicbox.nix | 80 --------- nixos/thinker.nix | 2 +- 11 files changed, 455 insertions(+), 158 deletions(-) diff --git a/fish/interactiveShellInit.fish b/fish/interactiveShellInit.fish index 70291d7..92cbdff 100644 --- a/fish/interactiveShellInit.fish +++ b/fish/interactiveShellInit.fish @@ -91,15 +91,15 @@ function _maybe_git_summary end function _prompt_marker - printf "%b133;A%b" "\x1b\x5d" "\x1b\x5c" + # printf "%b133;A%b" "\x1b\x5d" "\x1b\x5c" end function _prompt_continuation_marker - printf "%b133;A;k=s%b" "\x1b\x5d" "\x1b\x5c" + # printf "%b133;A;k=s%b" "\x1b\x5d" "\x1b\x5c" end function cmd_marker --on-variable _ - printf "%b133;C%b" "\x1b\x5d" "\x1b\x5c" + # printf "%b133;C%b" "\x1b\x5d" "\x1b\x5c" end function _prompt_prefix diff --git a/flake.lock b/flake.lock index c977fc8..7279559 100644 --- a/flake.lock +++ b/flake.lock @@ -178,16 +178,15 @@ ] }, "locked": { - "lastModified": 1693208669, - "narHash": "sha256-hHFaaUsZ860wvppPeiu7nJn/nXZjJfnqAQEu9SPFE9I=", + "lastModified": 1695984718, + "narHash": "sha256-LQwKgaaaFOkIcxarf0xQXeDJFwZ5BZWcgmPeo3xp2CM=", "owner": "nix-community", "repo": "home-manager", - "rev": "5bac4a1c06cd77cf8fc35a658ccb035a6c50cd2c", + "rev": "4f02e35f9d150573e1a710afa338846c2f6d850c", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", "repo": "home-manager", "type": "github" } @@ -258,16 +257,15 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1692794066, - "narHash": "sha256-H0aG8r16dj0x/Wz6wQhQxc9V7AsObOiHPaKxQgH6Y08=", + "lastModified": 1696018110, + "narHash": "sha256-eLB8ruJGmDiSO4ysDZOkDq3tkzuRT77tXKmfHN5nBa4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fc944919f743bb22379dddf18dcb72db6cff84aa", + "rev": "ae95a37b32e51fe3b5d89ce6bf037ec188c5560a", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 80d25d0..e38f805 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,11 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:NixOS/nixpkgs"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; # nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-channels/nixos-unstable"; api-lyte-dev.url = "git+ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git"; home-manager = { - url = "github:nix-community/home-manager/release-23.05"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; inputs.utils.follows = "utils"; }; diff --git a/home/linux.nix b/home/linux.nix index cf8674f..5bbb979 100644 --- a/home/linux.nix +++ b/home/linux.nix @@ -1,10 +1,207 @@ -{ pkgs, ... }: { +{ config, pkgs, ... }: { home.pointerCursor = { name = "Catppuccin-Mocha-Sapphire-Cursors"; package = pkgs.catppuccin-cursors.mochaSapphire; size = 64; # TODO: this doesn't seem to work -- at least in Sway }; + services = { + mako = { + enable = true; + }; + }; + + wayland.windowManager.sway = { + enable = true; + + systemd = { + enable = true; + }; + + config = { + output = { + "*" = { + background = "$HOME/.wallpaper fill"; + }; + }; + + # TODO: popup_during_fullscreen smart + focus = { + wrapping = "yes"; + followMouse = "no"; + mouseWarping = false; + }; + + modifier = "Mod4"; + + gaps = { + smartBorders = "on"; + }; + + window = { + border = 2; + }; + + floating = { + modifier = config.wayland.windowManager.sway.config.modifier; + titlebar = false; + }; + + startup = [ + { command = "systemctl --user restart waybar"; always = true; } + { command = "firefox"; always = true; } + { command = "kitty --single-instance"; always = true; } + ]; + + modes = { + resize = { + "h" = "resize shrink width 10 px or 10 ppt"; + "j" = "resize grow height 10 px or 10 ppt"; + "k" = "resize shrink height 10 px or 10 ppt"; + "l" = "resize grow width 10 px or 10 ppt"; + + "left" = "resize shrink width 10 px or 10 ppt"; + "down" = "resize grow height 10 px or 10 ppt"; + "up" = "resize shrink height 10 px or 10 ppt"; + "right" = "resize grow width 10 px or 10 ppt"; + + "return" = ''mode "default"''; + "escape" = ''mode "default"''; + }; + }; + + input = { + "type:keyboard" = { + xkb_options = "ctrl:nocaps"; + repeat_delay = "200"; + repeat_rate = "60"; + }; + + "type:pointer" = { + accel_profile = "flat"; + pointer_accel = "0"; + }; + + "type:touchpad" = { + dwt = "disabled"; + tap = "enabled"; + natural_scroll = "enabled"; + middle_emulation = "enabled"; + # pointer_accel + }; + + }; + keybindings = let mod = config.wayland.windowManager.sway.config.modifier; in { + # bindsym $mod+shift+space exec wofi --show drun + "${mod}+control+space" = "exec makoctl dismiss"; + "${mod}+shift+space" = "exec makoctl invoke"; + "${mod}+return" = "exec kitty --single-instance"; + "${mod}+shift+return" = "exec floating-term"; + "${mod}+shift+alt+return" = "exec kitty"; + "${mod}+c" = "kill"; + "${mod}+shift+c" = "kill # TODO: kill -9?"; + "${mod}+space" = "exec wofi --show drun"; + "${mod}+shift+s" = "exec clipshot"; + "${mod}+e" = "exec thunar"; + "${mod}+shift+r" = "reload"; + "${mod}+control+Escape" = "exit"; + "${mod}+shift+e" = "exit"; + "${mod}+shift+p" = "exec pass-chooser"; + "${mod}+control+j" = "split v"; + "${mod}+control+l" = "split h"; + "${mod}+control+f" = "focus mode_toggle"; + + "${mod}+h" = "focus left"; + "${mod}+j" = "focus down"; + "${mod}+k" = "focus up"; + "${mod}+l" = "focus right"; + + "${mod}+left" = "focus left"; + "${mod}+down" = "focus down"; + "${mod}+up" = "focus up"; + "${mod}+right" = "focus right"; + + "${mod}+shift+h" = "move left"; + "${mod}+shift+j" = "move down"; + "${mod}+shift+k" = "move up"; + "${mod}+shift+l" = "move right"; + + "${mod}+shift+left" = "move left"; + "${mod}+shift+down" = "move down"; + "${mod}+shift+up" = "move up"; + "${mod}+shift+right" = "move right"; + + "${mod}+1" = "workspace 1"; + "${mod}+2" = "workspace 2"; + "${mod}+3" = "workspace 3"; + "${mod}+4" = "workspace 4"; + "${mod}+5" = "workspace 5"; + "${mod}+6" = "workspace 6"; + "${mod}+7" = "workspace 7"; + "${mod}+8" = "workspace 8"; + "${mod}+9" = "workspace 9"; + "${mod}+0" = "workspace 10"; + + "${mod}+shift+1" = "move container to workspace 1"; + "${mod}+shift+2" = "move container to workspace 2"; + "${mod}+shift+3" = "move container to workspace 3"; + "${mod}+shift+4" = "move container to workspace 4"; + "${mod}+shift+5" = "move container to workspace 5"; + "${mod}+shift+6" = "move container to workspace 6"; + "${mod}+shift+7" = "move container to workspace 7"; + "${mod}+shift+8" = "move container to workspace 8"; + "${mod}+shift+9" = "move container to workspace 9"; + "${mod}+shift+0" = "move container to workspace 10"; + + "${mod}+b" = "splith"; + "${mod}+v" = "splitv"; + + "${mod}+shift+f" = "fullscreen toggle"; + "${mod}+f" = "floating toggle"; + "${mod}+s" = "floating disable"; + "${mod}+alt+f" = "focus mode_toggle"; + "${mod}+p" = "focus parent"; + "${mod}+period" = "focus child"; + "${mod}+comma" = "focus child"; + "${mod}+tab" = "workspace back_and_forth"; + + "${mod}+minus" = "gaps inner current minus 5"; + "${mod}+plus" = "gaps inner current plus 5"; + "${mod}+control+alt+h" = "gaps horizontal current minus 5"; + "${mod}+control+alt+l" = "gaps horizontal current plus 5"; + "${mod}+control+alt+j" = "gaps vertical current minus 5"; + "${mod}+control+alt+k" = "gaps vertical current plus 5"; + + # TODO: this should also reset the horizontal and vertical gaps? + "${mod}+control+equal" = "gaps inner current set 0"; + + "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "control+XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +1%"; + "control+XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -1%"; + "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + "XF86MonBrightnessDown" = "exec brightnessctl set 10%-"; + "XF86MonBrightnessUp" = "exec brightnessctl set +10%"; + "shift+XF86MonBrightnessDown" = "exec brightnessctl set 1%"; + "shift+XF86MonBrightnessUp" = "exec brightnessctl set 100%"; + "control+XF86MonBrightnessDown" = "exec brightnessctl set 1%-"; + "control+XF86MonBrightnessUp" = "exec brightnessctl set +1%"; + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + "${mod}+shift+v" = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + + "${mod}+control+shift+l" = "exec swaylock"; + + "${mod}+shift+alt+f" = "for_window [class=$tilers] floating toggle"; + }; + assigns = { }; + bars = [ ]; + colors = { }; + }; + }; + gtk = { enable = true; theme = { @@ -22,51 +219,64 @@ (pkgs.buildEnv { name = "my-linux-scripts"; paths = [ ../scripts/linux ]; }) ]; - programs.firefox = { - # TODO: enable dark theme by default - enable = true; + programs = { + waybar = { + enable = true; + # settings = { }; + # style = '' + # ''; + systemd = { + enable = true; + }; + }; - package = (pkgs.firefox.override { extraNativeMessagingHosts = [ pkgs.passff-host ]; }); + firefox = { + # TODO: this should be able to work on macos, no? + # TODO: enable dark theme by default + enable = true; - # extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - # ublock-origin - # ]; # TODO: would be nice to have _all_ my firefox stuff managed here instead of Firefox Sync maybe? + package = (pkgs.firefox.override { extraNativeMessagingHosts = [ pkgs.passff-host ]; }); - profiles = { - daniel = { - id = 0; - settings = { - "general.smoothScroll" = true; + # extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + # ublock-origin + # ]; # TODO: would be nice to have _all_ my firefox stuff managed here instead of Firefox Sync maybe? + + profiles = { + daniel = { + id = 0; + settings = { + "general.smoothScroll" = true; + }; + + extraConfig = '' + user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); + // user_pref("full-screen-api.ignore-widgets", true); + user_pref("media.ffmpeg.vaapi.enabled", true); + user_pref("media.rdd-vpx.enabled", true); + ''; + + userChrome = '' + #TabsToolbar { + visibility: collapse; + } + + #webrtcIndicator { + display: none; + } + + #main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar>.toolbar-items { + opacity: 0; + pointer-events: none; + } + + #main-window:not([tabsintitlebar="true"]) #TabsToolbar { + visibility: collapse !important; + } + ''; + + # userContent = '' + # ''; }; - - extraConfig = '' - user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); - // user_pref("full-screen-api.ignore-widgets", true); - user_pref("media.ffmpeg.vaapi.enabled", true); - user_pref("media.rdd-vpx.enabled", true); - ''; - - userChrome = '' - #TabsToolbar { - visibility: collapse; - } - - #webrtcIndicator { - display: none; - } - - #main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar>.toolbar-items { - opacity: 0; - pointer-events: none; - } - - #main-window:not([tabsintitlebar="true"]) #TabsToolbar { - visibility: collapse !important; - } - ''; - - # userContent = '' - # ''; }; }; }; diff --git a/home/user.nix b/home/user.nix index 3cc437e..ee55356 100644 --- a/home/user.nix +++ b/home/user.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ config, pkgs, lib, ... }: let email = "daniel@lyte.dev"; name = "Daniel Flanagan"; @@ -14,7 +14,7 @@ in home = { username = lib.mkDefault "daniel"; homeDirectory = lib.mkDefault "/home/daniel/.home"; - stateVersion = "23.05"; + stateVersion = "23.11"; packages = [ # I use rtx for managing the following programs' versions instead of nix: @@ -406,6 +406,177 @@ in }; }; + kitty = { + enable = true; + darwinLaunchOptions = [ "--single-instance" ]; + shellIntegration = { + enableFishIntegration = true; + }; + settings = { + "font_family" = "IosevkaLyteTerm"; + "bold_font" = "IosevkaLyteTerm Heavy"; + "italic_font" = "IosevkaLyteTerm Italic"; + "bold_italic_font" = "IosevkaLyteTerm Heavy Italic"; + "font_size" = "12.5"; + "inactive_text_alpha" = "0.5"; + "copy_on_select" = true; + + "scrollback_lines" = 500000; + + "symbol_map" = "U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E6AA,U+E700-U+E7C5,U+EA60-U+EBEB,U+F000-U+F2E0,U+F300-U+F32F,U+F400-U+F4A9,U+F500-U+F8FF,U+F0001-U+F1AF0 Symbols Nerd Font Mono"; + + # use `kitty + list-fonts --psnames` to get the font's PostScript name + + "allow_remote_control" = true; + "listen_on" = "unix:/tmp/kitty"; + "repaint_delay" = 3; + "input_delay" = 3; + "sync_to_monitor" = true; + + "adjust_line_height" = 0; + "window_padding_width" = "10.0"; + "window_margin_width" = "0.0"; + + "confirm_os_window_close" = 0; + + "enabled_layouts" = "splits:split_axis=vertical,stack"; + + "shell_integration" = "disabled"; + + "enable_audio_bell" = true; + "visual_bell_duration" = "0.25"; + "visual_bell_color" = "#333033"; + + "url_style" = "single"; + + "strip_trailing_spaces" = "smart"; + + # open_url_modifiers ctrl + + "tab_bar_align" = "center"; + "tab_bar_style" = "separator"; + "tab_separator" = ''''; + "tab_bar_edge" = "top"; + "tab_title_template" = ''{fmt.fg.tab}{fmt.bg.tab} {activity_symbol}{title}''; + "active_tab_font_style" = "normal"; + + ## name: Catppuccin Kitty Mocha + ## author: Catppuccin Org + ## license: MIT + ## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf + ## blurb: Soothing pastel theme for the high-spirited! + + # The basic colors + "foreground" = "#CDD6F4"; + "background" = "#1E1E2E"; + "selection_foreground" = "#1E1E2E"; + "selection_background" = "#F5E0DC"; + + # Cursor colors + "cursor" = "#F5E0DC"; + "cursor_text_color" = "#1E1E2E"; + + # URL underline color when hovering with mouse + "url_color" = "#F5E0DC"; + + # Kitty window border colors + "active_border_color" = "#74c7ec"; + "inactive_border_color" = "#313244"; + "bell_border_color" = "#F9E2AF"; + + # OS Window titlebar colors + "wayland_titlebar_color" = "system"; + "macos_titlebar_color" = "system"; + + # Tab bar colors + "active_tab_foreground" = "#11111B"; + "active_tab_background" = "#74c7ec"; + "inactive_tab_foreground" = "#CDD6F4"; + "inactive_tab_background" = "#181825"; + "tab_bar_background" = "#11111B"; + + # Colors for marks (marked text in the terminal) + "mark1_foreground" = "#1E1E2E"; + "mark1_background" = "#B4BEFE"; + "mark2_foreground" = "#1E1E2E"; + "mark2_background" = "#74c7ec"; + "mark3_foreground" = "#1E1E2E"; + "mark3_background" = "#74C7EC"; + + # The 16 terminal colors + + # black + "color0" = "#45475A"; + "color8" = "#585B70"; + + # red + "color1" = "#F38BA8"; + "color9" = "#F38BA8"; + + # green + "color2" = "#A6E3A1"; + "color10" = "#A6E3A1"; + + # yellow + "color3" = "#F9E2AF"; + "color11" = "#F9E2AF"; + + # blue + "color4" = "#89B4FA"; + "color12" = "#89B4FA"; + + # magenta + "color5" = "#F5C2E7"; + "color13" = "#F5C2E7"; + + # cyan + "color6" = "#94E2D5"; + "color14" = "#94E2D5"; + + # white + "color7" = "#BAC2DE"; + "color15" = "#A6ADC8"; + }; + keybindings = { + "ctrl+shift+1" = "change_font_size all 12.5"; + "ctrl+shift+2" = "change_font_size all 18.5"; + "ctrl+shift+3" = "change_font_size all 26"; + "ctrl+shift+4" = "change_font_size all 32"; + "ctrl+shift+5" = "change_font_size all 48"; + "ctrl+shift+o" = "launch --type=tab --stdin-source=@screen_scrollback $EDITOR"; + + "ctrl+shift+equal" = "change_font_size all +0.5"; + "ctrl+shift+minus" = "change_font_size all -0.5"; + + "shift+insert" = "paste_from_clipboard"; + "ctrl+shift+v" = "paste_from_selection"; + "ctrl+shift+c" = "copy_to_clipboard"; + + # kill pane + "ctrl+shift+q" = "close_window"; + + # kill tab + "ctrl+alt+shift+q" = "close_tab"; + + "ctrl+shift+j" = "launch --location=hsplit --cwd=current"; + "ctrl+shift+l" = "launch --location=vsplit --cwd=current"; + + "ctrl+alt+shift+k" = "move_window up"; + "ctrl+alt+shift+h" = "move_window left"; + "ctrl+alt+shift+l" = "move_window right"; + "ctrl+alt+shift+j" = "move_window down"; + + "ctrl+h" = "neighboring_window left"; + "ctrl+l" = "neighboring_window right"; + "ctrl+k" = "neighboring_window up"; + "ctrl+j" = "neighboring_window down"; + "ctrl+shift+n" = "nth_window -1"; + "ctrl+shift+space>u" = "kitten hints --type=url --program @"; + + "ctrl+shift+z" = "toggle_layout stack"; + }; + }; + zellij = { # TODO: enable after port config enable = false; @@ -575,12 +746,12 @@ in shellAbbrs = { }; shellAliases = { l = "br"; - ls = "exa --group-directories-first --classify"; - la = "exa -la --group-directories-first --classify"; - lA = "exa -la --all --group-directories-first --classify"; - tree = "exa --tree --level=3"; - lt = "exa -l --sort=modified"; - lat = "exa -la --sort=modified"; + ls = "eza --group-directories-first --classify"; + la = "eza -la --group-directories-first --classify"; + lA = "eza -la --all --group-directories-first --classify"; + tree = "eza --tree --level=3"; + lt = "eza -l --sort=modified"; + lat = "eza -la --sort=modified"; lc = "lt --sort=accessed"; lT = "lt --reverse"; lC = "lc --reverse"; @@ -609,7 +780,7 @@ in }; }; - exa = { + eza = { enable = true; }; @@ -624,9 +795,6 @@ in }; }; - # wayland.windowManager.sway = { - # enable = true; - # }; # TODO: would be nice to have my sway config declared here instead of symlinked in by dotfiles scripts? # maybe we can share somehow so things for nix-y systems and non-nix-y systems alike # am I going to _have_ non-nix systems anymore? } diff --git a/modules/desktop-usage.nix b/modules/desktop-usage.nix index b2dad8f..8fa96aa 100644 --- a/modules/desktop-usage.nix +++ b/modules/desktop-usage.nix @@ -1,4 +1,5 @@ { ... }: { + # TODO: add a DE and include either plasma or gnome as a fallback? imports = [ ./sway.nix ./user-installed-applications.nix diff --git a/modules/sway.nix b/modules/sway.nix index ce7df16..ba753c3 100644 --- a/modules/sway.nix +++ b/modules/sway.nix @@ -77,6 +77,7 @@ in }; systemPackages = with pkgs; [ + # TODO: converge with home manager/sway stuff? brightnessctl feh gimp @@ -87,7 +88,6 @@ in libinput-gestures libnotify lutris - mako nil nixpkgs-fmt noto-fonts diff --git a/nixos.nix b/nixos.nix index 9acd2e5..9c090db 100644 --- a/nixos.nix +++ b/nixos.nix @@ -42,17 +42,18 @@ in { scheme = "unencrypted"; disks = [ "/dev/sda" ]; - } ++ [ - ./nixos/musicbox.nix - ]); + } ++ [ ./nixos/musicbox.nix ]); thinker = nixosSystem "x86_64-linux" (disko { scheme = "standard"; disks = [ "/dev/nvme0n1" ]; name = "vdb"; - } ++ [ - ./nixos/thinker.nix - ]); - # dragon = diskoNixosSystem self.diskoConfigurations.standard [ "/dev/disk/by-uuid/asdf" ] [ ./nixos/dragon.nix ]; + } ++ [ ./nixos/thinker.nix ]); + + dragon = nixosSystem "x86_64-linux" (disko + { + scheme = "standard"; + disks = [ "/dev/disk/by-uuid/asdf" ]; + } ++ [ ./nixos/dragon.nix ]); } diff --git a/nixos/common.nix b/nixos/common.nix index 48d0595..2c8883b 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -27,7 +27,7 @@ in curl dog dua - exa + eza fd file gnumake @@ -37,7 +37,6 @@ in iputils jq killall - kitty # TODO: I really just need the terminfo on servers, though, right? less mosh nmap diff --git a/nixos/musicbox.nix b/nixos/musicbox.nix index e15f343..a773e64 100644 --- a/nixos/musicbox.nix +++ b/nixos/musicbox.nix @@ -123,86 +123,6 @@ in services.dbus.enable = true; - environment.systemPackages = with pkgs; [ - age - bat - bind - bottom - brightnessctl - clang - curl - delta - dog - dtach - dua - exa - fd - feh - file - fwupd - gcc - gimp - git - git-lfs - grim - hexyl - htop - inkscape - inotify-tools - iputils - killall - kitty - krita - libinput - libinput-gestures - libnotify - lutris - gnumake - mako - mosh - nmap - nnn - nil - nixpkgs-fmt - noto-fonts - openssl - pamixer - pavucontrol - pciutils - pgcli - playerctl - podman-compose - pulseaudio - pulsemixer - rclone - restic - ripgrep - rsync - sd - slurp - sops - steam - swaybg - swayidle - swaylock - tmux - traceroute - unzip - vlc - vulkan-tools - watchexec - waybar - wget - wireplumber - wine - wl-clipboard - wofi - xh - zathura - zellij - zstd - ]; - services.pcscd.enable = true; services.flatpak.enable = true; services.gnome.gnome-keyring.enable = true; diff --git a/nixos/thinker.nix b/nixos/thinker.nix index 3f1771c..ccc68e8 100644 --- a/nixos/thinker.nix +++ b/nixos/thinker.nix @@ -37,6 +37,6 @@ }; }; - system.stateVersion = "23.05"; + system.stateVersion = "23.11"; } From 098a0263b0b3ad1912b1143e9395be28cc522c12 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sun, 1 Oct 2023 12:54:11 -0500 Subject: [PATCH 2/3] Progress! --- home/linux.nix | 470 +++++++++++++++++++++++++++++++++++++++++++++++-- home/user.nix | 77 ++++---- nixos.nix | 10 +- 3 files changed, 502 insertions(+), 55 deletions(-) diff --git a/home/linux.nix b/home/linux.nix index 5bbb979..b626474 100644 --- a/home/linux.nix +++ b/home/linux.nix @@ -9,9 +9,46 @@ mako = { enable = true; }; + + swayidle = { + enable = true; + + events = [ + { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; } + ]; + + timeouts = [ + { timeout = 330; command = "notify-send \"Idling in 300 seconds\""; resumeCommand = "notify-send \"Idling cancelled.\""; } + { timeout = 540; command = "notify-send \"Idling in 90 seconds\""; } + { timeout = 570; command = "notify-send \"Idling in 60 seconds\""; } + { timeout = 600; command = "notify-send \"Idling in 30 seconds...\""; } + { timeout = 630; command = "swaylock -f"; } + { timeout = 660; command = "swaymsg \"output * dpms off\""; resumeCommand = "swaymsg \"output * dpms on\" & maybe-good-morning &"; } + ]; + }; }; wayland.windowManager.sway = { + # TODO: + # + Super+r should rotate the selected group of windows. + # + Super+Control+{1-9} should control the size of the preselect space. + # + Super+Shift+b should balance the size of all selected nodes. + # set $tilers "(wezterm.*|kitty.*|firefox.*|slack.*|Slack.*|thunar.*|Alacritty.*|alacritty.*|Discord.*|discord.*)" + # for_window [title=".*"] floating enable + # for_window [app_id=$tilers] floating disable + # + # # for_window [title=".*"] opacity $opacity + # + # client.focused #74c7ec #74c7ec #74c7ec #74c7ec #74c7ec + # client.focused_inactive #100814 #100814 #9b9ebf #100814 #100814 + # client.unfocused #100814 #100814 #9b9ebf #100814 #100814 + # + # # TODO: I forget why I needed this - could google it I expect? + # exec /usr/lib/polkit-kde-authentication-agent-1 + # + # # prevent all windows from stealing focus + # no_focus [class=".*"] + enable = true; systemd = { @@ -40,6 +77,7 @@ window = { border = 2; + titlebar = false; }; floating = { @@ -49,8 +87,9 @@ startup = [ { command = "systemctl --user restart waybar"; always = true; } - { command = "firefox"; always = true; } - { command = "kitty --single-instance"; always = true; } + { command = "systemctl --user restart swayidle"; always = true; } + { command = "firefox"; } + { command = "kitty --single-instance"; } ]; modes = { @@ -222,12 +261,382 @@ programs = { waybar = { enable = true; - # settings = { }; - # style = '' - # ''; + settings = { + mainBar = { + "layer" = "top"; + "position" = "bottom"; + "output" = [ "eDP-1" "DP-3" ]; + "height" = 32; + "modules-left" = [ "clock" "sway/window" ]; + "modules-center" = [ "sway/workspaces" ]; + "modules-right" = [ + "mpris" + "idle_inhibitor" + "bluetooth" + # "wireplumber", + "pulseaudio" + # "network", + "cpu" + "memory" + # "temperature", + "backlight" + "battery" + "tray" + ]; + "bluetooth" = { + "format" = ""; + "format-connected" = ""; + "format-connected-battery" = ""; + # "format-device-preference" = [ "device1", "device2" ], # preference list deciding the displayed devic; + "tooltip-format" = "{controller_alias}@{controller_address} ({num_connections} connected)"; + "tooltip-format-connected" = "{controller_alias}@{controller_address} ({num_connections} connected)\n{device_enumerate}"; + "tooltip-format-enumerate-connected" = "{device_alias}@{device_address}"; + "tooltip-format-enumerate-connected-battery" = "{device_alias}@{device_address} (󰁹 {device_battery_percentage}%)"; + }; + # "wireplumber" = ; + # "format" = "{volume}% {icon}"; + # "format-muted" = ""; + # "on-click" = "helvum; + # }, + "sway/workspaces" = { + "disable-scroll" = false; + "persistent_workspaces" = { + "1" = [ ]; + "2" = [ ]; + "3" = [ ]; + "4" = [ ]; + "5" = [ ]; + "6" = [ ]; + "7" = [ ]; + "8" = [ ]; + "9" = [ ]; + # "10" = [; + }; + "all-outputs" = true; + "format" = "{name}"; + }; + "idle_inhibitor" = { + "format" = "{icon}"; + "format-icons" = { + "activated" = "󰈈"; + "deactivated" = "󰈉"; + }; + }; + "tray" = { + "icon-size" = 24; + "spacing" = 4; + }; + "clock" = { + "interval" = 1; + "format" = "{:%a %b %d %H:%M:%S}"; + }; + "cpu" = { + "format" = "{usage} "; + "tooltip" = true; + "interval" = 3; + }; + "memory" = { + "format" = "{} 󰍛"; + }; + "temperature" = { + # "thermal-zone" = 2; + # "hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input"; + "critical-threshold" = 80; + # "format-critical" = "{temperatureC}°C {icon}"; + "format" = "{temperatureC}°C {icon}"; + "format-icons" = [ "" "" "" ]; + }; + "backlight" = { + # "device" = "acpi_video1"; + "format" = "{percent}% {icon}"; + "format-icons" = [ "" "" ]; + }; + "battery" = { + "states" = { + # "good" = 95; + "warning" = 30; + "critical" = 1; + }; + "format" = "{capacity}% {icon}"; + "format-charging" = "{capacity}% 󱐋"; + "format-plugged" = "{capacity}% 󰚥"; + "format-alt" = "{time} {icon}"; + "format-good" = ""; # An empty format will hide the modul; + "format-full" = "󰁹"; + "format-icons" = [ "󰂎" "󰁻" "󰁽" "󰁿" "󰂂" ]; + }; + "network" = { + "format-wifi" = "{essid} ({signalStrength}%) "; + "format-ethernet" = "{ifname}: {ipaddr}/{cidr} "; + "format-linked" = "{ifname} (No IP) "; + "format-disconnected" = "Disconnected ⚠"; + "format-alt" = "{ifname}: {ipaddr}/{cidr}"; + }; + "mpris" = { + "format" = "{title} by {artist}"; + }; + "pulseaudio" = { + # "scroll-step" = 1, # %, can be a floa; + "format" = "{volume} {icon} {format_source}"; + #"format" = "{volume}% {icon} {format_source}"; + #"format-bluetooth" = "{volume}% {icon} {format_source}"; + #"format-bluetooth-muted" = " {icon} {format_source}"; + #"format-muted" = " {format_source}"; + "format-muted" = "󰝟 {format_source}"; + "format-source" = ""; + "format-source-muted" = ""; + "format-icons" = { + "headphones" = ""; + "handsfree" = "󱥋"; + "headset" = "󰋎"; + "phone" = ""; + "portable" = ""; + "car" = ""; + "default" = [ "" "" "" ]; + }; + # TODO: toggle mute? + "on-click" = "pavucontrol"; + }; + }; + }; + style = '' + @define-color base #1e1e2e; + @define-color mantle #181825; + @define-color crust #11111b; + + @define-color text #cdd6f4; + @define-color subtext0 #a6adc8; + @define-color subtext1 #bac2de; + + @define-color surface0 #313244; + @define-color surface1 #45475a; + @define-color surface2 #585b70; + + @define-color overlay0 #6c7086; + @define-color overlay1 #7f849c; + @define-color overlay2 #9399b2; + + @define-color blue #89b4fa; + @define-color lavender #b4befe; + @define-color sapphire #74c7ec; + @define-color sky #89dceb; + @define-color teal #94e2d5; + @define-color green #a6e3a1; + @define-color yellow #f9e2af; + @define-color peach #fab387; + @define-color maroon #eba0ac; + @define-color red #f38ba8; + @define-color mauve #cba6f7; + @define-color pink #f5c2e7; + @define-color flamingo #f2cdcd; + @define-color rosewater #f5e0dc; + + * { + border-radius: 0; + font-family: "IosevkaLyteTerm", "Symbols Nerd Font Mono", sans-serif; + font-size: 16px; + } + + window#waybar { + min-height: 32px; + background-color: @base; + color: @crust; + border-top: solid @sapphire 1px; + transition: none; + } + + window#waybar.hidden { + /* opacity: 0.2; */ + } + + window#waybar.empty { + /* opacity: 0.2; */ + } + + #workspaces button { + padding: 0 0.75em; + background-color: transparent; + border-top: solid @sapphire 1px; + } + + #workspaces button:hover { + /* + * background: rgba(0, 0, 0, 0.2); + * box-shadow: inherit; + */ + } + + #workspaces button.visible { + background-color: @base; + } + + #workspaces button.focused { + color: @base; + background-color: @sapphire; + } + + #workspaces button.persistent { + color: @surface2; + } + + #workspaces button.urgent { + color: @base; + background-color: @red; + border-top: solid @red 1px; + } + + #mode { + background-color: transparent; + } + + #clock, + #battery, + #cpu, + #memory, + #temperature, + #backlight, + #network, + #pulseaudio, + #custom-media, + #tray, + #mode, + #idle_inhibitor, + #mpris, + #window, + #mpd { + margin-top: 1px; + padding: 0 0.75em; + background-color: inherit; + color: @text; + } + + #clock {} + + #battery { + /* background-color: #ffffff; */ + /* color: #000000; */ + } + + #battery.charging { + /* color: #ffffff; */ + /* background-color: #26A65B; */ + } + + @keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } + } + + #battery.critical:not(.charging) { + background-color: @red; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #bluetooth, + #bluetooth.connected-battery, + #bluetooth.connected.battery, + #bluetooth.connected { + color: @text; + } + + label:focus { + /* background-color: #000000; */ + } + + #cpu { + /* background-color: #2ecc71; */ + /* color: #000000; */ + } + + #memory { + /* background-color: #9b59b6; */ + } + + #backlight { + /* background-color: #90b1b1; */ + } + + #network { + /* background-color: #2980b9; */ + } + + #network.disconnected { + /* background-color: #f53c3c; */ + } + + #pulseaudio { + color: @red; + /* background-color: #f1c40f; */ + /* color: #000000; */ + } + + #pulseaudio.source-muted { + /* background-color: #90b1b1; */ + color: @text; + } + + #custom-media { + /* background-color: #66cc99; */ + /* color: #2a5c45; */ + /* min-width: 100px; */ + } + + #custom-media.custom-spotify { + /* background-color: #66cc99; */ + } + + #custom-media.custom-vlc { + /* background-color: #ffa000; */ + } + + #temperature { + /* background-color: #f0932b; */ + } + + #temperature.critical { + /* background-color: #eb4d4b; */ + } + + #tray { + /* background-color: #2980b9; */ + } + + #idle_inhibitor { + /* background-color: #2d3436; */ + } + + #idle_inhibitor.activated { + /* background-color: #ecf0f1; */ + /* color: #2d3436; */ + } + + #mpd { + /* background-color: #66cc99; */ + /* color: #2a5c45; */ + } + + #mpd.disconnected { + /* background-color: #f53c3c; */ + } + + #mpd.stopped { + /* background-color: #90b1b1; */ + } + + #mpd.paused { + /* background-color: #51a37a; */ + } + ''; systemd = { enable = true; }; + }; firefox = { @@ -249,10 +658,14 @@ }; extraConfig = '' - user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); - // user_pref("full-screen-api.ignore-widgets", true); - user_pref("media.ffmpeg.vaapi.enabled", true); - user_pref("media.rdd-vpx.enabled", true); + user_pref(" + toolkit.legacyUserProfileCustomizations.stylesheets ", true); + // user_pref(" + full-screen-api.ignore-widgets ", true); + user_pref(" + media.ffmpeg.vaapi.enabled ", true); + user_pref(" + media.rdd-vpx.enabled ", true); ''; userChrome = '' @@ -264,12 +677,15 @@ display: none; } - #main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar>.toolbar-items { + #main-window[tabsintitlebar=" + true "]:not([extradragspace=" + true "]) #TabsToolbar>.toolbar-items { opacity: 0; pointer-events: none; } - #main-window:not([tabsintitlebar="true"]) #TabsToolbar { + #main-window:not([tabsintitlebar=" + true "]) #TabsToolbar { visibility: collapse !important; } ''; @@ -279,5 +695,37 @@ }; }; }; + + swaylock = { + enable = true; + settings = { + color = "ffffffff"; + image = "~/.wallpaper"; + font = "IosevkaLyteTerm"; + show-failed-attempts = true; + ignore-empty-password = true; + + indicator-radius = "150"; + indicator-thickness = "30"; + + inside-color = "11111100"; + inside-clear-color = "11111100"; + inside-ver-color = "11111100"; + inside-wrong-color = "11111100"; + + key-hl-color = "a1efe4"; + separator-color = "11111100"; + + line-color = "111111cc"; + line-uses-ring = true; + + ring-color = "111111cc"; + ring-clear-color = "f4bf75"; + ring-ver-color = "66d9ef"; + ring-wrong-color = "f92672"; + }; + }; }; } + + diff --git a/home/user.nix b/home/user.nix index ee55356..206643c 100644 --- a/home/user.nix +++ b/home/user.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, ... }: let email = "daniel@lyte.dev"; name = "Daniel Flanagan"; @@ -97,13 +97,36 @@ in key = "daniel@lyte.dev"; }; + aliases = { + a = "add -A"; + ac = "commit -a"; + b = "rev-parse - -symbolic-full-name HEAD"; + c = "commit"; + cm = "commit - m"; + cnv = "commit - -no-verify"; + co = "checkoutd"; + d = "diff"; + ds = "diff - -staged"; + dt = "difftool "; + f = "fetch"; + l = "log - -graph - -abbrev-commit - -decorate - -oneline - -all"; + plainlog = " log - -pretty=format:'%h %ad%x09%an%x09%s' --date=short --decorate"; + ls = "ls-files"; + mm = "merge master"; + p = "push"; + pf = "push --force-with-lease"; + pl = "pull"; + rim = "rebase -i master"; + s = "status"; + }; + extraConfig = { push = { autoSetupRemote = true; }; branch = { - autoSeupMerge = true; + autoSetupMerge = true; }; sendemail = { @@ -114,35 +137,11 @@ in }; url = { + # TODO: how to have per-machine not-in-git configuration? "git@git.hq.bill.com:" = { insteadOf = "https://git.hq.bill.com"; }; }; - - aliases = { - a = "add"; - A = "add - A"; - ac = "commit - a"; - b = "rev-parse - -symbolic-full-name HEAD"; - c = "commit"; - cm = "commit - m"; - cnv = "commit - -no-verify"; - co = "checkoutd"; - d = "diff"; - ds = "diff - -staged"; - dt = "difftool "; - f = "fetch"; - l = "log - -graph - -abbrev-commit - -decorate - -oneline - -all"; - plainlog = " log - -pretty=format:'%h %ad%x09%an%x09%s' --date=short --decorate"; - ls = "ls-files"; - mm = "merge master"; - p = "push"; - pf = "push --force-with-lease"; - pl = "pull"; - rim = "rebase -i master"; - s = "status"; - sur = "submodule update --remote"; - }; }; }; @@ -455,7 +454,7 @@ in "tab_bar_align" = "center"; "tab_bar_style" = "separator"; - "tab_separator" = ''''; + "tab_separator" = ""; "tab_bar_edge" = "top"; "tab_title_template" = ''{fmt.fg.tab}{fmt.bg.tab} {activity_symbol}{title}''; "active_tab_font_style" = "normal"; @@ -702,37 +701,37 @@ in interactiveShellInit = builtins.readFile ../fish/interactiveShellInit.fish; loginShellInit = ""; functions = { - # I think these should be loaded from fish files too for better editor experience + # TODO: I think these should be loaded from fish files too for better editor experience? d = '' # --wraps=cd --description "Quickly jump to NICE_HOME (or given relative or absolute path) and list files." if count $argv > /dev/null - cd $argv + cd $argv else - cd $NICE_HOME + cd $NICE_HOME end la ''; c = '' if count $argv > /dev/null - cd $NICE_HOME && d $argv + cd $NICE_HOME && d $argv else - d $NICE_HOME + d $NICE_HOME end ''; g = '' - if count $argv > /dev/null - git $argv + if test (count $argv) -gt 0 + git $argv else - git status + git status end ''; ltl = '' - set d $argv[1] . - set -l l "" - for f in $d[1]/* + set d $argv[1] . + set -l l "" + for f in $d[1]/* if test -z $l; set l $f; continue; end if command test $f -nt $l; and test ! -d $f set l $f diff --git a/nixos.nix b/nixos.nix index 9c090db..5df190b 100644 --- a/nixos.nix +++ b/nixos.nix @@ -51,9 +51,9 @@ in name = "vdb"; } ++ [ ./nixos/thinker.nix ]); - dragon = nixosSystem "x86_64-linux" (disko - { - scheme = "standard"; - disks = [ "/dev/disk/by-uuid/asdf" ]; - } ++ [ ./nixos/dragon.nix ]); + # dragon = nixosSystem "x86_64-linux" (disko + # { + # scheme = "standard"; + # disks = [ "/dev/disk/by-uuid/asdf" ]; + # } ++ [ ./nixos/dragon.nix ]); } From 3f73e16df0264a180f3cefae47e7efdd466ea41e Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sun, 1 Oct 2023 12:58:35 -0500 Subject: [PATCH 3/3] Fix git aliases --- home/user.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/home/user.nix b/home/user.nix index 206643c..0f9478d 100644 --- a/home/user.nix +++ b/home/user.nix @@ -100,17 +100,17 @@ in aliases = { a = "add -A"; ac = "commit -a"; - b = "rev-parse - -symbolic-full-name HEAD"; + b = "rev-parse --symbolic-full-name HEAD"; c = "commit"; - cm = "commit - m"; - cnv = "commit - -no-verify"; - co = "checkoutd"; + cm = "commit -m"; + cnv = "commit --no-verify"; + co = "checkout"; d = "diff"; - ds = "diff - -staged"; - dt = "difftool "; + ds = "diff --staged"; + dt = "difftool"; f = "fetch"; - l = "log - -graph - -abbrev-commit - -decorate - -oneline - -all"; - plainlog = " log - -pretty=format:'%h %ad%x09%an%x09%s' --date=short --decorate"; + l = "log --graph --abbrev-commit --decorate --oneline --all"; + plainlog = " log --pretty=format:'%h %ad%x09%an%x09%s' --date=short --decorate"; ls = "ls-files"; mm = "merge master"; p = "push";