Merge pull request #129 from DarkKirb/fixup-sway-config

fixup sway config
This commit is contained in:
Charlotte 🦝 Delenk 2023-01-01 17:51:31 +01:00 committed by GitHub
commit 009cfa6380
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 865 additions and 535 deletions

View file

@ -115,4 +115,9 @@ in {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [anthy];
};
security.polkit.enable = true;
security.pam.services.kwallet = {
name = "kwallet";
enableKwallet = true;
};
}

13
config/programs/foot.nix Normal file
View file

@ -0,0 +1,13 @@
{...}: {
programs.foot = {
enable = true;
server.enable = true;
settings = {
main = {
term = "xterm-256color";
font = "FiraCode Nerd Font:size=12";
dpi-aware = "yes";
};
};
};
}

View file

@ -16,171 +16,16 @@ desktop: {
programs.helix = {
enable = true;
settings = {
theme = "gruvbox";
editor = {
line-number = "relative";
cursorline = true;
color-modes = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
};
themes = {
gruvbox = {
# Author : Jakub Bartodziej <kubabartodziej@gmail.com>
# The theme uses the gruvbox dark palette with standard contrast: github.com/morhetz/gruvbox
"attribute" = "aqua1";
"keyword" = {fg = "red1";};
"keyword.directive" = "red0";
"namespace" = "aqua1";
"punctuation" = "orange1";
"punctuation.delimiter" = "orange1";
"operator" = "purple1";
"special" = "purple0";
"variable.other.member" = "blue1";
"variable" = "fg1";
"variable.builtin" = "orange1";
"variable.parameter" = "fg2";
"type" = "yellow1";
"type.builtin" = "yellow1";
"constructor" = {
fg = "purple1";
modifiers = ["bold"];
};
"function" = {
fg = "green1";
modifiers = ["bold"];
};
"function.macro" = "aqua1";
"function.builtin" = "yellow1";
"tag" = "red1";
"comment" = {
fg = "gray1";
modifiers = ["italic"];
};
"constant" = {fg = "purple1";};
"constant.builtin" = {
fg = "purple1";
modifiers = ["bold"];
};
"string" = "green1";
"constant.numeric" = "purple1";
"constant.character.escape" = {
fg = "fg2";
modifiers = ["bold"];
};
"label" = "aqua1";
"module" = "aqua1";
"diff.plus" = "green1";
"diff.delta" = "orange1";
"diff.minus" = "red1";
"warning" = {
fg = "orange1";
bg = "bg1";
};
"error" = {
fg = "red1";
bg = "bg1";
};
"info" = {
fg = "aqua1";
bg = "bg1";
};
"hint" = {
fg = "blue1";
bg = "bg1";
};
"ui.background" = {bg = "bg0";};
"ui.linenr" = {fg = "bg4";};
"ui.linenr.selected" = {fg = "yellow1";};
"ui.cursorline" = {bg = "bg1";};
"ui.statusline" = {
fg = "fg1";
bg = "bg2";
};
"ui.statusline.normal" = {
fg = "fg1";
bg = "bg2";
};
"ui.statusline.insert" = {
fg = "fg1";
bg = "blue0";
};
"ui.statusline.select" = {
fg = "fg1";
bg = "orange0";
};
"ui.statusline.inactive" = {
fg = "fg4";
bg = "bg1";
};
"ui.popup" = {bg = "bg1";};
"ui.window" = {bg = "bg1";};
"ui.help" = {
bg = "bg1";
fg = "fg1";
};
"ui.text" = {fg = "fg1";};
"ui.text.focus" = {fg = "fg1";};
"ui.selection" = {
bg = "bg3";
modifiers = ["reversed"];
};
"ui.cursor.primary" = {modifiers = ["reversed"];};
"ui.cursor.match" = {bg = "bg2";};
"ui.menu" = {
fg = "fg1";
bg = "bg2";
};
"ui.menu.selected" = {
fg = "bg2";
bg = "blue1";
modifiers = ["bold"];
};
"ui.virtual.whitespace" = "bg2";
"ui.virtual.ruler" = {bg = "bg1";};
"diagnostic" = {modifiers = ["underlined"];};
"markup.heading" = "aqua1";
"markup.bold" = {modifiers = ["bold"];};
"markup.italic" = {modifiers = ["italic"];};
"markup.link.url" = {
fg = "green1";
modifiers = ["underlined"];
};
"markup.link.text" = "red1";
"markup.raw" = "red1";
palette = {
bg0 = "#282828"; # main background
bg1 = "#3c3836";
bg2 = "#504945";
bg3 = "#665c54";
bg4 = "#7c6f64";
fg0 = "#fbf1c7";
fg1 = "#ebdbb2"; # main foreground
fg2 = "#d5c4a1";
fg3 = "#bdae93";
fg4 = "#a89984"; # gray0
gray0 = "#a89984";
gray1 = "#928374";
red0 = "#cc241d"; # neutral
red1 = "#fb4934"; # bright
green0 = "#98971a";
green1 = "#b8bb26";
yellow0 = "#d79921";
yellow1 = "#fabd2f";
blue0 = "#458588";
blue1 = "#83a598";
purple0 = "#b16286";
purple1 = "#d3869b";
aqua0 = "#689d6a";
aqua1 = "#8ec07c";
orange0 = "#d65d0e";
orange1 = "#fe8019";
};
indent-guides.render = true;
};
};
};

View file

@ -10,51 +10,9 @@
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
};
Install = {
WantedBy = ["graphical-session.target"];
};
Install.WantedBy = ["graphical-session.target"];
Service = {
ExecStart = "${pkgs.keepassxc}/bin/keepassxc";
};
};
xdg.configFile."keepassxc/keepassxc.ini".text = ''
[General]
ConfigVersion=1
[Browser]
CustomProxyLocation=
Enabled=true
[FdoSecrets]
Enabled=true
[GUI]
AdvancedSettings=true
ApplicationTheme=dark
TrayIconAppearance=monochrome-light
[KeeShare]
Active="<?xml version=\"1.0\"?>\n<KeeShare xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <Active/>\n</KeeShare>\n"
Foreign="<?xml version=\"1.0\"?>\n<KeeShare xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <Foreign/>\n</KeeShare>\n"
Own="<?xml version=\"1.0\"?>\n<KeeShare xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <PrivateKey/>\n <PublicKey/>\n</KeeShare>\n"
QuietSuccess=true
[PasswordGenerator]
AdditionalChars=
AdvancedMode=true
Braces=true
Dashes=true
EASCII=false
EnsureEvery=false
ExcludedChars=
Length=10
Logograms=true
Math=true
Punctuation=true
Quotes=true
SpecialChars=true
[Security]
IconDownloadFallback=true
'';
}

