From 2f17e369400b9c895b3554008ab3efbc76255428 Mon Sep 17 00:00:00 2001 From: Caroline Larimore Date: Thu, 25 Jul 2024 22:52:20 -0700 Subject: roles: home: migrate old home module to roles --- home/default.nix | 23 --- home/discord.nix | 41 ----- home/eww.nix | 94 ----------- home/eww/eww.css | 51 ------ home/eww/eww.yuck | 1 - home/eww/windows/music.yuck | 86 ---------- home/fastfetch.nix | 73 -------- home/fcitx5.nix | 62 ------- home/flameshot.nix | 21 --- home/git.nix | 20 --- home/gtk.nix | 17 -- home/i3.nix | 241 -------------------------- home/kitty.nix | 73 -------- home/mpv.nix | 12 -- home/picom.nix | 22 --- home/polybar.nix | 269 ------------------------------ home/rofi.nix | 49 ------ home/theme.nix | 39 ----- home/vim.nix | 37 ---- home/vscode.nix | 49 ------ hosts/c-pc/home.nix | 11 +- hosts/copenhagen/home/c.nix | 20 +-- hosts/phoenix/home.nix | 11 +- roles/home/default.nix | 8 + roles/home/desktop/default.nix | 69 ++++++++ roles/home/desktop/discord.nix | 41 +++++ roles/home/desktop/eww.nix | 94 +++++++++++ roles/home/desktop/eww/colors.css | 36 ++++ roles/home/desktop/eww/eww.css | 51 ++++++ roles/home/desktop/eww/eww.yuck | 1 + roles/home/desktop/eww/windows/music.yuck | 86 ++++++++++ roles/home/desktop/fastfetch.nix | 72 ++++++++ roles/home/desktop/fcitx5.nix | 62 +++++++ roles/home/desktop/flameshot.nix | 19 +++ roles/home/desktop/gtk.nix | 15 ++ roles/home/desktop/i3.nix | 239 ++++++++++++++++++++++++++ roles/home/desktop/kitty.nix | 71 ++++++++ roles/home/desktop/mpv.nix | 10 ++ roles/home/desktop/picom.nix | 20 +++ roles/home/desktop/polybar.nix | 268 +++++++++++++++++++++++++++++ roles/home/desktop/rofi.nix | 47 ++++++ roles/home/desktop/theme.nix | 39 +++++ roles/home/dev/default.nix | 26 +++ roles/home/dev/git.nix | 18 ++ roles/home/dev/vim.nix | 37 ++++ roles/home/dev/vscode.nix | 48 ++++++ 46 files changed, 1401 insertions(+), 1298 deletions(-) delete mode 100644 home/default.nix delete mode 100644 home/discord.nix delete mode 100644 home/eww.nix delete mode 100644 home/eww/eww.css delete mode 100644 home/eww/eww.yuck delete mode 100644 home/eww/windows/music.yuck delete mode 100644 home/fastfetch.nix delete mode 100644 home/fcitx5.nix delete mode 100644 home/flameshot.nix delete mode 100644 home/git.nix delete mode 100644 home/gtk.nix delete mode 100644 home/i3.nix delete mode 100644 home/kitty.nix delete mode 100644 home/mpv.nix delete mode 100644 home/picom.nix delete mode 100644 home/polybar.nix delete mode 100644 home/rofi.nix delete mode 100644 home/theme.nix delete mode 100644 home/vim.nix delete mode 100644 home/vscode.nix create mode 100644 roles/home/default.nix create mode 100644 roles/home/desktop/default.nix create mode 100644 roles/home/desktop/discord.nix create mode 100644 roles/home/desktop/eww.nix create mode 100644 roles/home/desktop/eww/colors.css create mode 100644 roles/home/desktop/eww/eww.css create mode 100644 roles/home/desktop/eww/eww.yuck create mode 100644 roles/home/desktop/eww/windows/music.yuck create mode 100644 roles/home/desktop/fastfetch.nix create mode 100644 roles/home/desktop/fcitx5.nix create mode 100644 roles/home/desktop/flameshot.nix create mode 100644 roles/home/desktop/gtk.nix create mode 100644 roles/home/desktop/i3.nix create mode 100644 roles/home/desktop/kitty.nix create mode 100644 roles/home/desktop/mpv.nix create mode 100644 roles/home/desktop/picom.nix create mode 100644 roles/home/desktop/polybar.nix create mode 100644 roles/home/desktop/rofi.nix create mode 100644 roles/home/desktop/theme.nix create mode 100644 roles/home/dev/default.nix create mode 100644 roles/home/dev/git.nix create mode 100644 roles/home/dev/vim.nix create mode 100644 roles/home/dev/vscode.nix diff --git a/home/default.nix b/home/default.nix deleted file mode 100644 index 6d17ac5..0000000 --- a/home/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: - -#TODO: properly migrate to a module/role -{ - imports = [ - ./discord.nix - ./eww.nix - ./fastfetch.nix - ./fcitx5.nix - ./flameshot.nix - ./git.nix - ./gtk.nix - ./i3.nix - ./kitty.nix - ./mpv.nix - ./picom.nix - ./polybar.nix - ./rofi.nix - ./theme.nix - ./vim.nix - ./vscode.nix - ]; -} diff --git a/home/discord.nix b/home/discord.nix deleted file mode 100644 index 6050e42..0000000 --- a/home/discord.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - conversion = import ../util/color-conversion.nix { inherit lib; }; -in { - home.packages = with pkgs; [ - (discord.override { - withVencord = false; - withOpenASAR = false; - }) - vesktop - ]; - - xdg.configFile."Vencord/themes/nix.theme.css".text = let c = config.theme.colors; in '' - @import url(https://mwittrien.github.io/BetterDiscordAddons/Themes/BasicBackground/BasicBackground.css); - - :root { - --transparencycolor: 0, 0, 0; - --transparencyalpha: 0.0; - --messagetransparency: 0.0; - --guildchanneltransparency: 0.15; - --chatinputtransparency: 0.0; - --memberlisttransparency: 0.15; - --settingsicons: 0; - /* A discord update messed up transparancy, and for now eyeballing it works fine */ - /* --background: rgba(0, 0, 0, 0.8); */ - --background: rgba(0, 0, 0, 0.55); - --backdrop: rgba(0, 0, 0, 0); - --version1_0_5: none; - - --accentcolor: ${conversion.hexToRGBString ", " c.accent}; - - --textbrightest: ${conversion.hexToRGBString ", " c.fg0}; - --textbrighter: ${conversion.hexToRGBString ", " c.fg1}; - --textbright: ${conversion.hexToRGBString ", " c.fg2}; - --textdark: ${conversion.hexToRGBString ", " c.fg3}; - --textdarker: ${conversion.hexToRGBString ", " c.fg4}; - --textdarkest: ${conversion.hexToRGBString ", " c.brightBlack}; - } - ''; -} diff --git a/home/eww.nix b/home/eww.nix deleted file mode 100644 index 7ed6881..0000000 --- a/home/eww.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - home.packages = with pkgs; [ - eww - - (writeShellScriptBin "eww-toggle" '' - if ${pkgs.eww}/bin/eww active-windows | grep $1; then - ${pkgs.eww}/bin/eww close $1 - else - ${pkgs.eww}/bin/eww open $@ - fi - '') - - (writeShellScriptBin "get-album-art" '' - OUTFILE=".mpris-art" - - while read -r line; do - if [[ -n $line ]]; then - rm -f ~/$OUTFILE - - cmus_path=$(${pkgs.cmus}/bin/cmus-remote -Q | grep file | cut -c 6-) - if [[ -n $cmus_path ]]; then - if [[ -f $(dirname "$cmus_path")/cover.jpg ]]; then - cp "$(dirname "$cmus_path")/cover.jpg" ~/$OUTFILE - else - ${pkgs.ffmpeg}/bin/ffmpeg -y -v quiet -i "$cmus_path" -c:v copy -f mjpeg ~/$OUTFILE - fi - else - mpris=$(${pkgs.playerctl}/bin/playerctl --player=cmus,firefox,%any metadata mpris:artUrl) - - if [[ $mpris == data:image* ]]; then - echo $mpris | sed s/.*,//g | base64 --decode > ~/$OUTFILE - elif [[ -n $mpris ]]; then - curl -s -o ~/$OUTFILE $mpris - fi - fi - - if [[ -f ~/$OUTFILE ]]; then - : - else - cp ${../assets/album_art_placeholder.png} ~/$OUTFILE - fi - - echo ~/$OUTFILE - fi - done - '') - ]; - - xdg.configFile."eww/eww.yuck".source = eww/eww.yuck; - xdg.configFile."eww/eww.css".source = eww/eww.css; - - xdg.configFile."eww/windows".source = eww/windows; - - xdg.configFile."eww/colors.css".text = let c = config.theme.colors; in '' - @define-color accent #${c.accent}; - - @define-color black #${c.black}; - @define-color red #${c.red}; - @define-color green #${c.green}; - @define-color yellow #${c.yellow}; - @define-color blue #${c.blue}; - @define-color magenta #${c.magenta}; - @define-color cyan #${c.cyan}; - @define-color white #${c.white}; - - @define-color brightBlack #${c.brightBlack}; - @define-color brightRed #${c.brightRed}; - @define-color brightGreen #${c.brightGreen}; - @define-color brightYellow #${c.brightYellow}; - @define-color brightBlue #${c.brightBlue}; - @define-color brightMagenta #${c.brightMagenta}; - @define-color brightCyan #${c.brightCyan}; - @define-color brightWhite #${c.brightWhite}; - - @define-color bg #${c.bg}; - @define-color bg0 #${c.bg0}; - @define-color bg1 #${c.bg1}; - @define-color bg2 #${c.bg2}; - @define-color bg3 #${c.bg3}; - @define-color bg4 #${c.bg4}; - - @define-color fg #${c.fg}; - @define-color fg0 #${c.fg0}; - @define-color fg1 #${c.fg1}; - @define-color fg2 #${c.fg2}; - @define-color fg3 #${c.fg3}; - @define-color fg4 #${c.fg4}; - - @define-color orange #${c.orange}; - @define-color brightOrange #${c.brightOrange}; - ''; -} diff --git a/home/eww/eww.css b/home/eww/eww.css deleted file mode 100644 index 075beb8..0000000 --- a/home/eww/eww.css +++ /dev/null @@ -1,51 +0,0 @@ -@import "colors.css"; - -window { - color: @fg; - background-color: @bg; - border: 2px solid @bg1; - font-family: monospace, sans-serif; -} - -.main { - margin: 8px; -} - -.left { - margin-top: 8px; -} - -.song-title { - font-size: 17px; - font-weight: bold; -} - -.song-album { - color: @fg2; -} - -.song-artist { - color: @fg2; -} - -.control { - font-size: 24; -} - -button { - color: @fg; - background: @bg; - - border: none; - border-radius: 0; - box-shadow: none; - text-shadow: none; -} - -button:hover { - background: @bg1; -} - -button:active { - background: @bg2; -} \ No newline at end of file diff --git a/home/eww/eww.yuck b/home/eww/eww.yuck deleted file mode 100644 index 37d2efc..0000000 --- a/home/eww/eww.yuck +++ /dev/null @@ -1 +0,0 @@ -(include "./windows/music.yuck") \ No newline at end of file diff --git a/home/eww/windows/music.yuck b/home/eww/windows/music.yuck deleted file mode 100644 index 91ee05f..0000000 --- a/home/eww/windows/music.yuck +++ /dev/null @@ -1,86 +0,0 @@ -(defwindow music [pos gaps] - :monitor "" - :geometry (geometry - :x { - pos == "right" - ? gaps == "true" - ? "-8px" : "2px" - : "0px" - } - :y { gaps == "true" ? "-8px" : "2px" } - :height {128 + 16} - :anchor { pos == "right" ? "bottom right" : "bottom center" } - ) - :stacking "fg" - :windowtype "dock" - :wm-ignore true - - (box :class "main" - :orientation "h" - :spacing 8 - :space-evenly false - :height {128 + 16} - - (image - :path song-cover - :image-width 128 - :image-height 128 - ) - - (box :class "left" - :orientation "v" - :spacing 0 - :space-evenly true - :hexpand true - - (box :class "info" - :orientation "v" - :space-evenly false - :valign "center" - - (label :class "song-title" - :text {song.title} - :halign "start" - ) - (label :class "song-album" - :text {song.album} - :halign "start" - ) - (label :class "song-artist" - :text {song.artist} - :halign "start" - ) - ) - - (box :class "control" - :space-evenly false - :halign "center" - :valign "end" - - (button - :onclick `playerctl --player=cmus,firefox,%any previous` - "󰒮" - ) - (button - :onclick `playerctl --player=cmus,firefox,%any play-pause` - { song.status == "Playing" ? "󰏤" : "󰐊" } - ) - (button - :onclick `playerctl --player=cmus,firefox,%any next` - "󰒭" - ) - - ; Offset controls to center of screen - (box :width {128 + 8}) - ) - ) - ) -) - -(deflisten song-cover - `playerctl --player=cmus,firefox,%any -F metadata title | get-album-art` -) - -(deflisten song - `playerctl --player=cmus,firefox,%any -F metadata --format='{"title": "{{title}}", "album": "{{album}}", "artist": "{{artist}}", "status": "{{status}}"}'` -) \ No newline at end of file diff --git a/home/fastfetch.nix b/home/fastfetch.nix deleted file mode 100644 index 08c6606..0000000 --- a/home/fastfetch.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ lib, pkgs, ... }: - -{ - programs.fastfetch = { - enable = true; - package = (pkgs.fastfetch.overrideAttrs (finalAttrs: previousAttrs: { - cmakeFlags = [(lib.cmakeBool "ENABLE_IMAGEMAGICK6" true)]; - })); - - settings = { - logo = { - type = "kitty-direct"; - source = "$(ls ${../assets/fastfetch}/*.png | shuf -n 1)"; - - width = 36; - height = 32; - - padding = { - left = 4; - right = 4; - }; - }; - - display = { - separator = ""; - }; - - modules = [ - { type = "custom"; format = " ハードウェア "; } - { type = "custom"; format = "┌──────────────────────────────────────────────────┐"; } - - { type = "cpu"; key = " CPU "; } - { type = "gpu"; key = " GPU "; format = "{2} [{6}]"; } - { type = "memory"; key = " MEM "; } - "break" - { - type = "disk"; - folders = "/nix:/persist"; - key = " 󰋊 "; - } - - { type = "custom"; format = "└──────────────────────────────────────────────────┘"; } - "break" - - { type = "custom"; format = " ソフトウェア "; } - { type = "custom"; format = "┌──────────────────────────────────────────────────┐"; } - - { type = "title"; key = " 󰁥 "; format = "{1}@{2}"; } - "break" - { type = "os"; key = "  "; } - { type = "kernel"; key = " 󰌽 "; format = "{1} {2}"; } - { type = "packages"; key = " 󰆧 "; } - "break" - { type = "terminal"; key = "  "; } - { type = "shell"; key = " 󱆃 "; } -# { type = "font"; key = " 󰬈 "; } - { type = "font"; key = " 󰬈 "; format = "Caskaydia Mono (8pt)"; } - "break" - { type = "wm"; key = "  "; } -# { type = "theme"; key = " 󰏘 "; } - { type = "theme"; key = " 󰏘 "; format = "gruvbox"; } - "break" - { type = "media"; key = " 󰝚 "; } - { type = "datetime"; key = " 󰃰 "; } - - { type = "custom"; format = "└──────────────────────────────────────────────────┘"; } - "break" - - "colors" - ]; - }; - }; -} diff --git a/home/fcitx5.nix b/home/fcitx5.nix deleted file mode 100644 index 943bf46..0000000 --- a/home/fcitx5.nix +++ /dev/null @@ -1,62 +0,0 @@ -# This file only handles theming of fcitx5. -{ pkgs, config, ... }: - -{ - xdg.dataFile."fcitx5/themes/nix-theme/theme.conf".source = let c = config.theme.colors; in (pkgs.formats.ini { }).generate "what" { - "Metadata" = { - Name = "nix-theme"; - Author = "CartConnoisseur"; - Description = "Theme generated by nixos"; - Version = 1; - }; - - "InputPanel" = { - NormalColor = "#${c.fg}"; - HighlightColor = "#${c.fg}"; - HighlightBackgroundColor = "#00000000"; - HighlightCandidateColor = "#${c.bg}"; - - FullWidthHighlight = true; - PageButtonAlignment = "Last Candidate"; - }; - - "InputPanel/Background" = { - Color = "#${c.bg}"; - BorderColor = "#${c.fg1}"; - BorderWidth = 2; - }; - - # "InputPanel/Background/Margin" = { - # Left = 10; - # Right = 10; - # Top = 10; - # Bottom = 10; - # }; - - "InputPanel/Highlight" = { - Color = "#${c.fg}"; - BorderWidth = 0; - }; - - "InputPanel/Highlight/Margin" = { - Left = 2; - Right = 2; - Top = 2; - Bottom = 2; - }; - - "InputPanel/ContentMargin" = { - Left = 2; - Right = 2; - Top = 2; - Bottom = 2; - }; - - "InputPanel/TextMargin" = { - Left = 5; - Right = 5; - Top = 5; - Bottom = 5; - }; - }; -} diff --git a/home/flameshot.nix b/home/flameshot.nix deleted file mode 100644 index d238cec..0000000 --- a/home/flameshot.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, ... }: - -{ - services.flameshot = { - enable = true; - - settings = let c = config.theme.colors; in { - General = { - savePath = "Pictures/Screenshots"; - filenamePattern = "%F_%T"; - - saveAfterCopy = true; - - uiColor = "#${c.bg}"; - contrastUiColor = "#${c.accent}"; - - startupLaunch = false; - }; - }; - }; -} diff --git a/home/git.nix b/home/git.nix deleted file mode 100644 index 1d496f0..0000000 --- a/home/git.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ ... }: - -{ - programs.git = { - enable = true; - - userName = "Caroline Larimore"; - userEmail = "caroline@larimo.re"; - - signing = { - key = "314C14641E707B68"; - signByDefault = true; - }; - - ignores = [ - "*~" - "*.swp" - ]; - }; -} diff --git a/home/gtk.nix b/home/gtk.nix deleted file mode 100644 index c702a8f..0000000 --- a/home/gtk.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, ... }: - -{ - gtk = { - enable = true; - - theme = { - package = pkgs.gruvbox-gtk-theme; - name = "Gruvbox-Dark"; - }; - - font = { - name = "monospace"; - size = 8; - }; - }; -} diff --git a/home/i3.nix b/home/i3.nix deleted file mode 100644 index 8541cc4..0000000 --- a/home/i3.nix +++ /dev/null @@ -1,241 +0,0 @@ -{ config, pkgs, ... }: - -{ - xsession.windowManager.i3 = { - enable = true; - - config = let - #NOTE: Alt (Mod1) and meta (Mod4) have been swapped by keyd. - mod = "Mod4"; - - ws0 = "0:Main"; - ws1 = "1:Terminal"; - ws2 = "2:Browser"; - ws3 = "3:Chat"; - ws4 = "4:Steam"; - ws5 = "5"; - ws6 = "6"; - ws7 = "7"; - ws8 = "8:qBittorrent"; - ws9 = "9:Youtube"; - ws10 = "10:Misc"; - ws11 = "11:Empty"; - - output = { - primary = "primary"; - left = "DVI-D-0"; - right = "DisplayPort-1 HDMI-A-0"; - }; - in { - modifier = "${mod}"; - - fonts = { - names = [ "monospace" ]; - size = 8.0; - }; - - colors = let c = config.theme.colors; in { - focused = { - border = "#${c.fg2}"; - background = "#${c.fg2}"; - text = "#${c.bg}"; - indicator = "#${c.fg2}"; - childBorder = "#${c.fg2}"; - }; - - focusedInactive = { - border = "#${c.bg1}"; - background = "#${c.bg1}"; - text = "#${c.fg}"; - indicator = "#${c.bg1}"; - childBorder = "#${c.bg1}"; - }; - - unfocused = { - border = "#${c.bg}"; - background = "#${c.bg}"; - text = "#${c.fg}"; - indicator = "#${c.bg}"; - childBorder = "#${c.bg}"; - }; - }; - - gaps.inner = 8; - - workspaceOutputAssign = [ - { workspace = "${ws0}"; output = output.primary; } - { workspace = "${ws1}"; output = output.primary; } - - { workspace = "${ws2}"; output = output.left; } - { workspace = "${ws3}"; output = output.left; } - - { workspace = "${ws4}"; output = output.primary; } - - { workspace = "${ws5}"; output = output.primary; } - { workspace = "${ws6}"; output = output.primary; } - { workspace = "${ws7}"; output = output.primary; } - - { workspace = "${ws8}"; output = output.primary; } - { workspace = "${ws9}"; output = output.right; } - { workspace = "${ws10}"; output = output.primary; } - - { workspace = "${ws11}"; output = output.primary; } - ]; - - assigns = { - "${ws2}" = [ { class = "firefox"; } ]; - "${ws3}" = [ { class = "discord"; } ]; - "${ws4}" = [ - { class = "steam"; } - { class = "prismlauncher"; } - ]; - - "${ws8}" = [ { class = "qbittorrent"; } ]; - "${ws9}" = [ { title = "cmus"; } ]; - }; - - startup = [ - { command = "polybar-msg cmd quit"; always = true; notification = false; } - { command = "polybar"; always = true; notification = false; } - { command = "systemctl --user restart picom"; always = true; notification = false; } - { command = "${pkgs.feh}/bin/feh --bg-fill ${../assets/bg/${config.theme.background}}"; always = true; notification = false; } - { command = "${pkgs.fcitx5}/bin/fcitx5 -r -d"; always = true; notification = false; } - - { command = "${pkgs.premid}/bin/premid --no-sandbox"; always = false; notification = false; } - ]; - - keybindings = { - "${mod}+Shift+c" = "reload"; - "${mod}+Shift+r" = "restart"; - "${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'\""; - - "${mod}+q" = "kill"; - "${mod}+d" = "exec \"rofi -modi drun,run -show drun\""; - "${mod}+Return" = "exec kitty"; - - "${mod}+Num_Lock" = "exec --no-startup-id polybar-msg cmd toggle"; - - # Screenshots - #TODO: screen and full should be swapped, but currently screen is fucky :'( - "Shift+Print" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot screen -c"; - "Print" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot full -c"; - "${mod}+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot gui -c"; - "Mod1+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot gui -c"; - "${mod}+Ctrl+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot launcher -c"; - - # Media keys - "XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +2%"; - "XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -2%"; - "XF86AudioMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioMicMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - - "XF86AudioPlay" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any play-pause\""; - "XF86AudioPause" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any play-pause\""; - "XF86AudioStop" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any stop\""; - "XF86AudioNext" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any next\""; - "XF86AudioPrev" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any previous\""; - - # Media controller widget - "${mod}+m" = "exec --no-startup-id eww-toggle music --arg pos=center --arg gaps=false"; - "${mod}+Ctrl+m" = "exec --no-startup-id eww-toggle music --arg pos=right --arg gaps=true"; - "${mod}+Shift+m" = "exec --no-startup-id eww-toggle music --arg pos=center --arg gaps=true"; - "${mod}+Shift+Ctrl+m" = "exec --no-startup-id eww-toggle music --arg pos=right --arg gaps=false"; - - # Workspaces - "${mod}+grave" = "workspace number ${ws0}"; - "${mod}+1" = "workspace number ${ws1}"; - "${mod}+2" = "workspace number ${ws2}"; - "${mod}+3" = "workspace number ${ws3}"; - "${mod}+4" = "workspace number ${ws4}"; - "${mod}+5" = "workspace number ${ws5}"; - "${mod}+6" = "workspace number ${ws6}"; - "${mod}+7" = "workspace number ${ws7}"; - "${mod}+8" = "workspace number ${ws8}"; - "${mod}+9" = "workspace number ${ws9}"; - "${mod}+0" = "workspace number ${ws10}"; - "${mod}+equal" = "workspace number ${ws11}"; - - # Move active workspace - "${mod}+comma" = "move workspace to output ${output.left}"; - "${mod}+period" = "move workspace to output ${output.primary}"; - "${mod}+slash" = "move workspace to output ${output.right}"; - - # Layout - "${mod}+z" = "layout stacking"; - "${mod}+x" = "layout tabbed"; - "${mod}+c" = "layout toggle split"; - - # Focus - "${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}+space" = "focus mode_toggle"; - "${mod}+a" = "focus parent"; - - # Move focused container - "${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"; - - # Misc container binds - "${mod}+Shift+space" = "floating toggle"; - "${mod}+f" = "fullscreen toggle"; - - "${mod}+w" = "split h"; - "${mod}+e" = "split v"; - - "${mod}+r" = "mode resize"; - - # Move focused container to workspace - "${mod}+Shift+grave" = "move container to workspace number ${ws0}"; - "${mod}+Shift+1" = "move container to workspace number ${ws1}"; - "${mod}+Shift+2" = "move container to workspace number ${ws2}"; - "${mod}+Shift+3" = "move container to workspace number ${ws3}"; - "${mod}+Shift+4" = "move container to workspace number ${ws4}"; - "${mod}+Shift+5" = "move container to workspace number ${ws5}"; - "${mod}+Shift+6" = "move container to workspace number ${ws6}"; - "${mod}+Shift+7" = "move container to workspace number ${ws7}"; - "${mod}+Shift+8" = "move container to workspace number ${ws8}"; - "${mod}+Shift+9" = "move container to workspace number ${ws9}"; - "${mod}+Shift+0" = "move container to workspace number ${ws10}"; - }; - - 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"; - "${mod}+r" = "mode default"; - }; - }; - - bars = []; - }; - - extraConfig = '' - default_border normal 0 - ''; - }; -} diff --git a/home/kitty.nix b/home/kitty.nix deleted file mode 100644 index 503f04a..0000000 --- a/home/kitty.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ config, ... }: - -{ - programs.kitty = { - enable = true; - - font = { name = "monospace"; size = 8.0; }; - - settings = let c = config.theme.colors; in { - foreground = "#${c.fg}"; - background = "#000000"; - - color0 = "#${c.black}"; - color1 = "#${c.red}"; - color2 = "#${c.green}"; - color3 = "#${c.yellow}"; - color4 = "#${c.blue}"; - color5 = "#${c.magenta}"; - color6 = "#${c.cyan}"; - color7 = "#${c.white}"; - - color8 = "#${c.brightBlack}"; - color9 = "#${c.brightRed}"; - color10 = "#${c.brightGreen}"; - color11 = "#${c.brightYellow}"; - color12 = "#${c.brightBlue}"; - color13 = "#${c.brightMagenta}"; - color14 = "#${c.brightCyan}"; - color15 = "#${c.brightWhite}"; - - - color124 = "#${c.brightRed}"; - color106 = "#${c.brightGreen}"; - color172 = "#${c.brightYellow}"; - color66 = "#${c.brightBlue}"; - color132 = "#${c.brightMagenta}"; - color72 = "#${c.brightCyan}"; - - color167 = "#${c.red}"; - color142 = "#${c.green}"; - color214 = "#${c.yellow}"; - color109 = "#${c.blue}"; - color175 = "#${c.magenta}"; - color108 = "#${c.cyan}"; - - color234 = "#${c.bg0}"; - color237 = "#${c.bg1}"; - color239 = "#${c.bg2}"; - color241 = "#${c.bg3}"; - color243 = "#${c.bg4}"; - color245 = "#${c.white}"; - - color246 = "#${c.fg4}"; - color248 = "#${c.fg3}"; - color250 = "#${c.fg2}"; - color223 = "#${c.fg1}"; - color229 = "#${c.fg0}"; - - color166 = "#${c.orange}"; - color208 = "#${c.brightOrange}"; - }; - - shellIntegration = { - mode = "no-cursor"; - enableBashIntegration = true; - }; - - extraConfig = '' - background_opacity 0.8 - confirm_os_window_close 0 - ''; - }; -} diff --git a/home/mpv.nix b/home/mpv.nix deleted file mode 100644 index 5e1f013..0000000 --- a/home/mpv.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: - -{ - programs.mpv = { - enable = true; - - config = { - screenshot-format = "png"; - screenshot-template = "~/Pictures/Screenshots/mpv/%F/%P"; - }; - }; -} diff --git a/home/picom.nix b/home/picom.nix deleted file mode 100644 index 59f6939..0000000 --- a/home/picom.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: - -{ - services.picom = { - enable = true; - - backend = "glx"; - vSync = true; - - settings = { - blur = { - method = "gaussian"; - size = 10; - deviation = 2; - }; - - blur-background-exclude = [ - "window_type = 'dock'" - ]; - }; - }; -} diff --git a/home/polybar.nix b/home/polybar.nix deleted file mode 100644 index f415196..0000000 --- a/home/polybar.nix +++ /dev/null @@ -1,269 +0,0 @@ -{ pkgs, config, ... }: - -{ - services.polybar = { - enable = true; - script = "polybar"; - - package = pkgs.polybar.override { - i3Support = true; - pulseSupport = true; - }; - - settings = let c = config.theme.colors; in { - "bar/main" = { - width = "100%"; - height = "24pt"; - radius = 0; - - background = "#${c.bg}"; - foreground = "#${c.fg}"; - - font = [ - "Symbols Nerd Font:size=16;2" - "monospace:size=11;2" - "Sauce Code Pro Nerd Font:size=11;2" - "Noto Sans CJK JP:size=11;1" - "sans-serif:size=11;1" - ]; - - border = { - top = "8px"; - left = "8px"; - right = "8px"; - - color = "#00000000"; - }; - - padding = { - left = 2; - right = 2; - }; - - cursor = { - click = "pointer"; - scroll = "ns-resize"; - }; - - enable-ipc = true; - - line.size = "3pt"; - - separator = { - text = "|"; - foreground = "#${c.bg3}"; - }; - - module.margin = 1; - modules = { - left = "stat music"; - center = "i3"; - right = "wlan eth filesystem keyboard xkeyboard pulseaudio date"; - }; - }; - - "module/keyboard" = { - type = "custom/script"; - - exec = "if [[ $(fcitx5-remote -n) == 'mozc' ]]; then printf 'jp'; else printf 'en'; fi"; - interval = 1; - - click.left = "${pkgs.fcitx5}/bin/fcitx5-remote -t"; - - format = { - prefix = { - text = "󰌌 "; - foreground = "#${c.accent}"; - }; - }; - }; - - "module/music" = { - type = "custom/script"; - - exec = "playerctl --player=cmus,firefox,%any -F metadata --format='{{title}} - {{artist}}'"; - tail = true; - - format = { - prefix = { - text = "󰎄 "; - foreground = "#${c.accent}"; - }; - }; - }; - - "module/stat" = { - type = "custom/script"; - - exec = "vmstat -n 2 | awk '{printf \"%.0f%% %.2f GiB\\\\n\", 100-$15, (31998756-($4+$5+$6))/1024/1024};fflush()'"; - tail = true; - - format = { - prefix = { - text = "󱕍 "; - foreground = "#${c.accent}"; - }; - }; - }; - - "module/i3" = { - type = "internal/i3"; - - strip-wsnumbers = true; - index-sort = true; - - ws.icon = [ - "0:Main;󱄅" "1:Terminal;" "2:Browser;󰈹" "3:Chat;󰙯" "4:Steam;󰓓" - "5;󰎱" "6;󰎳" "7;󰎶" - "8:qBittorrent;󰄛" "9:Youtube;󰗃" "10:Misc;󰁴" - ]; - - label = { - focused = { - text = "%icon%"; - padding = 2; - - foreground = "#${c.fg0}"; - background = "#${c.bg1}"; - underline = "#${c.accent}"; - }; - - visible = { - text = "%icon%"; - padding = 2; - - underline = "#${c.fg4}"; - }; - - unfocused = { - text = "%icon%"; - padding = 2; - }; - - urgent = { - text = "%icon%"; - padding = 2; - - foreground = "#${c.bg}"; - background = "#${c.accent}"; - }; - }; - }; - - "module/xwindow" = { - type = "internal/xwindow"; - label = "%title:0:64:...%"; - }; - - - "module/pulseaudio" = { - type = "internal/pulseaudio"; - - format.volume = " "; - - label = { - volume = "%percentage%%"; - muted = { - text = "󰝟 %percentage%%"; - foreground = "#${c.bg3}"; - }; - }; - - ramp.volume = { - text = [ "󰕿" "󰖀" "󰕾" ]; - foreground = "#${c.accent}"; - }; - }; - - "module/xkeyboard" = { - type = "internal/xkeyboard"; - blacklist = [ "num lock" ]; - - indicator.icon = [ "caps lock;;󰌎" ]; - - format = { - text = ""; - }; - - label = { - indicator.on = "%icon%"; - }; - }; - - "module/cpu" = { - type = "internal/cpu"; - interval = 2; - - format.prefix = { - text = "CPU "; - foreground = "#${c.accent}"; - }; - - label = "%percentage%%"; - }; - - "module/memory" = { - type = "internal/memory"; - interval = 2; - - format.prefix = { - text = "MEM "; - foreground = "#${c.accent}"; - }; - - label = "%gb_used%"; - }; - - "module/filesystem" = { - type = "internal/fs"; - interval = 25; - - mount = [ "/nix" "/persist" ]; - - label = { - mounted = "%{F#${c.accent}}󰋊%{F-} %used%"; - unmounted = { - text = "%mountpoint%"; - foreground = "#${c.bg3}"; - }; - }; - }; - - "module/eth" = { - type = "internal/network"; - interface.type = "wired"; - interval = 2; - - format.connected = ""; - label.connected = "%{F#${c.accent}}󰈀%{F-} 󰄼 %downspeed% 󰄿 %upspeed%"; - }; - - "module/wlan" = { - type = "internal/network"; - interface.type = "wireless"; - interval = 2; - - format.connected = " "; - label.connected = "󰄼 %downspeed% 󰄿 %upspeed%"; - - ramp-signal = { - text = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; - foreground = "#${c.accent}"; - }; - }; - - "module/date" = { - type = "internal/date"; - interval = 1; - - date = "%H:%M"; - date-alt = "%Y-%m-%d %H:%M:%S"; - - format.prefix = { - text = "󰃰 "; - foreground = "#${c.accent}"; - }; - }; - }; - }; -} diff --git a/home/rofi.nix b/home/rofi.nix deleted file mode 100644 index d0ff642..0000000 --- a/home/rofi.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ config, ... }: - -{ - programs.rofi = { - enable = true; - - font = "monospace 12"; - - theme = let - inherit (config.lib.formats.rasi) mkLiteral; - c = config.theme.colors; - in { - "@import" = "default"; - - "*" = { - background = mkLiteral "#${c.bg}"; - foreground = mkLiteral "#${c.fg}"; - foreground-alt = mkLiteral "#${c.bg3}"; - - alternate-normal-background = mkLiteral "var(background)"; - - selected-normal-foreground = mkLiteral "var(background)"; - selected-normal-background = mkLiteral "#${c.accent}"; - - border-color = mkLiteral "var(background)"; - separatorcolor = mkLiteral "#${c.bg3}"; - }; - - inputbar = { - children = map mkLiteral [ "entry" "num-filtered-rows" "textbox-num-sep" "num-rows" ]; - }; - - element = { - children = map mkLiteral [ "element-icon" "element-text" ]; - }; - - entry.placeholder = ""; - - scrollbar.handle-color = mkLiteral "var(foreground-alt)"; - num-rows.text-color = mkLiteral "var(foreground-alt)"; - num-filtered-rows.text-color = mkLiteral "var(foreground-alt)"; - textbox-num-sep.text-color = mkLiteral "var(foreground-alt)"; - - message.border = mkLiteral "1px solid 0px 0px"; - listview.border = mkLiteral "1px solid 0px 0px"; - sidebar.border = mkLiteral "1px solid 0px 0px"; - }; - }; -} diff --git a/home/theme.nix b/home/theme.nix deleted file mode 100644 index 056c8ac..0000000 --- a/home/theme.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ lib, ... }: - -with lib; - -{ - options.theme = { - background = mkOption { - type = types.str; - example = "mem.png"; - description = '' - Background image. Path starts in ~/Pictures/bg/ - ''; - }; - - colors = let - mkColorOption = name: { - inherit name; - value = mkOption { - type = types.strMatching "[a-fA-F0-9]{6}"; - default = "ff00ff"; - example = "23ce94"; - description = '' - Hex value for color "${name}". - ''; - }; - }; - in listToAttrs (map mkColorOption [ - "accent" - - "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" - "brightBlack" "brightRed" "brightGreen" "brightYellow" "brightBlue" "brightMagenta" "brightCyan" "brightWhite" - - "bg" "bg0" "bg1" "bg2" "bg3" "bg4" - "fg" "fg0" "fg1" "fg2" "fg3" "fg4" - - "orange" "brightOrange" - ]); - }; -} diff --git a/home/vim.nix b/home/vim.nix deleted file mode 100644 index 75e712f..0000000 --- a/home/vim.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ pkgs, ... }: - -# Honestly, I'm pretty disappointed with -# home-manager's `programs.vim`. It's kinda bad and -# won't let me run `highlight` after `colorscheme` - -{ - home.file.".vim/vimrc".text = '' - set number - set relativenumber - - set termguicolors - set background=dark - colorscheme gruvbox - - syntax on - - highlight Normal guibg=#000000 - - " Awesome magical color override from - " https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f - augroup MyColors - autocmd! - autocmd ColorScheme * highlight Normal guibg=#000000 - augroup END - ''; - - home.file.".vim/pack/default/start/gruvbox".source = builtins.fetchGit { - url = "https://github.com/morhetz/gruvbox.git"; - rev = "f1ecde848f0cdba877acb0c740320568252cc482"; - }; - - home.file.".vim/pack/all/start/vim-nix".source = builtins.fetchGit { - url = "https://github.com/LnL7/vim-nix.git"; - rev = "e25cd0f2e5922f1f4d3cd969f92e35a9a327ffb0"; - }; -} diff --git a/home/vscode.nix b/home/vscode.nix deleted file mode 100644 index 21c0c94..0000000 --- a/home/vscode.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ pkgs, ... }: - -{ - programs.vscode = { - enable = true; - package = pkgs.vscodium; - - extensions = with pkgs.vscode-extensions; [ - jdinhlife.gruvbox - vscode-icons-team.vscode-icons - - jnoortheen.nix-ide - golang.go - ziglang.vscode-zig - ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - { - name = "shader"; - publisher = "slevesque"; - version = "1.1.5"; - sha256 = "3dfdfb15e40c365bfbe1fecb333f7e08ab1c17a5234d9ed9a5c69914ab57d993"; - } - ]; - - userSettings = { - "workbench.colorTheme" = "Gruvbox Dark Medium"; - "workbench.iconTheme" = "vscode-icons"; - "window.titleBarStyle" = "custom"; - - "git.confirmSync" = false; - - "vsicons.dontShowNewVersionMessage" = true; - - "files.associations" = { - "*.vsh" = "glsl"; - "*.fsh" = "glsl"; - "*.gsh" = "glsl"; - }; - - # Zig - "zig.initialSetupDone" = true; - "zig.path" = ""; - "zig.formattingProvider" = "off"; - - "zig.zls.path" = ""; - "zig.zls.enableAutofix" = false; - "zig.zls.enableInlayHints" = false; - }; - }; -} diff --git a/hosts/c-pc/home.nix b/hosts/c-pc/home.nix index 6e87975..3cba16d 100644 --- a/hosts/c-pc/home.nix +++ b/hosts/c-pc/home.nix @@ -4,7 +4,7 @@ imports = [ inputs.impermanence.nixosModules.home-manager.impermanence - ../../home + ../../roles/home ]; # theme.nix is an untracked symlink to a theme under ./themes/ @@ -78,6 +78,15 @@ ]; }; + home.roles = { + dev = { + enable = true; + key = "314C14641E707B68"; + }; + + desktop.enable = true; + }; + programs = { feh.enable = true; btop.enable = true; diff --git a/hosts/copenhagen/home/c.nix b/hosts/copenhagen/home/c.nix index 0d1d5e9..b374712 100644 --- a/hosts/copenhagen/home/c.nix +++ b/hosts/copenhagen/home/c.nix @@ -16,24 +16,12 @@ ]; }; - programs = { - git = { + home.roles = { + dev = { enable = true; - - userName = "Caroline Larimore"; - userEmail = "caroline@larimo.re"; - - signing = { - key = "DE64538967CA0C68"; - signByDefault = true; - }; - - ignores = [ - "*~" - "*.swp" - ]; + key = "DE64538967CA0C68"; }; - }; + } home.packages = with pkgs; [ cloc diff --git a/hosts/phoenix/home.nix b/hosts/phoenix/home.nix index f4911d8..663b8e5 100644 --- a/hosts/phoenix/home.nix +++ b/hosts/phoenix/home.nix @@ -4,7 +4,7 @@ imports = [ inputs.impermanence.nixosModules.home-manager.impermanence - ../../home + ../../roles/home ]; theme = import ../../theme.nix; @@ -60,6 +60,15 @@ ]; }; + home.roles = { + dev = { + enable = true; + key = ""; #TODO: create signing key for phoenix + }; + + desktop.enable = true; + }; + programs = { feh.enable = true; btop.enable = true; diff --git a/roles/home/default.nix b/roles/home/default.nix new file mode 100644 index 0000000..295b1a4 --- /dev/null +++ b/roles/home/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + ./desktop + ./dev + ]; +} diff --git a/roles/home/desktop/default.nix b/roles/home/desktop/default.nix new file mode 100644 index 0000000..83192da --- /dev/null +++ b/roles/home/desktop/default.nix @@ -0,0 +1,69 @@ +{ config, pkgs, lib, inputs, ... }: +with lib; + +let cfg = config.home.roles.desktop; in { + imports = [ + ./theme.nix + + ./i3.nix + ./picom.nix + ./polybar.nix + ./rofi.nix + ./kitty.nix + + ./gtk.nix + ./fcitx5.nix + + ./discord.nix + ./eww.nix + ./mpv.nix + ./flameshot.nix + ./fastfetch.nix + ]; + + options.home.roles.desktop = { + enable = mkEnableOption "desktop home role"; + + discord = mkOption { + type = types.bool; + default = true; + }; + eww = mkOption { + type = types.bool; + default = true; + }; + mpv = mkOption { + type = types.bool; + default = true; + }; + screenshot = mkOption { + type = types.bool; + default = true; + }; + fetch = mkOption { + type = types.bool; + default = true; + }; + }; + + config = mkIf cfg.enable { + xsession.windowManager.i3.enable = true; + + gtk.enable = true; + + programs = { + rofi.enable = true; + kitty.enable = true; + + mpv.enable = cfg.mpv; + fastfetch.enable = cfg.fetch; + }; + + services = { + picom.enable = true; + polybar.enable = true; + + flameshot.enable = cfg.screenshot; + }; + }; +} diff --git a/roles/home/desktop/discord.nix b/roles/home/desktop/discord.nix new file mode 100644 index 0000000..d7c0254 --- /dev/null +++ b/roles/home/desktop/discord.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +let + conversion = import ../../../util/color-conversion.nix { inherit lib; }; +in lib.mkIf config.home.roles.desktop.discord { + home.packages = with pkgs; [ + (discord.override { + withVencord = false; + withOpenASAR = false; + }) + vesktop + ]; + + xdg.configFile."Vencord/themes/nix.theme.css".text = let c = config.theme.colors; in '' + @import url(https://mwittrien.github.io/BetterDiscordAddons/Themes/BasicBackground/BasicBackground.css); + + :root { + --transparencycolor: 0, 0, 0; + --transparencyalpha: 0.0; + --messagetransparency: 0.0; + --guildchanneltransparency: 0.15; + --chatinputtransparency: 0.0; + --memberlisttransparency: 0.15; + --settingsicons: 0; + /* A discord update messed up transparancy, and for now eyeballing it works fine */ + /* --background: rgba(0, 0, 0, 0.8); */ + --background: rgba(0, 0, 0, 0.55); + --backdrop: rgba(0, 0, 0, 0); + --version1_0_5: none; + + --accentcolor: ${conversion.hexToRGBString ", " c.accent}; + + --textbrightest: ${conversion.hexToRGBString ", " c.fg0}; + --textbrighter: ${conversion.hexToRGBString ", " c.fg1}; + --textbright: ${conversion.hexToRGBString ", " c.fg2}; + --textdark: ${conversion.hexToRGBString ", " c.fg3}; + --textdarker: ${conversion.hexToRGBString ", " c.fg4}; + --textdarkest: ${conversion.hexToRGBString ", " c.brightBlack}; + } + ''; +} diff --git a/roles/home/desktop/eww.nix b/roles/home/desktop/eww.nix new file mode 100644 index 0000000..4bfdf63 --- /dev/null +++ b/roles/home/desktop/eww.nix @@ -0,0 +1,94 @@ +{ config, lib, pkgs, ... }: + +lib.mkIf config.home.roles.desktop.eww { + home.packages = with pkgs; [ + eww + + (writeShellScriptBin "eww-toggle" '' + if ${pkgs.eww}/bin/eww active-windows | grep $1; then + ${pkgs.eww}/bin/eww close $1 + else + ${pkgs.eww}/bin/eww open $@ + fi + '') + + (writeShellScriptBin "get-album-art" '' + OUTFILE=".mpris-art" + + while read -r line; do + if [[ -n $line ]]; then + rm -f ~/$OUTFILE + + cmus_path=$(${pkgs.cmus}/bin/cmus-remote -Q | grep file | cut -c 6-) + if [[ -n $cmus_path ]]; then + if [[ -f $(dirname "$cmus_path")/cover.jpg ]]; then + cp "$(dirname "$cmus_path")/cover.jpg" ~/$OUTFILE + else + ${pkgs.ffmpeg}/bin/ffmpeg -y -v quiet -i "$cmus_path" -c:v copy -f mjpeg ~/$OUTFILE + fi + else + mpris=$(${pkgs.playerctl}/bin/playerctl --player=cmus,firefox,%any metadata mpris:artUrl) + + if [[ $mpris == data:image* ]]; then + echo $mpris | sed s/.*,//g | base64 --decode > ~/$OUTFILE + elif [[ -n $mpris ]]; then + curl -s -o ~/$OUTFILE $mpris + fi + fi + + if [[ -f ~/$OUTFILE ]]; then + : + else + cp ${../../../assets/album_art_placeholder.png} ~/$OUTFILE + fi + + echo ~/$OUTFILE + fi + done + '') + ]; + + xdg.configFile."eww/eww.yuck".source = eww/eww.yuck; + xdg.configFile."eww/eww.css".source = eww/eww.css; + + xdg.configFile."eww/windows".source = eww/windows; + + xdg.configFile."eww/colors.css".text = let c = config.theme.colors; in '' + @define-color accent #${c.accent}; + + @define-color black #${c.black}; + @define-color red #${c.red}; + @define-color green #${c.green}; + @define-color yellow #${c.yellow}; + @define-color blue #${c.blue}; + @define-color magenta #${c.magenta}; + @define-color cyan #${c.cyan}; + @define-color white #${c.white}; + + @define-color brightBlack #${c.brightBlack}; + @define-color brightRed #${c.brightRed}; + @define-color brightGreen #${c.brightGreen}; + @define-color brightYellow #${c.brightYellow}; + @define-color brightBlue #${c.brightBlue}; + @define-color brightMagenta #${c.brightMagenta}; + @define-color brightCyan #${c.brightCyan}; + @define-color brightWhite #${c.brightWhite}; + + @define-color bg #${c.bg}; + @define-color bg0 #${c.bg0}; + @define-color bg1 #${c.bg1}; + @define-color bg2 #${c.bg2}; + @define-color bg3 #${c.bg3}; + @define-color bg4 #${c.bg4}; + + @define-color fg #${c.fg}; + @define-color fg0 #${c.fg0}; + @define-color fg1 #${c.fg1}; + @define-color fg2 #${c.fg2}; + @define-color fg3 #${c.fg3}; + @define-color fg4 #${c.fg4}; + + @define-color orange #${c.orange}; + @define-color brightOrange #${c.brightOrange}; + ''; +} diff --git a/roles/home/desktop/eww/colors.css b/roles/home/desktop/eww/colors.css new file mode 100644 index 0000000..69a3e5e --- /dev/null +++ b/roles/home/desktop/eww/colors.css @@ -0,0 +1,36 @@ +@define-color accent #cc241d; + +@define-color black #282828; +@define-color red #cc241d; +@define-color green #98971a; +@define-color yellow #d79921; +@define-color blue #458588; +@define-color magenta #b16286; +@define-color cyan #689d6a; +@define-color white #a89984; + +@define-color brightBlack #928374; +@define-color brightRed #fb4934; +@define-color brightGreen #b8bb26; +@define-color brightYellow #fabd2f; +@define-color brightBlue #83a598; +@define-color brightMagenta #d3869b; +@define-color brightCyan #8ec07c; +@define-color brightWhite #ebdbb2; + +@define-color bg #282828; +@define-color bg0 #282828; +@define-color bg1 #3c3836; +@define-color bg2 #504945; +@define-color bg3 #665c54; +@define-color bg4 #7c6f64; + +@define-color fg #ebdbb2; +@define-color fg0 #fbf1c7; +@define-color fg1 #ebdbb2; +@define-color fg2 #d5c4a1; +@define-color fg3 #bdae93; +@define-color fg4 #a89984; + +@define-color orange #d65d0e; +@define-color brightOrange #fe8019; diff --git a/roles/home/desktop/eww/eww.css b/roles/home/desktop/eww/eww.css new file mode 100644 index 0000000..075beb8 --- /dev/null +++ b/roles/home/desktop/eww/eww.css @@ -0,0 +1,51 @@ +@import "colors.css"; + +window { + color: @fg; + background-color: @bg; + border: 2px solid @bg1; + font-family: monospace, sans-serif; +} + +.main { + margin: 8px; +} + +.left { + margin-top: 8px; +} + +.song-title { + font-size: 17px; + font-weight: bold; +} + +.song-album { + color: @fg2; +} + +.song-artist { + color: @fg2; +} + +.control { + font-size: 24; +} + +button { + color: @fg; + background: @bg; + + border: none; + border-radius: 0; + box-shadow: none; + text-shadow: none; +} + +button:hover { + background: @bg1; +} + +button:active { + background: @bg2; +} \ No newline at end of file diff --git a/roles/home/desktop/eww/eww.yuck b/roles/home/desktop/eww/eww.yuck new file mode 100644 index 0000000..37d2efc --- /dev/null +++ b/roles/home/desktop/eww/eww.yuck @@ -0,0 +1 @@ +(include "./windows/music.yuck") \ No newline at end of file diff --git a/roles/home/desktop/eww/windows/music.yuck b/roles/home/desktop/eww/windows/music.yuck new file mode 100644 index 0000000..91ee05f --- /dev/null +++ b/roles/home/desktop/eww/windows/music.yuck @@ -0,0 +1,86 @@ +(defwindow music [pos gaps] + :monitor "" + :geometry (geometry + :x { + pos == "right" + ? gaps == "true" + ? "-8px" : "2px" + : "0px" + } + :y { gaps == "true" ? "-8px" : "2px" } + :height {128 + 16} + :anchor { pos == "right" ? "bottom right" : "bottom center" } + ) + :stacking "fg" + :windowtype "dock" + :wm-ignore true + + (box :class "main" + :orientation "h" + :spacing 8 + :space-evenly false + :height {128 + 16} + + (image + :path song-cover + :image-width 128 + :image-height 128 + ) + + (box :class "left" + :orientation "v" + :spacing 0 + :space-evenly true + :hexpand true + + (box :class "info" + :orientation "v" + :space-evenly false + :valign "center" + + (label :class "song-title" + :text {song.title} + :halign "start" + ) + (label :class "song-album" + :text {song.album} + :halign "start" + ) + (label :class "song-artist" + :text {song.artist} + :halign "start" + ) + ) + + (box :class "control" + :space-evenly false + :halign "center" + :valign "end" + + (button + :onclick `playerctl --player=cmus,firefox,%any previous` + "󰒮" + ) + (button + :onclick `playerctl --player=cmus,firefox,%any play-pause` + { song.status == "Playing" ? "󰏤" : "󰐊" } + ) + (button + :onclick `playerctl --player=cmus,firefox,%any next` + "󰒭" + ) + + ; Offset controls to center of screen + (box :width {128 + 8}) + ) + ) + ) +) + +(deflisten song-cover + `playerctl --player=cmus,firefox,%any -F metadata title | get-album-art` +) + +(deflisten song + `playerctl --player=cmus,firefox,%any -F metadata --format='{"title": "{{title}}", "album": "{{album}}", "artist": "{{artist}}", "status": "{{status}}"}'` +) \ No newline at end of file diff --git a/roles/home/desktop/fastfetch.nix b/roles/home/desktop/fastfetch.nix new file mode 100644 index 0000000..dd8b082 --- /dev/null +++ b/roles/home/desktop/fastfetch.nix @@ -0,0 +1,72 @@ +{ lib, pkgs, ... }: + +{ + programs.fastfetch = { + package = (pkgs.fastfetch.overrideAttrs (finalAttrs: previousAttrs: { + cmakeFlags = [(lib.cmakeBool "ENABLE_IMAGEMAGICK6" true)]; + })); + + settings = { + logo = { + type = "kitty-direct"; + source = "$(ls ${../../../assets/fastfetch}/*.png | shuf -n 1)"; + + width = 36; + height = 32; + + padding = { + left = 4; + right = 4; + }; + }; + + display = { + separator = ""; + }; + + modules = [ + { type = "custom"; format = " ハードウェア "; } + { type = "custom"; format = "┌──────────────────────────────────────────────────┐"; } + + { type = "cpu"; key = " CPU "; } + { type = "gpu"; key = " GPU "; format = "{2} [{6}]"; } + { type = "memory"; key = " MEM "; } + "break" + { + type = "disk"; + folders = "/nix:/persist"; + key = " 󰋊 "; + } + + { type = "custom"; format = "└──────────────────────────────────────────────────┘"; } + "break" + + { type = "custom"; format = " ソフトウェア "; } + { type = "custom"; format = "┌──────────────────────────────────────────────────┐"; } + + { type = "title"; key = " 󰁥 "; format = "{1}@{2}"; } + "break" + { type = "os"; key = "  "; } + { type = "kernel"; key = " 󰌽 "; format = "{1} {2}"; } + { type = "packages"; key = " 󰆧 "; } + "break" + { type = "terminal"; key = "  "; } + { type = "shell"; key = " 󱆃 "; } +# { type = "font"; key = " 󰬈 "; } + { type = "font"; key = " 󰬈 "; format = "Caskaydia Mono (8pt)"; } + "break" + { type = "wm"; key = "  "; } +# { type = "theme"; key = " 󰏘 "; } + { type = "theme"; key = " 󰏘 "; format = "gruvbox"; } + "break" + { type = "media"; key = " 󰝚 "; } + { type = "datetime"; key = " 󰃰 "; } + + { type = "custom"; format = "└──────────────────────────────────────────────────┘"; } + "break" + + "colors" + ]; + }; + }; +} diff --git a/roles/home/desktop/fcitx5.nix b/roles/home/desktop/fcitx5.nix new file mode 100644 index 0000000..e68312d --- /dev/null +++ b/roles/home/desktop/fcitx5.nix @@ -0,0 +1,62 @@ +# This file only handles theming of fcitx5. +{ lib, pkgs, config, ... }: + +lib.mkIf config.home.roles.desktop.enable { + xdg.dataFile."fcitx5/themes/nix-theme/theme.conf".source = let c = config.theme.colors; in (pkgs.formats.ini { }).generate "what" { + "Metadata" = { + Name = "nix-theme"; + Author = "CartConnoisseur"; + Description = "Theme generated by nixos"; + Version = 1; + }; + + "InputPanel" = { + NormalColor = "#${c.fg}"; + HighlightColor = "#${c.fg}"; + HighlightBackgroundColor = "#00000000"; + HighlightCandidateColor = "#${c.bg}"; + + FullWidthHighlight = true; + PageButtonAlignment = "Last Candidate"; + }; + + "InputPanel/Background" = { + Color = "#${c.bg}"; + BorderColor = "#${c.fg1}"; + BorderWidth = 2; + }; + + # "InputPanel/Background/Margin" = { + # Left = 10; + # Right = 10; + # Top = 10; + # Bottom = 10; + # }; + + "InputPanel/Highlight" = { + Color = "#${c.fg}"; + BorderWidth = 0; + }; + + "InputPanel/Highlight/Margin" = { + Left = 2; + Right = 2; + Top = 2; + Bottom = 2; + }; + + "InputPanel/ContentMargin" = { + Left = 2; + Right = 2; + Top = 2; + Bottom = 2; + }; + + "InputPanel/TextMargin" = { + Left = 5; + Right = 5; + Top = 5; + Bottom = 5; + }; + }; +} diff --git a/roles/home/desktop/flameshot.nix b/roles/home/desktop/flameshot.nix new file mode 100644 index 0000000..d7f6e1f --- /dev/null +++ b/roles/home/desktop/flameshot.nix @@ -0,0 +1,19 @@ +{ config, ... }: + +{ + services.flameshot = { + settings = let c = config.theme.colors; in { + General = { + savePath = "Pictures/Screenshots"; + filenamePattern = "%F_%T"; + + saveAfterCopy = true; + + uiColor = "#${c.bg}"; + contrastUiColor = "#${c.accent}"; + + startupLaunch = false; + }; + }; + }; +} diff --git a/roles/home/desktop/gtk.nix b/roles/home/desktop/gtk.nix new file mode 100644 index 0000000..33745d5 --- /dev/null +++ b/roles/home/desktop/gtk.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +{ + gtk = { + theme = { + package = pkgs.gruvbox-gtk-theme; + name = "Gruvbox-Dark"; + }; + + font = { + name = "monospace"; + size = 8; + }; + }; +} diff --git a/roles/home/desktop/i3.nix b/roles/home/desktop/i3.nix new file mode 100644 index 0000000..8302a0c --- /dev/null +++ b/roles/home/desktop/i3.nix @@ -0,0 +1,239 @@ +{ config, pkgs, ... }: + +{ + xsession.windowManager.i3 = { + config = let + #NOTE: Alt (Mod1) and meta (Mod4) have been swapped by keyd. + mod = "Mod4"; + + ws0 = "0:Main"; + ws1 = "1:Terminal"; + ws2 = "2:Browser"; + ws3 = "3:Chat"; + ws4 = "4:Steam"; + ws5 = "5"; + ws6 = "6"; + ws7 = "7"; + ws8 = "8:qBittorrent"; + ws9 = "9:Youtube"; + ws10 = "10:Misc"; + ws11 = "11:Empty"; + + output = { + primary = "primary"; + left = "DVI-D-0"; + right = "DisplayPort-1 HDMI-A-0"; + }; + in { + modifier = "${mod}"; + + fonts = { + names = [ "monospace" ]; + size = 8.0; + }; + + colors = let c = config.theme.colors; in { + focused = { + border = "#${c.fg2}"; + background = "#${c.fg2}"; + text = "#${c.bg}"; + indicator = "#${c.fg2}"; + childBorder = "#${c.fg2}"; + }; + + focusedInactive = { + border = "#${c.bg1}"; + background = "#${c.bg1}"; + text = "#${c.fg}"; + indicator = "#${c.bg1}"; + childBorder = "#${c.bg1}"; + }; + + unfocused = { + border = "#${c.bg}"; + background = "#${c.bg}"; + text = "#${c.fg}"; + indicator = "#${c.bg}"; + childBorder = "#${c.bg}"; + }; + }; + + gaps.inner = 8; + + workspaceOutputAssign = [ + { workspace = "${ws0}"; output = output.primary; } + { workspace = "${ws1}"; output = output.primary; } + + { workspace = "${ws2}"; output = output.left; } + { workspace = "${ws3}"; output = output.left; } + + { workspace = "${ws4}"; output = output.primary; } + + { workspace = "${ws5}"; output = output.primary; } + { workspace = "${ws6}"; output = output.primary; } + { workspace = "${ws7}"; output = output.primary; } + + { workspace = "${ws8}"; output = output.primary; } + { workspace = "${ws9}"; output = output.right; } + { workspace = "${ws10}"; output = output.primary; } + + { workspace = "${ws11}"; output = output.primary; } + ]; + + assigns = { + "${ws2}" = [ { class = "firefox"; } ]; + "${ws3}" = [ { class = "discord"; } ]; + "${ws4}" = [ + { class = "steam"; } + { class = "prismlauncher"; } + ]; + + "${ws8}" = [ { class = "qbittorrent"; } ]; + "${ws9}" = [ { title = "cmus"; } ]; + }; + + startup = [ + { command = "polybar-msg cmd quit"; always = true; notification = false; } + { command = "polybar"; always = true; notification = false; } + { command = "systemctl --user restart picom"; always = true; notification = false; } + { command = "${pkgs.feh}/bin/feh --bg-fill ${../../../assets/bg/${config.theme.background}}"; always = true; notification = false; } + { command = "${pkgs.fcitx5}/bin/fcitx5 -r -d"; always = true; notification = false; } + + { command = "${pkgs.premid}/bin/premid --no-sandbox"; always = false; notification = false; } + ]; + + keybindings = { + "${mod}+Shift+c" = "reload"; + "${mod}+Shift+r" = "restart"; + "${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'\""; + + "${mod}+q" = "kill"; + "${mod}+d" = "exec \"rofi -modi drun,run -show drun\""; + "${mod}+Return" = "exec kitty"; + + "${mod}+Num_Lock" = "exec --no-startup-id polybar-msg cmd toggle"; + + # Screenshots + #TODO: screen and full should be swapped, but currently screen is fucky :'( + "Shift+Print" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot screen -c"; + "Print" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot full -c"; + "${mod}+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot gui -c"; + "Mod1+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot gui -c"; + "${mod}+Ctrl+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot launcher -c"; + + # Media keys + "XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +2%"; + "XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -2%"; + "XF86AudioMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + + "XF86AudioPlay" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any play-pause\""; + "XF86AudioPause" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any play-pause\""; + "XF86AudioStop" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any stop\""; + "XF86AudioNext" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any next\""; + "XF86AudioPrev" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any previous\""; + + # Media controller widget + "${mod}+m" = "exec --no-startup-id eww-toggle music --arg pos=center --arg gaps=false"; + "${mod}+Ctrl+m" = "exec --no-startup-id eww-toggle music --arg pos=right --arg gaps=true"; + "${mod}+Shift+m" = "exec --no-startup-id eww-toggle music --arg pos=center --arg gaps=true"; + "${mod}+Shift+Ctrl+m" = "exec --no-startup-id eww-toggle music --arg pos=right --arg gaps=false"; + + # Workspaces + "${mod}+grave" = "workspace number ${ws0}"; + "${mod}+1" = "workspace number ${ws1}"; + "${mod}+2" = "workspace number ${ws2}"; + "${mod}+3" = "workspace number ${ws3}"; + "${mod}+4" = "workspace number ${ws4}"; + "${mod}+5" = "workspace number ${ws5}"; + "${mod}+6" = "workspace number ${ws6}"; + "${mod}+7" = "workspace number ${ws7}"; + "${mod}+8" = "workspace number ${ws8}"; + "${mod}+9" = "workspace number ${ws9}"; + "${mod}+0" = "workspace number ${ws10}"; + "${mod}+equal" = "workspace number ${ws11}"; + + # Move active workspace + "${mod}+comma" = "move workspace to output ${output.left}"; + "${mod}+period" = "move workspace to output ${output.primary}"; + "${mod}+slash" = "move workspace to output ${output.right}"; + + # Layout + "${mod}+z" = "layout stacking"; + "${mod}+x" = "layout tabbed"; + "${mod}+c" = "layout toggle split"; + + # Focus + "${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}+space" = "focus mode_toggle"; + "${mod}+a" = "focus parent"; + + # Move focused container + "${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"; + + # Misc container binds + "${mod}+Shift+space" = "floating toggle"; + "${mod}+f" = "fullscreen toggle"; + + "${mod}+w" = "split h"; + "${mod}+e" = "split v"; + + "${mod}+r" = "mode resize"; + + # Move focused container to workspace + "${mod}+Shift+grave" = "move container to workspace number ${ws0}"; + "${mod}+Shift+1" = "move container to workspace number ${ws1}"; + "${mod}+Shift+2" = "move container to workspace number ${ws2}"; + "${mod}+Shift+3" = "move container to workspace number ${ws3}"; + "${mod}+Shift+4" = "move container to workspace number ${ws4}"; + "${mod}+Shift+5" = "move container to workspace number ${ws5}"; + "${mod}+Shift+6" = "move container to workspace number ${ws6}"; + "${mod}+Shift+7" = "move container to workspace number ${ws7}"; + "${mod}+Shift+8" = "move container to workspace number ${ws8}"; + "${mod}+Shift+9" = "move container to workspace number ${ws9}"; + "${mod}+Shift+0" = "move container to workspace number ${ws10}"; + }; + + 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"; + "${mod}+r" = "mode default"; + }; + }; + + bars = []; + }; + + extraConfig = '' + default_border normal 0 + ''; + }; +} diff --git a/roles/home/desktop/kitty.nix b/roles/home/desktop/kitty.nix new file mode 100644 index 0000000..cd373ab --- /dev/null +++ b/roles/home/desktop/kitty.nix @@ -0,0 +1,71 @@ +{ config, ... }: + +{ + programs.kitty = { + font = { name = "monospace"; size = 8.0; }; + + settings = let c = config.theme.colors; in { + foreground = "#${c.fg}"; + background = "#000000"; + + color0 = "#${c.black}"; + color1 = "#${c.red}"; + color2 = "#${c.green}"; + color3 = "#${c.yellow}"; + color4 = "#${c.blue}"; + color5 = "#${c.magenta}"; + color6 = "#${c.cyan}"; + color7 = "#${c.white}"; + + color8 = "#${c.brightBlack}"; + color9 = "#${c.brightRed}"; + color10 = "#${c.brightGreen}"; + color11 = "#${c.brightYellow}"; + color12 = "#${c.brightBlue}"; + color13 = "#${c.brightMagenta}"; + color14 = "#${c.brightCyan}"; + color15 = "#${c.brightWhite}"; + + + color124 = "#${c.brightRed}"; + color106 = "#${c.brightGreen}"; + color172 = "#${c.brightYellow}"; + color66 = "#${c.brightBlue}"; + color132 = "#${c.brightMagenta}"; + color72 = "#${c.brightCyan}"; + + color167 = "#${c.red}"; + color142 = "#${c.green}"; + color214 = "#${c.yellow}"; + color109 = "#${c.blue}"; + color175 = "#${c.magenta}"; + color108 = "#${c.cyan}"; + + color234 = "#${c.bg0}"; + color237 = "#${c.bg1}"; + color239 = "#${c.bg2}"; + color241 = "#${c.bg3}"; + color243 = "#${c.bg4}"; + color245 = "#${c.white}"; + + color246 = "#${c.fg4}"; + color248 = "#${c.fg3}"; + color250 = "#${c.fg2}"; + color223 = "#${c.fg1}"; + color229 = "#${c.fg0}"; + + color166 = "#${c.orange}"; + color208 = "#${c.brightOrange}"; + }; + + shellIntegration = { + mode = "no-cursor"; + enableBashIntegration = true; + }; + + extraConfig = '' + background_opacity 0.8 + confirm_os_window_close 0 + ''; + }; +} diff --git a/roles/home/desktop/mpv.nix b/roles/home/desktop/mpv.nix new file mode 100644 index 0000000..73a9687 --- /dev/null +++ b/roles/home/desktop/mpv.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + programs.mpv = { + config = { + screenshot-format = "png"; + screenshot-template = "~/Pictures/Screenshots/mpv/%F/%P"; + }; + }; +} diff --git a/roles/home/desktop/picom.nix b/roles/home/desktop/picom.nix new file mode 100644 index 0000000..cc72333 --- /dev/null +++ b/roles/home/desktop/picom.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + services.picom = { + backend = "glx"; + vSync = true; + + settings = { + blur = { + method = "gaussian"; + size = 10; + deviation = 2; + }; + + blur-background-exclude = [ + "window_type = 'dock'" + ]; + }; + }; +} diff --git a/roles/home/desktop/polybar.nix b/roles/home/desktop/polybar.nix new file mode 100644 index 0000000..82d9ee1 --- /dev/null +++ b/roles/home/desktop/polybar.nix @@ -0,0 +1,268 @@ +{ pkgs, config, ... }: + +{ + services.polybar = { + script = "polybar"; + + package = pkgs.polybar.override { + i3Support = true; + pulseSupport = true; + }; + + settings = let c = config.theme.colors; in { + "bar/main" = { + width = "100%"; + height = "24pt"; + radius = 0; + + background = "#${c.bg}"; + foreground = "#${c.fg}"; + + font = [ + "Symbols Nerd Font:size=16;2" + "monospace:size=11;2" + "Sauce Code Pro Nerd Font:size=11;2" + "Noto Sans CJK JP:size=11;1" + "sans-serif:size=11;1" + ]; + + border = { + top = "8px"; + left = "8px"; + right = "8px"; + + color = "#00000000"; + }; + + padding = { + left = 2; + right = 2; + }; + + cursor = { + click = "pointer"; + scroll = "ns-resize"; + }; + + enable-ipc = true; + + line.size = "3pt"; + + separator = { + text = "|"; + foreground = "#${c.bg3}"; + }; + + module.margin = 1; + modules = { + left = "stat music"; + center = "i3"; + right = "wlan eth filesystem keyboard xkeyboard pulseaudio date"; + }; + }; + + "module/keyboard" = { + type = "custom/script"; + + exec = "if [[ $(fcitx5-remote -n) == 'mozc' ]]; then printf 'jp'; else printf 'en'; fi"; + interval = 1; + + click.left = "${pkgs.fcitx5}/bin/fcitx5-remote -t"; + + format = { + prefix = { + text = "󰌌 "; + foreground = "#${c.accent}"; + }; + }; + }; + + "module/music" = { + type = "custom/script"; + + exec = "playerctl --player=cmus,firefox,%any -F metadata --format='{{title}} - {{artist}}'"; + tail = true; + + format = { + prefix = { + text = "󰎄 "; + foreground = "#${c.accent}"; + }; + }; + }; + + "module/stat" = { + type = "custom/script"; + + exec = "vmstat -n 2 | awk '{printf \"%.0f%% %.2f GiB\\\\n\", 100-$15, (31998756-($4+$5+$6))/1024/1024};fflush()'"; + tail = true; + + format = { + prefix = { + text = "󱕍 "; + foreground = "#${c.accent}"; + }; + }; + }; + + "module/i3" = { + type = "internal/i3"; + + strip-wsnumbers = true; + index-sort = true; + + ws.icon = [ + "0:Main;󱄅" "1:Terminal;" "2:Browser;󰈹" "3:Chat;󰙯" "4:Steam;󰓓" + "5;󰎱" "6;󰎳" "7;󰎶" + "8:qBittorrent;󰄛" "9:Youtube;󰗃" "10:Misc;󰁴" + ]; + + label = { + focused = { + text = "%icon%"; + padding = 2; + + foreground = "#${c.fg0}"; + background = "#${c.bg1}"; + underline = "#${c.accent}"; + }; + + visible = { + text = "%icon%"; + padding = 2; + + underline = "#${c.fg4}"; + }; + + unfocused = { + text = "%icon%"; + padding = 2; + }; + + urgent = { + text = "%icon%"; + padding = 2; + + foreground = "#${c.bg}"; + background = "#${c.accent}"; + }; + }; + }; + + "module/xwindow" = { + type = "internal/xwindow"; + label = "%title:0:64:...%"; + }; + + + "module/pulseaudio" = { + type = "internal/pulseaudio"; + + format.volume = " "; + + label = { + volume = "%percentage%%"; + muted = { + text = "󰝟 %percentage%%"; + foreground = "#${c.bg3}"; + }; + }; + + ramp.volume = { + text = [ "󰕿" "󰖀" "󰕾" ]; + foreground = "#${c.accent}"; + }; + }; + + "module/xkeyboard" = { + type = "internal/xkeyboard"; + blacklist = [ "num lock" ]; + + indicator.icon = [ "caps lock;;󰌎" ]; + + format = { + text = ""; + }; + + label = { + indicator.on = "%icon%"; + }; + }; + + "module/cpu" = { + type = "internal/cpu"; + interval = 2; + + format.prefix = { + text = "CPU "; + foreground = "#${c.accent}"; + }; + + label = "%percentage%%"; + }; + + "module/memory" = { + type = "internal/memory"; + interval = 2; + + format.prefix = { + text = "MEM "; + foreground = "#${c.accent}"; + }; + + label = "%gb_used%"; + }; + + "module/filesystem" = { + type = "internal/fs"; + interval = 25; + + mount = [ "/nix" "/persist" ]; + + label = { + mounted = "%{F#${c.accent}}󰋊%{F-} %used%"; + unmounted = { + text = "%mountpoint%"; + foreground = "#${c.bg3}"; + }; + }; + }; + + "module/eth" = { + type = "internal/network"; + interface.type = "wired"; + interval = 2; + + format.connected = ""; + label.connected = "%{F#${c.accent}}󰈀%{F-} 󰄼 %downspeed% 󰄿 %upspeed%"; + }; + + "module/wlan" = { + type = "internal/network"; + interface.type = "wireless"; + interval = 2; + + format.connected = " "; + label.connected = "󰄼 %downspeed% 󰄿 %upspeed%"; + + ramp-signal = { + text = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; + foreground = "#${c.accent}"; + }; + }; + + "module/date" = { + type = "internal/date"; + interval = 1; + + date = "%H:%M"; + date-alt = "%Y-%m-%d %H:%M:%S"; + + format.prefix = { + text = "󰃰 "; + foreground = "#${c.accent}"; + }; + }; + }; + }; +} diff --git a/roles/home/desktop/rofi.nix b/roles/home/desktop/rofi.nix new file mode 100644 index 0000000..dff60e7 --- /dev/null +++ b/roles/home/desktop/rofi.nix @@ -0,0 +1,47 @@ +{ config, ... }: + +{ + programs.rofi = { + font = "monospace 12"; + + theme = let + inherit (config.lib.formats.rasi) mkLiteral; + c = config.theme.colors; + in { + "@import" = "default"; + + "*" = { + background = mkLiteral "#${c.bg}"; + foreground = mkLiteral "#${c.fg}"; + foreground-alt = mkLiteral "#${c.bg3}"; + + alternate-normal-background = mkLiteral "var(background)"; + + selected-normal-foreground = mkLiteral "var(background)"; + selected-normal-background = mkLiteral "#${c.accent}"; + + border-color = mkLiteral "var(background)"; + separatorcolor = mkLiteral "#${c.bg3}"; + }; + + inputbar = { + children = map mkLiteral [ "entry" "num-filtered-rows" "textbox-num-sep" "num-rows" ]; + }; + + element = { + children = map mkLiteral [ "element-icon" "element-text" ]; + }; + + entry.placeholder = ""; + + scrollbar.handle-color = mkLiteral "var(foreground-alt)"; + num-rows.text-color = mkLiteral "var(foreground-alt)"; + num-filtered-rows.text-color = mkLiteral "var(foreground-alt)"; + textbox-num-sep.text-color = mkLiteral "var(foreground-alt)"; + + message.border = mkLiteral "1px solid 0px 0px"; + listview.border = mkLiteral "1px solid 0px 0px"; + sidebar.border = mkLiteral "1px solid 0px 0px"; + }; + }; +} diff --git a/roles/home/desktop/theme.nix b/roles/home/desktop/theme.nix new file mode 100644 index 0000000..056c8ac --- /dev/null +++ b/roles/home/desktop/theme.nix @@ -0,0 +1,39 @@ +{ lib, ... }: + +with lib; + +{ + options.theme = { + background = mkOption { + type = types.str; + example = "mem.png"; + description = '' + Background image. Path starts in ~/Pictures/bg/ + ''; + }; + + colors = let + mkColorOption = name: { + inherit name; + value = mkOption { + type = types.strMatching "[a-fA-F0-9]{6}"; + default = "ff00ff"; + example = "23ce94"; + description = '' + Hex value for color "${name}". + ''; + }; + }; + in listToAttrs (map mkColorOption [ + "accent" + + "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" + "brightBlack" "brightRed" "brightGreen" "brightYellow" "brightBlue" "brightMagenta" "brightCyan" "brightWhite" + + "bg" "bg0" "bg1" "bg2" "bg3" "bg4" + "fg" "fg0" "fg1" "fg2" "fg3" "fg4" + + "orange" "brightOrange" + ]); + }; +} diff --git a/roles/home/dev/default.nix b/roles/home/dev/default.nix new file mode 100644 index 0000000..b092246 --- /dev/null +++ b/roles/home/dev/default.nix @@ -0,0 +1,26 @@ +{ config, pkgs, lib, inputs, ... }: +with lib; + +let cfg = config.home.roles.dev; in { + imports = [ + ./git.nix + ./vim.nix + ./vscode.nix + ]; + + options.home.roles.dev = { + enable = mkEnableOption "dev home role"; + + key = mkOption { + type = types.str; + description = "git signing key"; + }; + }; + + config = mkIf cfg.enable { + programs = { + git.enable = true; + vscode.enable = config.home.roles.desktop.enable; + }; + }; +} diff --git a/roles/home/dev/git.nix b/roles/home/dev/git.nix new file mode 100644 index 0000000..be67fdb --- /dev/null +++ b/roles/home/dev/git.nix @@ -0,0 +1,18 @@ +{ config, ... }: + +{ + programs.git = { + userName = "Caroline Larimore"; + userEmail = "caroline@larimo.re"; + + signing = { + key = config.home.roles.dev.key; + signByDefault = true; + }; + + ignores = [ + "*~" + "*.swp" + ]; + }; +} diff --git a/roles/home/dev/vim.nix b/roles/home/dev/vim.nix new file mode 100644 index 0000000..2cb295b --- /dev/null +++ b/roles/home/dev/vim.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +# Honestly, I'm pretty disappointed with +# home-manager's `programs.vim`. It's kinda bad and +# won't let me run `highlight` after `colorscheme` + +lib.mkIf config.home.roles.dev.enable { + home.file.".vim/vimrc".text = '' + set number + set relativenumber + + set termguicolors + set background=dark + colorscheme gruvbox + + syntax on + + highlight Normal guibg=#000000 + + " Awesome magical color override from + " https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f + augroup MyColors + autocmd! + autocmd ColorScheme * highlight Normal guibg=#000000 + augroup END + ''; + + home.file.".vim/pack/default/start/gruvbox".source = builtins.fetchGit { + url = "https://github.com/morhetz/gruvbox.git"; + rev = "f1ecde848f0cdba877acb0c740320568252cc482"; + }; + + home.file.".vim/pack/all/start/vim-nix".source = builtins.fetchGit { + url = "https://github.com/LnL7/vim-nix.git"; + rev = "e25cd0f2e5922f1f4d3cd969f92e35a9a327ffb0"; + }; +} diff --git a/roles/home/dev/vscode.nix b/roles/home/dev/vscode.nix new file mode 100644 index 0000000..160ad14 --- /dev/null +++ b/roles/home/dev/vscode.nix @@ -0,0 +1,48 @@ +{ pkgs, ... }: + +{ + programs.vscode = { + package = pkgs.vscodium; + + extensions = with pkgs.vscode-extensions; [ + jdinhlife.gruvbox + vscode-icons-team.vscode-icons + + jnoortheen.nix-ide + golang.go + ziglang.vscode-zig + ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "shader"; + publisher = "slevesque"; + version = "1.1.5"; + sha256 = "3dfdfb15e40c365bfbe1fecb333f7e08ab1c17a5234d9ed9a5c69914ab57d993"; + } + ]; + + userSettings = { + "workbench.colorTheme" = "Gruvbox Dark Medium"; + "workbench.iconTheme" = "vscode-icons"; + "window.titleBarStyle" = "custom"; + + "git.confirmSync" = false; + + "vsicons.dontShowNewVersionMessage" = true; + + "files.associations" = { + "*.vsh" = "glsl"; + "*.fsh" = "glsl"; + "*.gsh" = "glsl"; + }; + + # Zig + "zig.initialSetupDone" = true; + "zig.path" = ""; + "zig.formattingProvider" = "off"; + + "zig.zls.path" = ""; + "zig.zls.enableAutofix" = false; + "zig.zls.enableInlayHints" = false; + }; + }; +} -- cgit v1.2.3