View file

@ -1,14 +1,17 @@
{pkgs, ...}: {
programs.mako = {
enable = true;
defaultTimeout = 30000;
};
systemd.user.services.mako = {
Unit = {
Description = "mako";
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
};
Install = {
WantedBy = ["graphical-session.target"];
};
Install.WantedBy = ["graphical-session.target"];
Service = {
ExecStart = "${pkgs.mako}/bin/mako --default-timeout 30000";
ExecStart = "mako";
};
};
}

View file

@ -70,13 +70,10 @@ in {
systemd.user.services.plover = {
Unit = {
Description = "plover";
After = ["tray.target"];
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
Requires = ["tray.target"];
};
Install = {
WantedBy = ["graphical-session.target"];
};
Install.WantedBy = ["graphical-session.target"];
Service = {
ExecStart = "${plover-env}/bin/plover";
};

11
config/programs/rofi.nix Normal file
View file

@ -0,0 +1,11 @@
{pkgs, ...}: {
programs.rofi = {
enable = true;
font = "Noto Sans";
extraConfig = {
display-drun = " Apps ";
display-run = " Run ";
};
terminal = "${pkgs.foot}/bin/foot";
};
}

View file

@ -4,35 +4,24 @@
lib,
...
}: let
c = "$";
switch_window = pkgs.writeScript "switchWindow" ''
# https://www.reddit.com/r/swaywm/comments/krd0sq/comment/gib6z73/?context=3
jq_filter='
# descend to workspace or scratchpad
.nodes[].nodes[]
# save workspace name as .w
| {"w": .name} + (
if (.nodes|length) > 0 then # workspace
[recurse(.nodes[])]
else # scratchpad
[]
end
+ .floating_nodes
| .[]
# select nodes with no children (windows)
| select(.nodes==[])
)
| [
"<span size=\"xx-small\">\(.id)</span>",
# remove markup and index from workspace name, replace scratch with "[S]"
"<span size=\"xx-small\">\(.w | gsub("^[^:]*:|<[^>]*>"; "") | sub("__i3_scratch"; "[S]"))</span>",
# get app name (or window class if xwayland)
"<span weight=\"bold\">\(if .app_id == null then .window_properties.class else .app_id end)</span>",
"<span style=\"italic\">\(.name)</span>"
] | @tsv
'
${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r "$jq_filter" | ${pkgs.wofi}/bin/wofi -m --insensitive --show dmenu --prompt='Focus a window' | {
read -r id name && swaymsg "[con_id=$id]" focus
set -euo pipefail
tree=$(${pkgs.sway}/bin/swaymsg -t get_tree)
readarray -t win_ids <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .id' <<< "$tree")"
readarray -t win_names <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .name' <<< "$tree")"
readarray -t win_types <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .app_id // .window_properties.class' <<< "$tree")"
switch () {
local k
read -r k
swaymsg "[con_id=${c}{win_ids[$k]}] focus"
}
for k in $(seq 0 $((${c}{#win_ids[@]} - 1))); do
echo -e "<span weight=\\"bold\\">\\${c}{win_types[$k]}</span> - ${c}{win_names[$k]}"
done | rofi -dmenu -markup-rows -i -p window -format i | switch
'';
screenshot_then_switch = pkgs.writeScript "screenshotThenSwitch" ''
${pkgs.sway-contrib.grimshot}/bin/grimshot "$@"
@ -59,23 +48,6 @@
'';
installPhase = "true";
};
# bash script to let dbus know about important env variables and
# propogate them to relevent services run at the end of sway config
# see
# https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
# note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
# some user services to make sure they have the correct environment variables
dbus-sway-environment = pkgs.writeTextFile {
name = "dbus-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
${pkgs.dbus}/bin/dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
${pkgs.systemd}/bin/systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
${pkgs.systemd}/bin/systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
};
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# the suggested way to set gtk settings is with gsettings
@ -100,11 +72,9 @@ in {
./wl-clipboard.nix
./mako.nix
./swayidle.nix
./foot.nix
./rofi.nix
];
home.file.".config/wofi/config".text = ''
allow_markup = true
dmenu-parse_action = true
'';
wayland.windowManager.sway = {
enable = true;
config = {
@ -138,7 +108,8 @@ in {
inherit (config.wayland.windowManager.sway.config) modifier;
in
lib.mkOptionDefault {
"${modifier}+d" = "exec ${pkgs.wofi}/bin/wofi --show drun";
"${modifier}+Return" = "exec ${pkgs.foot}/bin/foot";
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi --show drun";
"Print" = "mode screenshot";
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
@ -160,15 +131,15 @@ in {
modes = {
screenshot = {
Print = "exec ${screenshot_then_switch} copy area";
"Shift+Print" = "exec ${screenshot_then_switch} save area $HOME/Pictures/grim-$(date --iso=s).png";
"Shift+Print" = "exec ${screenshot_then_switch} save area $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
a = "exec ${screenshot_then_switch} copy active";
"Shift+a" = "exec ${screenshot_then_switch} save active $HOME/Pictures/grim-$(date --iso=s).png";
"Shift+a" = "exec ${screenshot_then_switch} save active $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
s = "exec ${screenshot_then_switch} copy screen";
"Shift+s" = "exec ${screenshot_then_switch} save screen $HOME/Pictures/grim-$(date --iso=s).png";
"Shift+s" = "exec ${screenshot_then_switch} save screen $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
o = "exec ${screenshot_then_switch} copy output";
"Shift+o" = "exec ${screenshot_then_switch} save output $HOME/Pictures/grim-$(date --iso=s).png";
"Shift+o" = "exec ${screenshot_then_switch} save output $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
w = "exec ${screenshot_then_switch} copy window";
"Shift+w" = "exec ${screenshot_then_switch} save window $HOME/Pictures/grim-$(date --iso=s).png";
"Shift+w" = "exec ${screenshot_then_switch} save window $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
Escape = ''mode "default"'';
Return = ''mode "default"'';
};
@ -185,9 +156,10 @@ in {
export GTK_USE_PORTAL=1
'';
extraConfig = ''
exec ${dbus-sway-environment}/bin/dbus-sway-environment
exec ${configure-gtk}/bin/configure-gtk
exec ${pkgs.systemd}/bin/systemctl --user import-environment
gaps outer 8
gaps inner 4
'';
};

View file

@ -17,16 +17,36 @@
${pkgs.mpc-cli}/bin/mpc play
'';
in {
systemd.user.services.swayidle = {
Unit = {
Description = "swayidle";
PartOf = ["graphical-session.target"];
};
Install = {
WantedBy = ["graphical-session.target"];
};
Service = {
ExecStart = "${pkgs.swayidle}/bin/swayidle -w timeout 300 ${lock-script} timeout 305 ${screen-off-script} resume ${resume-script} before-sleep ${lock-script} timeout 900 ${suspend-script} lock ${lock-script} unlock ${unlock-script}";
};
services.swayidle = {
enable = true;
events = [
{
event = "before-sleep";
command = "${lock-script}";
}
{
event = "lock";
command = "${lock-script}";
}
{
event = "unlock";
command = "${unlock-script}";
}
];
timeouts = [
{
timeout = 300;
command = "${lock-script}";
}
{
timeout = 305;
command = "${screen-off-script}";
resumeCommand = "${resume-script}";
}
{
timeout = 900;
command = "${suspend-script}";
}
];
};
}

View file

@ -1,83 +1,532 @@
{pkgs, ...}: let
{pkgs, config, ...}: let
theme = import ../../extra/theme.nix;
inherit (config.lib.formats.rasi) mkLiteral;
rasiColor = c: mkLiteral (theme.cssColor c);
in {
gtk = {
enable = true;
cursorTheme = {
package = null;
name = "breeze_cursors";
package = pkgs.libsForQt5.breeze-icons;
name = "breeze-dark";
size = 24;
};
font = {
package = null;
package = pkgs.noto-fonts;
name = "Noto Sans";
size = 10;
};
iconTheme = {
package = null;
package = pkgs.libsForQt5.breeze-icons;
name = "breeze-dark";
};
theme = {
package = null;
package = pkgs.libsForQt5.breeze-gtk;
name = "Breeze-Dark";
};
};
qt.enable = true;
qt.style.package = pkgs.libsForQt5.breeze-qt5;
qt.style.name = "BreezeDark";
# Taken from https://github.com/jakehamilton/dotfiles/blob/master/waybar/style.css
programs.waybar.style = with theme; ''
* {
border: none;
border-radius: 0;
font-size: 14px;
min-height: 24px;
font-family: "NotoSansDisplay Nerd Font", "Noto Sans Mono CJK JP";
}
window.HDMI-A-1 * {
font-size: 12px;
color: ${cssColor base};
}
window#waybar {
background: ${cssColor bg};
background: tranparent;
opacity: 0.9;
}
#mpd, #cpu {
background: ${cssColor green};
color: ${cssColor bg};
window#waybar.hidden {
opacity: 0.2;
}
#pulseaudio {
background: ${cssColor yellow};
color: ${cssColor bg};
}
#network, #tray {
background: ${cssColor blue};
color: ${cssColor bg};
}
#memory, #workspaces button.focused {
background: ${cssColor magenta};
}
#language {
background: ${cssColor cyan};
}
#clock {
background: ${cssColor light-grey};
}
.urgent {
background: ${cssColor red};
}
#workspaces button {
#window {
margin-top: 8px;
padding: 0px 16px 0px 16px;
border-radius: 24px;
transition: none;
background: transparent;
}
label {
color: #fff;
#workspaces {
margin-top: 8px;
margin-left: 12px;
margin-bottom: 0;
border-radius: 24px;
background: ${cssColor surface0};
transition: none;
}
#workspaces button {
transition: none;
background: transparent;
font-size: 16px;
color: ${cssColor text};
}
#workspaces button.focused {
background: ${cssColor mauve};
color: ${cssColor base};
}
#workspaces button:hover {
background: ${cssColor sapphire};
color: ${cssColor base};
}
#mpd {
margin-top: 8px;
margin-left: 8px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 24px;
background: ${cssColor green};
transition: none;
}
#mpd.disconnected,
#mpd.stopped {
background: ${cssColor red};
}
#network {
margin-top: 8px;
margin-left: 8px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 24px;
transition: none;
background: ${cssColor mauve};
}
#pulseaudio {
margin-top: 8px;
margin-left: 8px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 24px;
transition: none;
background: ${cssColor teal};
}
#temperature, #battery {
margin-top: 8px;
margin-left: 8px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 24px;
transition: none;
background: ${cssColor green};
}
#cpu, #backlight, #battery.warning {
margin-top: 8px;
margin-left: 8px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 24px;
transition: none;
background: ${cssColor yellow};
}
#memory, #battery.critical {
margin-top: 8px;
margin-left: 8px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 24px;
transition: none;
background: ${cssColor red};
}
#clock {
margin-top: 8px;
margin-left: 8px;
margin-right: 12px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
border-radius: 26px;
transition: none;
background: ${cssColor surface0};
color: ${cssColor text};
}
'';
wayland.windowManager.sway.extraConfig = with theme; ''
# target title bg text indicator border
client.focused ${cssColor pink} ${cssColor base} ${cssColor text} ${cssColor rosewater} ${cssColor pink}
client.focused_inactive ${cssColor mauve} ${cssColor base} ${cssColor text} ${cssColor rosewater} ${cssColor mauve}
client.unfocused ${cssColor mauve} ${cssColor base} ${cssColor text} ${cssColor rosewater} ${cssColor mauve}
client.urgent ${cssColor peach} ${cssColor base} ${cssColor peach} ${cssColor overlay0} ${cssColor peach}
client.placeholder ${cssColor overlay0} ${cssColor base} ${cssColor text} ${cssColor overlay0} ${cssColor overlay0}
client.background ${cssColor base}
'';
programs.foot.settings.colors = with theme; {
alpha = 0.9;
background = base;
foreground = text;
regular0 = surface1;
regular1 = red;
regular2 = green;
regular3 = yellow;
regular4 = blue;
regular5 = pink;
regular6 = teal;
regular7 = subtext1;
bright0 = surface2;
bright1 = red;
bright2 = green;
bright3 = yellow;
bright4 = blue;
bright5 = pink;
bright6 = teal;
bright7 = subtext0;
};
programs.rofi.theme = with theme; let
element = {
background-color = mkLiteral "inherit";
text-color = mkLiteral "inherit";
};
in {
"*" = {
bg-col = rasiColor base;
bg-col-light = rasiColor base;
border-col = rasiColor base;
selected-col = rasiColor base;
blue = rasiColor blue;
fg-col = rasiColor text;
fg-col2 = rasiColor red;
grey = rasiColor overlay0;
width = 600;
};
element-text = element;
window = {
height = mkLiteral "360px";
border = mkLiteral "3px";
border-color = mkLiteral "@border-col";
background-color = mkLiteral "@bg-col";
opacity = mkLiteral "0.9";
};
mainbox = {
background-color = mkLiteral "@bg-col";
};
inputbar = {
children = map mkLiteral ["prompt" "entry"];
background-color = mkLiteral "@bg-col";
border-radius = mkLiteral "5px";
padding = mkLiteral "2px";
};
prompt = {
background-color = mkLiteral "@blue";
padding = mkLiteral "6px";
text-color = mkLiteral "@bg-col";
border-radius = mkLiteral "3px";
margin = mkLiteral "20px 0px 0px 20px";
};
textbox-prompt-colon = {
expand = mkLiteral "false";
str = ":";
};
entry = {
padding = mkLiteral "6px";
margin = mkLiteral "20px 0px 0px 10px";
text-color = mkLiteral "@fg-col";
background-color = mkLiteral "@bg-col";
};
listview = {
border = mkLiteral "0px 0px 0px";
padding = mkLiteral "6px 0px 0px";
margin = mkLiteral "10px 0px 0px 20px";
columns = 2;
lines = 5;
background-color = mkLiteral "@bg-col";
};
element = {
padding = mkLiteral "5px";
background-color = mkLiteral "@bg-col";
text-color = mkLiteral "@fg-col";
};
element-icon = element // {
size = mkLiteral "25px";
};
"element selected" = {
background-color = mkLiteral "@selected-col";
text-color = mkLiteral "@fg-col2";
};
mode-switcher = element // {
spacing = 0;
};
button = {
padding = mkLiteral "10px";
background-color = mkLiteral "@bg-col-light";
text-color = mkLiteral "@grey";
vertical-align = mkLiteral "0.5";
horizontal-align = mkLiteral "0.5";
};
"button selected" = {
background-color = mkLiteral "@bg-col";
text-color = mkLiteral "@blue";
};
message = {
background-color = mkLiteral "@bg-col-light";
margin = mkLiteral "2px";
padding = mkLiteral "2px";
border-radius = mkLiteral "5px";
};
textbox = {
padding = mkLiteral "6px";
margin = mkLiteral "20px 0px 0px 20px";
text-color = mkLiteral "@blue";
background-color = mkLiteral "@bg-col-light";
};
};
programs.helix = {
settings.theme = "catppuccin";
themes.catppucchin = {
# Syntax highlighting
# -------------------
"type" = "yellow";
"constructor" = "sapphire";
"constant" = "peach";
"constant.builtin" = "peach";
"constant.character" = "teal";
"constant.character.escape" = "pink";
"string" = "green";
"string.regexp" = "peach";
"string.special" = "blue";
"comment" = {
fg = "surface2";
modifiers = ["italic"];
};
"variable" = "text";
"variable.parameter" = {
fg = "maroon";
modifiers = ["italic"];
};
"variable.builtin" = "red";
"variable.other.member" = "teal";
"label" = "sapphire"; # used for lifetimes
"punctuation" = "overlay2";
"punctuation.special" = "sky";
"keyword" = "mauve";
"keyword.control.conditional" = {
fg = "mauve";
modifiers = ["italic"];
};
"operator" = "sky";
"function" = "blue";
"function.builtin" = "peach";
"function.macro" = "mauve";
"tag" = "mauve";
"namespace" = {
fg = "blue";
modifiers = ["italic"];
};
"special" = "blue"; # fuzzy highlight
"markup.heading.marker" = {
fg = "peach";
modifiers = ["bold"];
};
"markup.heading.1" = "lavender";
"markup.heading.2" = "mauve";
"markup.heading.3" = "green";
"markup.heading.4" = "yellow";
"markup.heading.5" = "pink";
"markup.heading.6" = "teal";
"markup.list" = "mauve";
"markup.bold" = {modifiers = ["bold"];};
"markup.italic" = {modifiers = ["italic"];};
"markup.link.url" = {
fg = "rosewater";
modifiers = ["italic" "underlined"];
};
"markup.link.text" = "blue";
"markup.raw" = "flamingo";
"diff.plus" = "green";
"diff.minus" = "red";
"diff.delta" = "blue";
# User Interface
# --------------
"ui.background" = {
fg = "text";
bg = "base";
};
"ui.linenr" = {fg = "surface1";};
"ui.linenr.selected" = {fg = "lavender";};
"ui.statusline" = {
fg = "text";
bg = "mantle";
};
"ui.statusline.inactive" = {
fg = "surface2";
bg = "mantle";
};
"ui.statusline.normal" = {
fg = "base";
bg = "lavender";
modifiers = ["bold"];
};
"ui.statusline.insert" = {
fg = "base";
bg = "green";
modifiers = ["bold"];
};
"ui.statusline.select" = {
fg = "base";
bg = "flamingo";
modifiers = ["bold"];
};
"ui.popup" = {
fg = "text";
bg = "surface0";
};
"ui.window" = {fg = "crust";};
"ui.help" = {
fg = "overlay2";
bg = "surface0";
};
"ui.bufferline" = {
fg = "surface1";
bg = "mantle";
};
"ui.bufferline.active" = {
fg = "text";
bg = "base";
modifiers = ["bold" "italic"];
};
"ui.bufferline.background" = {bg = "surface0";};
"ui.text" = "text";
"ui.text.focus" = {
fg = "text";
bg = "surface0";
modifiers = ["bold"];
};
"ui.virtual" = "overlay0";
"ui.virtual.ruler" = {bg = "surface0";};
"ui.virtual.indent-guide" = "surface0";
"ui.selection" = {bg = "surface1";};
"ui.cursor" = {
fg = "base";
bg = "secondary_cursor";
};
"ui.cursor.primary" = {
fg = "base";
bg = "rosewater";
};
"ui.cursor.match" = {
fg = "peach";
modifiers = ["bold"];
};
"ui.cursorline.primary" = {bg = "cursorline";};
"ui.highlight" = {
bg = "surface1";
modifiers = ["bold"];
};
"ui.menu" = {
fg = "overlay2";
bg = "surface0";
};
"ui.menu.selected" = {
fg = "text";
bg = "surface1";
modifiers = ["bold"];
};
diagnostic = {modifiers = ["underlined"];};
"diagnostic.error" = "red";
"diagnostic.warn" = "yellow";
"diagnostic.info" = "sky";
"diagnostic.hint" = "teal";
error = "red";
warning = "yellow";
info = "sky";
hint = "teal";
palette = with theme; {
rosewater = cssColor rosewater;
flamingo = cssColor flamingo;
pink = cssColor pink;
mauve = cssColor mauve;
red = cssColor red;
maroon = cssColor maroon;
peach = cssColor peach;
yellow = cssColor yellow;
green = cssColor green;
teal = cssColor teal;
sky = cssColor sky;
sapphire = cssColor sapphire;
blue = cssColor blue;
lavender = cssColor lavender;
text = cssColor text;
subtext1 = cssColor subtext1;
subtext0 = cssColor subtext0;
overlay2 = cssColor overlay2;
overlay1 = cssColor overlay1;
overlay0 = cssColor overlay0;
surface2 = cssColor surface2;
surface1 = cssColor surface1;
surface0 = cssColor surface0;
base = cssColor base;
mantle = cssColor mantle;
crust = cssColor crust;
cursorline = "#2a2b3c";
secondary_cursor = "#b5a6a8";
};
};
};
}

View file

@ -5,37 +5,5 @@
clock24 = true;
prefix = "C-a";
sensibleOnTop = true;
plugins = with pkgs.tmuxPlugins; [
power-theme
cpu
{
plugin = resurrect;
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
'';
}
];
extraConfig = ''
set-window-option -g automatic-rename on
set-option -g set-titles on
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind -n S-Left previous-window
bind -n S-Right next-window
set -sg escape-time 0
set -g mouse on
set -g default-terminal "screen-256color"
'';
};
}

View file

@ -106,7 +106,8 @@
"editor.fontFamily" = "\"FiraCode Nerd Font Mono\", \"Noto Sans Mono CJK JP\", monospace";
"rust-analyzer.checkOnSave.command" = "clippy";
"ledger.binary" = "${pkgs.hledger}/bin/hledger";
"workbench.colorTheme" = "Gruvbox Dark Hard";
"workbench.colorTheme" = "Catppuccin Mocha";
"window.titleBarStyle" = "custom";
"rust-analyzer.hoverActions.references" = true;
"rust-analyzer.lens.methodReferences" = true;
"rust-analyzer.workspace.symbol.search.scope" = "workspace_and_dependencies";
@ -289,6 +290,7 @@
bierner.markdown-mermaid
bradlc.vscode-tailwindcss
bungcip.better-toml
catppuccin.catppuccin-vsc
christian-kohler.path-intellisense
codezombiech.gitignore
davidanson.vscode-markdownlint
@ -304,7 +306,6 @@
github.vscode-pull-request-github
golang.go
haskell.haskell
jdinhlife.gruvbox
jnoortheen.nix-ide
justusadam.language-haskell
mkhl.direnv

View file

@ -33,12 +33,12 @@
format = "{name} {icon}";
};
"sway/mode" = {
format = "<span style=\"italic\">{}<span>";
format = "{}";
};
mpd = {
format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) {songPosition}|{queueLength} {volume}% ";
format-disconnected = "Disconnected ";
format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ";
format = "{stateIcon} {artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})";
format-disconnected = "";
format-stopped = "";
unknown-tag = "N/A";
interval = 2;
consume-icons = {
@ -60,6 +60,11 @@
};
tooltip-format = "MPD (connected)";
tooltip-format-disconnected = "MPD (disconnected)";
on-click = "${pkgs.mpc-cli}/bin/mpc toggle";
on-click-middle = "${pkgs.foot}/bin/foot ${pkgs.ncmpcpp}/bin/ncmpcpp";
on-click-right = "${pkgs.mpc-cli}/bin/mpc stop";
on-scroll-up = "${pkgs.mpc-cli}/bin/mpc seekthrough +00:00:10";
on-scroll-down = "${pkgs.mpc-cli}/bin/mpc seekthrough -00:00:10";
};
idle_inhibitor = {
format = "{icon}";
@ -106,20 +111,11 @@
bat = "BAT2";
};
network = {
format-wifi = "{essid} ({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} ";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "{ifname} (No IP) ";
format-disconnected = "Disconnected ";
format-alt = "{ifname}: {ipaddr}/{cidr}";
format-wifi = " {essid} {ipaddr}";
format-ethernet = " {ipaddr}";
};
pulseaudio = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format = "{icon} {volume}%";
format-icons = {
headphone = "";
hands-free = "";

View file

@ -2,11 +2,10 @@
systemd.user.services.wl-clipboard = {
Unit = {
Description = "wl-clipboard";
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
};
Install = {
WantedBy = ["graphical-session.target"];
};
Install.WantedBy = ["graphical-session.target"];
Service = {
ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.clipman}/bin/clipman store --no-persist";
};

View file

@ -1,4 +1,8 @@
{pkgs, config, ...}: {
{
pkgs,
config,
...
}: {
imports = [
../../modules/gitea.nix
(import ../../modules/gateway-st.nix {name = "gitea";})

View file

@ -5,7 +5,6 @@
# containing 'defaultNix' (to be used in 'default.nix'), 'shellNix'
# (to be used in 'shell.nix').
let
src = ./.;
system = builtins.currentSystem or "unknown-system";
@ -13,53 +12,91 @@ let
lockFile = builtins.fromJSON (builtins.readFile lockFilePath);
fetchTree =
info:
if info.type == "github" then
{ outPath =
fetchTarball
({ url = "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}"; }
// (if info ? narHash then { sha256 = info.narHash; } else {})
);
rev = info.rev;
shortRev = builtins.substring 0 7 info.rev;
lastModified = info.lastModified;
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
narHash = info.narHash;
}
else if info.type == "git" then
{ outPath =
builtins.fetchGit
({ url = info.url; }
// (if info ? rev then { inherit (info) rev; } else {})
// (if info ? ref then { inherit (info) ref; } else {})
// (if info ? submodules then { inherit (info) submodules; } else {})
);
lastModified = info.lastModified;
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
narHash = info.narHash;
} // (if info ? rev then {
rev = info.rev;
shortRev = builtins.substring 0 7 info.rev;
} else {
})
else if info.type == "path" then
{ outPath = builtins.path { path = info.path; };
narHash = info.narHash;
}
else if info.type == "tarball" then
{ outPath =
fetchTarball
({ inherit (info) url; }
// (if info ? narHash then { sha256 = info.narHash; } else {})
);
}
else if info.type == "gitlab" then
{ inherit (info) rev narHash lastModified;
fetchTree = info:
if info.type == "github"
then {
outPath =
fetchTarball
({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; }
// (if info ? narHash then { sha256 = info.narHash; } else {})
(
{url = "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}";}
// (
if info ? narHash
then {sha256 = info.narHash;}
else {}
)
);
rev = info.rev;
shortRev = builtins.substring 0 7 info.rev;
lastModified = info.lastModified;
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
narHash = info.narHash;
}
else if info.type == "git"
then
{
outPath =
builtins.fetchGit
(
{url = info.url;}
// (
if info ? rev
then {inherit (info) rev;}
else {}
)
// (
if info ? ref
then {inherit (info) ref;}
else {}
)
// (
if info ? submodules
then {inherit (info) submodules;}
else {}
)
);
lastModified = info.lastModified;
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
narHash = info.narHash;
}
// (
if info ? rev
then {
rev = info.rev;
shortRev = builtins.substring 0 7 info.rev;
}
else {
}
)
else if info.type == "path"
then {
outPath = builtins.path {path = info.path;};
narHash = info.narHash;
}
else if info.type == "tarball"
then {
outPath =
fetchTarball
(
{inherit (info) url;}
// (
if info ? narHash
then {sha256 = info.narHash;}
else {}
)
);
}
else if info.type == "gitlab"
then {
inherit (info) rev narHash lastModified;
outPath =
fetchTarball
(
{url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}";}
// (
if info ? narHash
then {sha256 = info.narHash;}
else {}
)
);
shortRev = builtins.substring 0 7 info.rev;
}
@ -67,46 +104,53 @@ let
# FIXME: add Mercurial, tarball inputs.
throw "flake input has unsupported input type '${info.type}'";
callFlake4 = flakeSrc: locks:
let
callFlake4 = flakeSrc: locks: let
flake = import (flakeSrc + "/flake.nix");
inputs = builtins.mapAttrs (n: v:
if v.flake or true
then callFlake4 (fetchTree (v.locked // v.info)) v.inputs
else fetchTree (v.locked // v.info)) locks;
else fetchTree (v.locked // v.info))
locks;
outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;}));
in
assert flake.edition == 201909;
outputs;
assert flake.edition == 201909; outputs;
callLocklessFlake = flakeSrc:
let
callLocklessFlake = flakeSrc: let
flake = import (flakeSrc + "/flake.nix");
outputs = flakeSrc // (flake.outputs ({ self = outputs; }));
in outputs;
outputs = flakeSrc // (flake.outputs {self = outputs;});
in
outputs;
rootSrc = let
# Try to clean the source tree by using fetchGit, if this source
# tree is a valid git repository.
tryFetchGit = src:
if isGit && !isShallow
then
let res = builtins.fetchGit src;
in if res.rev == "0000000000000000000000000000000000000000" then removeAttrs res ["rev" "shortRev"] else res
then let
res = builtins.fetchGit src;
in
if res.rev == "0000000000000000000000000000000000000000"
then removeAttrs res ["rev" "shortRev"]
else res
else {outPath = src;};
# NB git worktrees have a file for .git, so we don't check the type of .git
isGit = builtins.pathExists (src + "/.git");
isShallow = builtins.pathExists (src + "/.git/shallow");
in
{ lastModified = 0; lastModifiedDate = formatSecondsSinceEpoch 0; }
// (if src ? outPath then src else tryFetchGit src);
{
lastModified = 0;
lastModifiedDate = formatSecondsSinceEpoch 0;
}
// (
if src ? outPath
then src
else tryFetchGit src
);
# Format number of seconds in the Unix epoch as %Y%m%d%H%M%S.
formatSecondsSinceEpoch = t:
let
formatSecondsSinceEpoch = t: let
rem = x: y: x - x / y * y;
days = t / 86400;
secondsInDay = rem t 86400;
@ -116,33 +160,65 @@ let
# Courtesy of https://stackoverflow.com/a/32158604.
z = days + 719468;
era = (if z >= 0 then z else z - 146096) / 146097;
era =
(
if z >= 0
then z
else z - 146096
)
/ 146097;
doe = z - era * 146097;
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
y = yoe + era * 400;
doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
mp = (5 * doy + 2) / 153;
d = doy - (153 * mp + 2) / 5 + 1;
m = mp + (if mp < 10 then 3 else -9);
y' = y + (if m <= 2 then 1 else 0);
m =
mp
+ (
if mp < 10
then 3
else -9
);
y' =
y
+ (
if m <= 2
then 1
else 0
);
pad = s: if builtins.stringLength s < 2 then "0" + s else s;
pad = s:
if builtins.stringLength s < 2
then "0" + s
else s;
in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}";
allNodes =
builtins.mapAttrs
(key: node:
let
(
key: node: let
sourceInfo =
if key == lockFile.root
then rootSrc
else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]);
subdir = if key == lockFile.root then "" else node.locked.dir or "";
subdir =
if key == lockFile.root
then ""
else node.locked.dir or "";
flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix");
flake = import (sourceInfo
+ (
if subdir != ""
then "/"
else ""
)
+ subdir
+ "/flake.nix");
inputs = builtins.mapAttrs
inputs =
builtins.mapAttrs
(inputName: inputSpec: allNodes.${resolveInput inputSpec})
(node.inputs or {});
@ -167,13 +243,18 @@ let
outputs = flake.outputs (inputs // {self = result;});
result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; };
result =
outputs
// sourceInfo
// {
inherit inputs;
inherit outputs;
inherit sourceInfo;
};
in
if node.flake or true then
assert builtins.isFunction flake.outputs;
result
else
sourceInfo
if node.flake or true
then assert builtins.isFunction flake.outputs; result
else sourceInfo
)
lockFile.nodes;
@ -185,4 +266,5 @@ let
else if lockFile.version >= 5 && lockFile.version <= 7
then allNodes.${lockFile.root}
else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}";
in result.outputs
in
result.outputs

View file

@ -1,26 +1,33 @@
rec {
authors = [
"Chris Kempson"
];
name = "Paraiso (dark)";
black = "2f1e2e";
dark-red = red;
dark-green = green;
dark-yellow = yellow;
dark-blue = blue;
dark-magenta = magenta;
dark-cyan = cyan;
light-grey = "998299";
dark-grey = "737373";
red = "ef6155";
green = "48b685";
yellow = "fec418";
blue = "06b6ef";
magenta = "815ba4";
cyan = "5bc4bf";
white = "e7e9db";
bg = black;
fg = white;
name = "Catppuccin Mocha Theme";
rosewater = "f5e0dc";
flamingo = "f2cdcd";
pink = "f5c2e7";
mauve = "cba6f7";
red = "f38ba8";
maroon = "eba0ac";
peach = "fab387";
yellow = "f9e2af";
green = "a6e3a1";
teal = "94e2d5";
sky = "89dceb";
sapphire = "74c7ec";
blue = "89b4fa";
lavender = "b4befe";
text = "cdd6f4";
subtext1 = "bac2de";
subtext0 = "a6adc8";
overlay2 = "9399b2";
overlay1 = "7f849c";
overlay0 = "6c7086";
surface2 = "585b70";
surface1 = "45475a";
surface0 = "313244";
base = "1e1e2e";
mantle = "181825";
crust = "11111b";
cssColor = color: "#${color}";
alacrittyColor = color: "0x${color}";
}