feat: add much required NixOS stuff

This commit is contained in:
Kat Inskip 2023-01-29 08:07:48 -08:00
parent a1d954f29a
commit e29aa76eac
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
47 changed files with 1324 additions and 72 deletions

View file

@ -5,5 +5,6 @@
}: {
nixpkgs = {
overlays = import tree.overlays {inherit inputs;};
config.allowUnfree = true;
};
}

30
flake.lock generated
View file

@ -24,11 +24,11 @@
"arcexprs": {
"flake": false,
"locked": {
"lastModified": 1673969973,
"narHash": "sha256-h0x2JpBFlxZOUE29Iced/Ci/5w4kXs52TgYaVzbBusA=",
"lastModified": 1674878824,
"narHash": "sha256-skuyKtydzGFtd2UQB2BZW2bMaUcS+fvHEEz+H4MNQ4g=",
"owner": "arcnmx",
"repo": "nixexprs",
"rev": "f0f8f76dc306ebbe7ac45008f36607243148969c",
"rev": "ab1bd348da95d6f33ad28992b5d8c636d2330cc9",
"type": "github"
},
"original": {
@ -126,11 +126,11 @@
]
},
"locked": {
"lastModified": 1674041176,
"narHash": "sha256-cMf1BQzI39nHQ0H/mOatthbbI3392qLmJ9gU0u520P4=",
"lastModified": 1674771519,
"narHash": "sha256-U0W3S1nX6yEvLh3Vq70EORbmXecAKXfmEfCfaA4A+I8=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2c29ae48f9a149151bdd82f429ac61d4412c312a",
"rev": "bb4b25b302dbf0f527f190461b080b5262871756",
"type": "github"
},
"original": {
@ -173,11 +173,11 @@
]
},
"locked": {
"lastModified": 1673752441,
"narHash": "sha256-/g4ImZWV05CrXRWTSJsda6ztIp7LAPxs2L6RCrbQ66U=",
"lastModified": 1674357402,
"narHash": "sha256-oxOCYORXBh0KW4KEwKpzs2LThDdVmEwREV+SsP4CIpg=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "391180f77505c1c8cdd45fe1a59dc89d3e40300a",
"rev": "e9e7c5c62965e7e656febb5ba578d53f751eb41f",
"type": "github"
},
"original": {
@ -188,11 +188,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1673796341,
"narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
"lastModified": 1674641431,
"narHash": "sha256-qfo19qVZBP4qn5M5gXc/h1MDgAtPA5VxJm9s8RUAkVk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
"rev": "9b97ad7b4330aacda9b2343396eb3df8a853b4fc",
"type": "github"
},
"original": {
@ -205,11 +205,11 @@
"pypi-deps-db": {
"flake": false,
"locked": {
"lastModified": 1674040379,
"narHash": "sha256-g0TSvbl31l81qYIMGIM7p1buPaA9rHM3N/WFD6Zk/RY=",
"lastModified": 1674855014,
"narHash": "sha256-SMUq72uWWs+KAlcRB7UXzI1QHNTGiUTpQK2qj1evHXQ=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "322a4f20c357704644abe8c2e50412e9b9c16909",
"rev": "a375715227007ca768d372b2b09bcb76f8f19d78",
"type": "github"
},
"original": {

View file

@ -6,33 +6,7 @@
inherit (lib.modules) mkMerge;
in {
base16 = {
vim.enable = false;
vim.template = data: let
drv = pkgs.base16-templates.vim.withTemplateData data;
in
drv.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
repo = "base16-vim";
owner = "fnune";
rev = "52e4ce93a6234d112bc88e1ad25458904ffafe61";
sha256 = "10y8z0ycmdjk47dpxf6r2pc85k0y19a29aww99vgnxp31wrkc17h";
};
patches =
old.patches
or []
++ [
(pkgs.fetchurl {
# base16background=none
url = "https://github.com/arcnmx/base16-vim/commit/fe16eaaa1de83b649e6867c61494276c1f35c3c3.patch";
sha256 = "1c0n7mf6161mvxn5xlabhyxzha0m1c41csa6i43ng8zybbspipld";
})
(pkgs.fetchurl {
# fix unreadable error highlights under cursor
url = "https://github.com/arcnmx/base16-vim/commit/807e442d95c57740dd3610c9f9c07c9aae8e0995.patch";
sha256 = "1l3qmk15v8d389363adkmfg8cpxppyhlk215yq3rdcasvw7r8bla";
})
];
});
vim.enable = true;
shell.enable = true;
schemes = mkMerge [
{

View file

@ -23,6 +23,13 @@ in
neovim
];
};
gui = {
imports = with dirImports; [
gui
wezterm
gpg
];
};
work = {
imports = with dirImports; [
wezterm

21
kat/gui/gtk.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
gnome.adwaita-icon-theme
];
gtk = {
enable = true;
font = {
name = "Iosevka Comfy";
size = 9;
};
iconTheme = {
name = "Maia";
package = pkgs.maia-icon-theme;
};
theme = {
name = "Adapta";
package = pkgs.adapta-gtk-theme;
};
};
}

20
kat/gui/konashow.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, pkgs, nixos, lib, ... }: {
# TODO: fix lib use
home.packages = [
config.services.konawall.konashow
];
services.konawall = {
enable = true;
interval = "30m";
mode = "shuffle";
commonTags = [ "width:>=1600" ];
tagList = map (lib.toList) [
([
"score:>=50"
#"no_humans"
#"rating:s"
])
];
};
}

7
kat/gui/layout.xkb Normal file
View file

@ -0,0 +1,7 @@
default partial alphanumeric_keys
xkb_symbols "basic" {
include "us(altgr-intl)"
name[Group1] = "English (US, international with pound sign)";
key <AD03> { [ e, E, EuroSign, cent ] };
key <AE03> { [ 3, numbersign, sterling] };
};

27
kat/gui/mako.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, pkgs, lib, ... }: let
inherit (config.base16) palette;
in {
systemd.user.services = {
mako = {
Unit = {
Description = "mako";
X-Restart-Triggers =
[ (toString config.xdg.configFile."mako/config".source) ];
};
Service = {
ExecStart = "${pkgs.mako}/bin/mako";
Restart = "always";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
programs.mako = {
enable = true;
font = "Iosevka Comfy 10";
defaultTimeout = 3000;
borderColor = palette.base08;
backgroundColor = "${palette.base00}BF";
textColor = palette.base05;
};
}

7
kat/gui/media.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
imv # Image viewer
yt-dlp # Downloading media
v4l-utils # Webcam
];
}

119
kat/gui/mpv.nix Normal file
View file

@ -0,0 +1,119 @@
{ config, lib, pkgs, ... }: let
inherit (lib.modules) mkMerge mkIf;
inherit (lib.attrsets) mapAttrsToList;
in {
# TODO: fix lib usage
programs.mpv = {
enable = true;
scripts = with pkgs.mpvScripts; [ sponsorblock paused ];
bindings =
let
vim = {
"l" = "seek 5";
"h" = "seek -5";
"k" = "seek 60";
"j" = "seek -60";
"Ctrl+l" = "seek 1 exact";
"Ctrl+h" = "seek -1 exact";
"Ctrl+L" = "sub-seek 1";
"Ctrl+H" = "sub-seek -1";
"Ctrl+k" = "add chapter 1";
"Ctrl+j" = "add chapter -1";
"Ctrl+K" = "playlist-next";
"Ctrl+J" = "playlist-prev";
"Alt+h" = "frame-back-step";
"Alt+l" = "frame-step";
"`" = "cycle mute";
"MBTN_RIGHT" = "cycle pause";
"w" = "screenshot";
"W" = "screenshot video";
"Ctrl+w" = "screenshot window";
"Ctrl+W" = "screenshot each-frame";
"o" = "show-progress";
"O" = "script-message show_osc_dur 5";
"F1" = "cycle sub";
"F2" = "cycle audio";
"Ctrl+p" = "cycle video";
"L" = "add volume 2";
"H" = "add volume -2";
"Alt+H" = "add audio-delay -0.100";
"Alt+L" = "add audio-delay 0.100";
"1" = "set volume 10";
"2" = "set volume 20";
"3" = "set volume 30";
"4" = "set volume 40";
"5" = "set volume 50";
"6" = "set volume 60";
"7" = "set volume 70";
"8" = "set volume 80";
"9" = "set volume 90";
")" = "set volume 150";
"0" = "set volume 100";
"m" = "cycle mute";
"Ctrl+r" = "loadfile \${path}";
"Ctrl+R" = "video-reload";
"d" = "drop-buffers";
"Ctrl+d" = "quit";
};
other = {
"RIGHT" = vim."l";
"LEFT" = vim."h";
"UP" = vim."k";
"DOWN" = vim."j";
"Ctrl+0" = "set speed 1.0";
"Ctrl+=" = "multiply speed 1.1";
"Ctrl+-" = "multiply speed 1/1.1";
"Shift+LEFT" = vim."H";
"Shift+RIGHT" = vim."L";
"Ctrl+RIGHT" = vim."Ctrl+l";
"Ctrl+LEFT" = vim."Ctrl+h";
"Ctrl+Shift+LEFT" = vim."Ctrl+H";
"Ctrl+Shift+RIGHT" = vim."Ctrl+L";
"Ctrl+UP" = vim."Ctrl+k";
"Ctrl+DOWN" = vim."Ctrl+j";
"Ctrl+Shift+UP" = vim."Ctrl+K";
"Ctrl+Shift+DOWN" = vim."Ctrl+J";
"Alt+LEFT" = vim."Alt+h";
"Alt+RIGHT" = vim."Alt+l";
"SPACE" = vim."MBTN_RIGHT";
"m" = vim."`";
"WHEEL_UP" = vim."L";
"WHEEL_DOWN" = vim."H";
};
in
vim // other;
config = mkMerge [
(mkIf config.wayland.windowManager.sway.enable {
gpu-context = "wayland";
})
{
no-input-default-bindings = "";
profile = "gpu-hq";
hwdec = "auto";
vo = "gpu";
volume-max = 200;
keep-open = true;
opengl-waitvsync = true;
demuxer-max-bytes = "2000MiB";
demuxer-max-back-bytes = "250MiB";
osd-scale-by-window = false;
osd-bar-h = 2.5; # 3.125 default
osd-border-size = 2; # font border pixels, default 3
term-osd-bar = true;
script-opts = builtins.concatStringsSep ","
(mapAttrsToList (k: v: "${k}=${toString v}") {
ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp";
osc-layout = "slimbox";
osc-vidscale = "no";
osc-deadzonesize = 0.75;
osc-minmousemove = 4;
osc-hidetimeout = 2000;
osc-valign = 0.9;
osc-timems = "yes";
osc-seekbarstyle = "knob";
osc-seekbarkeyframes = "no";
osc-seekrangestyle = "slider";
});
}];
};
}

32
kat/gui/packages.nix Normal file
View file

@ -0,0 +1,32 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
# Password manager
bitwarden
# Task managers
btop
htop
# Browser
brave
# Mail
thunderbird
# Music
spotify
# Chat
discord
nheko # Matrix
tdesktop # Telegram
dino # XMPP
signal-desktop
element-desktop
mumble-develop
# Archivery
unzip
zip
p7zip
# Misc
exiftool # EXIF Stripping
lm_sensors # Sensor Data
cryptsetup # Encrypted block devices
yubikey-manager # Yubikey
];
}

325
kat/gui/sway.nix Normal file
View file

@ -0,0 +1,325 @@
{
config,
pkgs,
lib,
...
}: let
# TODO: fix use of lib
lockCommand = config.programs.swaylock.script;
in {
programs.zsh.profileExtra = ''
# If running from tty1 start sway
if [ "$(tty)" = "/dev/tty1" ]; then
systemctl --user unset-environment \
SWAYSOCK \
I3SOCK \
WAYLAND_DISPLAY \
DISPLAY \
IN_NIX_SHELL \
__HM_SESS_VARS_SOURCED \
GPG_TTY \
NIX_PATH \
SHLVL
exec env --unset=SHLVL systemd-cat -t sway -- sway
fi
'';
home = {
sessionVariables = {
XDG_CURRENT_DESKTOP = "Unity";
XDG_SESSION_TYPE = "wayland";
WLR_DRM_DEVICES = "/dev/dri/card0";
};
packages = with pkgs; [
grim
slurp
swaylock-fancy
wl-clipboard
jq
quintom-cursor-theme
gsettings-desktop-schemas
glib
wofi
wmctrl
];
};
services = {
i3gopher.enable = true;
};
wayland.windowManager.sway = let
cfg = config.wayland.windowManager.sway.config;
bindsym = k: v: "bindsym ${k} ${v}";
bindWorkspace = key: workspace: {
"${cfg.modifier}+${key}" = "workspace number ${workspace}";
"${cfg.modifier}+shift+${key}" = "move container to workspace number ${workspace}";
};
workspaceBindings = map (v: bindWorkspace v "${v}:${v}") [
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
] ++ [(
bindWorkspace "0" "10:10")
] ++ lib.imap1 (i: v: bindWorkspace v "${toString (10 + i)}:${v}") [
"F1"
"F2"
"F3"
"F4"
"F5"
"F6"
"F7"
"F8"
"F9"
"F10"
"F11"
"F12"
];
workspaceBindings' = map (lib.mapAttrsToList bindsym) workspaceBindings;
workspaceBindingsStr = lib.concatStringsSep "\n" (lib.flatten workspaceBindings');
in {
enable = true;
config = let
pactl = "${config.home.nixosConfig.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl";
dmenu = "${pkgs.wofi}/bin/wofi -idbt ${pkgs.wezterm}/bin/wezterm -s ~/.config/wofi/wofi.css -p '' -W 25%";
in {
modes = {
"System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown" = {
"l" = "exec ${lockCommand}, mode default";
"e" = "exec swaymsg exit, mode default";
"s" = "exec systemctl suspend, mode default";
"h" = "exec systemctl hibernate, mode default";
"r" = "exec systemctl reboot, mode default";
"Shift+s" = "exec systemctl shutdown, mode default";
"Return" = "mode default";
"Escape" = "mode default";
};
};
bars = [];
input = {
"*" = {
xkb_layout = "us_gbp_map";
xkb_options = "compose:rctrl,ctrl:nocaps";
};
};
fonts = {
names = [ "Iosevka Comfy"];
style = "Regular";
size = 10.0;
};
terminal = "${pkgs.wezterm}/bin/wezterm";
menu = "${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop --no-generic --dmenu=\"${dmenu}\" --term='${pkgs.wezterm}/bin/wezterm'";
modifier = "Mod4";
startup = [
{ command = "gsettings set org.gnome.desktop.interface cursor-theme 'Quintom_Snow'"; }
{
command = "systemctl --user restart mako";
always = true;
}
{
command = "systemctl --user restart konawall.service";
always = true;
}
];
modes.resize = {
"a" = "resize shrink width 4 px or 4 ppt";
"s" = "resize shrink height 4 px or 4 ppt";
"w" = "resize grow height 4 px or 4 ppt";
"d" = "resize grow width 4 px or 4 ppt";
"Left" = "resize shrink width 4 px or 4 ppt";
"Down" = "resize shrink height 4 px or 4 ppt";
"Up" = "resize grow height 4 px or 4 ppt";
"Right" = "resize grow width 4 px or 4 ppt";
Return = ''mode "default"'';
Escape = ''mode "default"'';
"${cfg.modifier}+z" = ''mode "default"'';
};
window = {
border = 1;
titlebar = false;
};
floating = {
border = 1;
titlebar = false;
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+x" = "exec ${lockCommand}";
# focus windows - regular
"${cfg.modifier}+Left" = "focus left";
"${cfg.modifier}+Down" = "focus down";
"${cfg.modifier}+Up" = "focus up";
"${cfg.modifier}+Right" = "focus right";
# move window / container - regular
"${cfg.modifier}+Shift+Left" = "move left";
"${cfg.modifier}+Shift+Down" = "move down";
"${cfg.modifier}+Shift+Up" = "move up";
"${cfg.modifier}+Shift+Right" = "move right";
# focus output - regular
"${cfg.modifier}+control+Left" = "focus output left";
"${cfg.modifier}+control+Down" = "focus output down";
"${cfg.modifier}+control+Up" = "focus output up";
"${cfg.modifier}+control+Right" = "focus output right";
# move container to output - regular
"${cfg.modifier}+control+Shift+Left" = "move container to output left";
"${cfg.modifier}+control+Shift+Down" = "move container to output down";
"${cfg.modifier}+control+Shift+Up" = "move container to output up";
"${cfg.modifier}+control+Shift+Right" = "move container to output right";
# move workspace to output - regular
"${cfg.modifier}+control+Shift+Mod1+Left" = "move workspace to output left";
"${cfg.modifier}+control+Shift+Mod1+Down" = "move workspace to output down";
"${cfg.modifier}+control+Shift+Mod1+Up" = "move workspace to output up";
"${cfg.modifier}+control+Shift+Mod1+Right" = "move workspace to output right";
# focus parent/child
"${cfg.modifier}+q" = "focus parent";
"${cfg.modifier}+e" = "focus child";
# floating
"${cfg.modifier}+Shift+space" = "floating toggle";
"${cfg.modifier}+space" = "focus mode_toggle";
# workspace history switching
"${cfg.modifier}+Tab" = "workspace back_and_forth";
"${cfg.modifier}+Shift+Tab" = "exec ${config.services.i3gopher.focus-last}";
# multimedia / laptop
"XF86AudioPlay" = "exec --no-startup-id ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioLowerVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioRaiseVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioMute" = "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMute+Shift" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
# dmenu
"${cfg.modifier}+r" = "exec ${cfg.menu}";
# layout handling
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
"${cfg.modifier}+o" = "layout stacking";
"${cfg.modifier}+i" = "layout tabbed";
"${cfg.modifier}+h" = "layout toggle split";
"${cfg.modifier}+f" = "fullscreen";
# sway specific
"${cfg.modifier}+Shift+q" = "kill";
"${cfg.modifier}+Shift+c" = "reload";
# mode triggers
"${cfg.modifier}+Shift+r" = "mode resize";
"${cfg.modifier}+Delete" = ''mode "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"'';
};
colors = let
inherit (config.base16) palette;
in {
focused = {
border = palette.base01;
background = palette.base0D;
text = palette.base07;
indicator = palette.base0D;
childBorder = palette.base0D;
};
focusedInactive = {
border = palette.base02;
background = palette.base04;
text = palette.base00;
indicator = palette.base04;
childBorder = palette.base04;
};
unfocused = {
border = palette.base01;
background = palette.base02;
text = palette.base06;
indicator = palette.base02;
childBorder = palette.base02;
};
urgent = {
border = palette.base03;
background = palette.base08;
text = palette.base00;
indicator = palette.base08;
childBorder = palette.base08;
};
};
};
wrapperFeatures.gtk = true;
extraConfig = ''
hide_edge_borders smart_no_gaps
smart_borders no_gaps
title_align center
seat seat0 xcursor_theme Quintom_Snow 20
workspace_auto_back_and_forth yes
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym ${cfg.modifier}+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym equal gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym equal gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
${workspaceBindingsStr}
'';
};
}

45
kat/gui/swaylock.nix Normal file
View file

@ -0,0 +1,45 @@
{ config, pkgs, ... }: {
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects-develop;
args = {
screenshots = true;
daemonize = true;
show-failed-attempts = true;
indicator = true;
indicator-radius = 110;
indicator-thickness = 8;
font = "Iosevka Comfy";
font-size = "12px";
clock = true;
datestr = "%F";
timestr = "%T";
effect-blur = "5x2";
fade-in = 0.2;
};
colors = with config.base16.palette; {
key-hl = base0C;
separator = base01;
line = base01;
line-clear = base01;
line-caps-lock = base01;
line-ver = base01;
line-wrong = base01;
ring = base00;
ring-clear = base0B;
ring-caps-lock = base09;
ring-ver = base0D;
ring-wrong = base08;
inside = base00;
inside-clear = base00;
inside-caps-lock = base00;
inside-ver = base00;
inside-wrong = base00;
text = base05;
text-clear = base05;
text-caps-lock = base05;
text-ver = base05;
text-wrong = base05;
};
};
}

138
kat/gui/waybar.nix Normal file
View file

@ -0,0 +1,138 @@
{ config, kittywitch, lib, pkgs, nixfiles, ... }:
{
xdg.configFile."waybar/style.css" = { inherit (kittywitch.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; };
programs.waybar = {
enable = true;
systemd.enable = true;
settings = [{
height = 10;
modules-left = [
"sway/workspaces"
"sway/mode"
"sway/window"
];
modules-center = [
];
modules-right = [
"pulseaudio#icon"
"pulseaudio"
"cpu"
"custom/memory-icon"
"memory"
"temperature#icon"
"temperature"
"battery#icon"
"battery"
"backlight#icon"
"backlight"
"network#icon"
"network"
"idle_inhibitor"
"custom/clock"
"tray"
];
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "1:";
"2" = "2:";
"3" = "3:";
};
};
"sway/window" = {
icon = true;
icon-size = 12;
format = "{}";
};
tray = {
icon-size = 12;
spacing = 2;
};
"backlight#icon" = {
format = "{icon}";
format-icons = ["" ""];
};
backlight = {
format = "{percent}%";
};
"custom/cpu-icon".format = "";
cpu.format = "{usage}%";
"custom/memory-icon".format = "";
memory.format = "{percentage}%";
"temperature#icon" = {
format = "{icon}";
format-icons = ["" "" ""];
critical-threshold = 80;
};
temperature = {
format = "{temperatureC}°C";
critical-threshold = 80;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
"battery#icon" = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "";
format-plugged = "";
format-icons = [ "" "" "" "" "" ];
};
battery = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{capacity}%";
format-charging = "{capacity}%";
format-plugged = "{capacity}%";
format-alt = "{time}";
};
"pulseaudio#icon" = {
format = "{icon}";
format-muted = "";
on-click = "wezterm start pulsemixer";
format-icons = {
default = [
""
""
""
];
};
};
pulseaudio = {
format = "{volume}%";
on-click = "${pkgs.wezterm}/bin/wezterm start ${pkgs.pulsemixer}/bin/pulsemixer";
};
"network#icon" = {
format-wifi = "";
format-ethernet = "";
format-linked = " ";
format-disconnected = "";
};
network = {
format-wifi = "{essid} ({signalStrength}%)";
format-ethernet = "{ipaddr}/{cidr}";
format-linked = "No IP";
format-disconnected = "Disconnected";
format-alt = "{ifname}: {ipaddr}/{cidr}";
};
"custom/clock" = {
exec = ''${pkgs.coreutils}/bin/date +"%a, %F %T %Z"'';
interval = 1;
};
}];
};
}

172
kat/gui/waybar.sass Normal file
View file

@ -0,0 +1,172 @@
%extend_1
padding: 0 8px
transition: none
color: $base00
*
border: none
border-radius: 0
background: none
font-family: "Iosevka Comfy", "Font Awesome 6 Free", "Font Awesome 6 Brands"
font-size: $font_size
min-height: 8px
text-shadow: none
box-shadow: none
window#waybar
background: $base00t
tooltip
background: $base00t
label
color: $base07
#mode
background: $base01
color: $base06
padding: 0 4px
#clock, #custom-clock
@extend %extend_1
background: $base01
color: $base07
#cpu, #memory, #temperature, #pulseaudio, #backlight, #battery, #custom-mail, #custom-headset, #clock.arc, #clock.hex, #clock.miku, #network
background: $base01
color: $base07
padding: 0 6px
margin-right: 4px
#custom-gpg-status, #custom-konawall, #idle_inhibitor
margin: 0 4px
#temperature.icon, #pulseaudio.icon, #battery.icon, #backlight.icon, #custom-cpu-icon, #custom-memory-icon, #custom-mail-icon, #custom-headset-icon, #custom-arc-h, #custom-hex-h, #custom-miku-h, #clock.original, #tray, #network.icon
margin-left: 4px
margin-right: 0px
#custom-headset-icon
@extend %extend_1
background: $base06
#custom-memory-icon
@extend %extend_1
background: $base09
#custom-cpu-icon
@extend %extend_1
background: $base08
#temperature.icon
@extend %extend_1
background: $base0B
#pulseaudio.icon
@extend %extend_1
background: $base06
&.muted
background: $base03
#network.icon
@extend %extend_1
background: $base0C
#mpd
@extend %extend_1
#backlight.icon
@extend %extend_1
background: $base0D
#battery.icon
@extend %extend_1
background: $base0C
#custom-mail-icon
@extend %extend_1
background: $base0F
#custom-konawall
@extend %extend_1
&.enabled
background: $base0E
&.disabled
background: $base0D
#custom-gpg-status
@extend %extend_1
&.enabled
background: $base0B
&.disabled
background: $base08
#idle_inhibitor
@extend %extend_1
&.activated
background: $base0E
&.deactivated
background: $base0D
#tray
@extend %extend_1
background: $base01
padding: 0 10px 0 8px
menu
background: $base00t
color: $base07
.modules-left
margin: 0 4px
image
padding-left: 6px
padding-right: 6px
margin-left: 4px
margin-right: 0px
background: $base01
#window
margin-left: 0px
margin-right: 0px
widget
label
margin: 0
&:first-child
margin-left: 0
&:last-child
margin-right: 0
.modules-center
margin: 0 4px
.modules-right
margin: 0 4px
#workspaces
background: $base01
padding: 0
margin-right: 8px
button
color: $base06
&.focused
color: $base07
background: $base0D
&:hover
transition: none
box-shadow: inherit
text-shadow: inherit
background: $base06
color: $base0C
#window
background: $base01
padding: 0 4px
color: $base06
border-bottom: 2px solid transparent
window#waybar.empty #window
opacity: 0

3
kat/gui/wofi.nix Normal file
View file

@ -0,0 +1,3 @@
{ kittywitch, ... }: {
xdg.configFile."wofi/wofi.css" = { inherit (kittywitch.sassTemplate { name = "wofi-style"; src = ./wofi.sass; }) source; };
}

26
kat/gui/wofi.sass Normal file
View file

@ -0,0 +1,26 @@
#scroll
background: $base01
border: 1px solid $base03
#input
background: $base01
border: 1px solid $base0C
margin: 1em
background: $base02
color: $base04
window
font-family: $font
background: $base00t
border-radius: 1em
font-size: $font_size
color: $base07
#outer-box
margin: 1em
#entry
border-bottom: 1px dashed $base04
padding: .75em
&:selected
background-color: $base0D

16
kat/gui/xdg.nix Normal file
View file

@ -0,0 +1,16 @@
_: {
xdg = {
enable = true;
userDirs = {
enable = true;
pictures = "$HOME/pictures";
videos = "$HOME/videos";
documents = "$HOME/docs";
download = "$HOME/downloads";
desktop = "$HOME/desktop";
templates = "$HOME/templates";
publicShare = "$HOME/shared";
music = "$HOME/music";
};
};
}

7
kat/gui/xkb.nix Normal file
View file

@ -0,0 +1,7 @@
_: {
home.file = {
".xkb/symbols/us_gbp_map".source = ./layout.xkb;
};
home.keyboard = null;
}

View file

@ -16,6 +16,7 @@
extraConfig = {
init = {defaultBranch = "main";};
protocol.gcrypt.allow = "always";
merge.conflictstyle = "diff3";
annex = {
autocommit = false;
backend = "BLAKE2B512";

7
lib.nix Normal file
View file

@ -0,0 +1,7 @@
{
inputs,
pkgs,
...
}:
inputs.utils.lib.eachDefaultSystem (system: {
})

68
modules/home/base16.nix Normal file
View file

@ -0,0 +1,68 @@
{ config, pkgs, lib, ... }: let
inherit (lib.types) attrsOf str enum;
inherit (lib.modules) mkIf;
cfg = config.base16;
in with lib; {
options.base16 = {
palette = mkOption {
type = attrsOf str;
};
palette' = mkOption {
type = attrsOf str;
};
sass = {
variables = mkOption {
type = attrsOf str;
default = (cfg.palette // cfg.palette' // {
term_font = "Iosevka Comfy";
font = "Iosevka Comfy";
font_size = "12px";
});
};
css_style = mkOption {
type = enum [ "nested" "compressed" "compact" "expanded" ];
default = "expanded";
};
};
};
config = mkIf (cfg.schemes != {}) {
base16 = {
# TODO: convert to std
palette = lib.mapAttrs' (k: v:
lib.nameValuePair
k
"#${v.hex}")
(lib.filterAttrs (n: _: lib.hasInfix "base" n)
cfg.defaultScheme);
palette' = lib.mapAttrs' (k: v:
lib.nameValuePair
"${k}t"
"rgba(${toString v.red.byte}, ${toString v.green.byte}, ${toString v.blue.byte}, ${toString 0.7})")
(lib.filterAttrs (n: _: lib.hasInfix "base" n)
cfg.defaultScheme);
};
lib.kittywitch.sassTemplate = { name, src }:
let
variables = pkgs.writeText "base-variables.sass" ''
${(concatStringsSep "\n" (mapAttrsToList(var: con: "\$${var}: ${con}") cfg.sass.variables))}
'';
source = pkgs.callPackage
({ sass, stdenv }: stdenv.mkDerivation {
inherit name src variables;
nativeBuildInputs = lib.singleton sass;
phases = [ "buildPhase" ];
buildPhase = ''
cat $variables $src > src-mut.sass
sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style}
'';
})
{ };
in
{
inherit source;
text = builtins.readFile source;
};
_module.args = { inherit (config.lib) kittywitch; };
};
}

9
nixos/common/base16.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, ... }: {
base16 = {
inherit (config.home-manager.users.kat.base16) defaultSchemeName defaultScheme schemes;
console = {
enable = true;
getty.enable = true;
};
};
}

29
nixos/common/boot.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, std, ... }: let
inherit (lib.modules) mkDefault mkIf mkMerge;
inherit (std) list;
in {
boot = mkMerge [
({
kernel.sysctl = {
"fs.inotify.max_user_watches" = 524288;
"net.core.rmem_max" = 16777216;
"net.core.wmem_max" = 16777216;
"net.ipv4.tcp_rmem" = "4096 87380 16777216";
"net.ipv4.tcp_wmem" = "4096 65536 16777216";
"net.ipv4.ip_forward" = "1";
"net.ipv6.conf.all.forwarding" = "1";
};
loader = {
grub.configurationLimit = 8;
systemd-boot.configurationLimit = 8;
};
tmpOnTmpfs = true;
tmpOnTmpfsSize = "80%";
kernelPackages = mkIf (list.elem "zfs" config.boot.supportedFilesystems) (mkDefault config.boot.zfs.package.latestCompatibleLinuxPackages);
})
(mkIf (list.elem "zfs" config.boot.supportedFilesystems) {
kernelPackages = mkDefault config.boot.zfs.package.latestCompatibleLinuxPackages;
zfs.enableUnstable = true;
})
];
}

3
nixos/common/docs.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
documentation.nixos.enable = false;
}

10
nixos/common/getty.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, std, ... }: let
inherit (std) string;
inherit (lib.modules) mkForce;
in
{
console = {
font = "Tamzen7x14";
earlySetup = true;
};
}

View file

@ -1,6 +0,0 @@
_: {
boot.loader = {
grub.configurationLimit = 8;
systemd-boot.configurationLimit = 8;
};
}

20
nixos/common/locale.nix Normal file
View file

@ -0,0 +1,20 @@
{ pkgs, ... }: {
fonts.fonts = [
pkgs.tamzen
];
i18n = {
defaultLocale = "en_CA.UTF-8";
supportedLocales = [
"en_CA.UTF-8/UTF-8"
"en_GB.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
"en_DK.UTF-8/UTF-8"
];
};
console = {
packages = [ pkgs.tamzen ];
font = "Tamzen7x14";
earlySetup = true;
keyMap = "uk";
};
}

3
nixos/common/network.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
networking.nftables.enable = true;
}

6
nixos/common/shell.nix Normal file
View file

@ -0,0 +1,6 @@
_: {
programs.zsh = {
enable = true;
enableCompletion = true;
};
}

26
nixos/common/ssh.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, lib, std, ... }: let
inherit (lib.modules) mkDefault;
inherit (std) list;
in {
networking.firewall = {
allowedTCPPorts = [ (list.unsafeHead config.services.openssh.ports) ];
allowedUDPPortRanges = [ { from = 60000; to = 61000; } ];
};
services.openssh = {
enable = true;
kexAlgorithms = [ "curve25519-sha256@libssh.org" ];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = mkDefault "prohibit-password";
};
extraConfig = ''
PubkeyAcceptedAlgorithms +ssh-rsa
StreamLocalBindUnlink yes
LogLevel VERBOSE
'';
};
programs.mosh.enable = true;
}

12
nixos/common/time.nix Normal file
View file

@ -0,0 +1,12 @@
_: {
services.tzupdate.enable = true;
systemd.timers."tzupdate" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "5m";
Unit = "tzupdate.service";
};
};
}

3
nixos/common/users.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
users.mutableUsers = false;
}

View file

@ -1,17 +0,0 @@
{pkgs, ...}: {
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
environment.systemPackages = with pkgs.gnomeExtensions; [
dash-to-dock
gsconnect
appindicator
];
services.udev.packages = with pkgs.gnome; [
gnome-settings-daemon
];
}

22
nixos/gui/fonts.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs, ... }: {
fonts = {
fonts = (with pkgs; [
twitter-color-emoji
]) ++ (with pkgs.iosevka-comfy; [
comfy
comfy-motion
comfy-wide
]);
enableDefaultFonts = true;
fontDir.enable = true;
fontconfig = {
enable = true;
allowBitmaps = true;
defaultFonts = {
emoji = [
"Twitter Color Emoji"
];
};
};
};
}

10
nixos/gui/gpg.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, ... }: {
services.pcscd.enable = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "gtk2";
};
}

3
nixos/gui/nfs.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
boot.supportedFilesystems = [ "nfs" ];
}

6
nixos/gui/packages.nix Normal file
View file

@ -0,0 +1,6 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
android-udev-rules
jmtpfs
];
}

7
nixos/gui/qt.nix Normal file
View file

@ -0,0 +1,7 @@
_: {
qt = {
enable = true;
style = "adwaita-dark";
platformTheme = "gnome";
};
}

52
nixos/gui/sound.nix Normal file
View file

@ -0,0 +1,52 @@
{ pkgs, ... }: {
sound = {
enable = true;
extraConfig = ''
defaults.pcm.rate_converter "speexrate_best"
'';
};
environment.systemPackages = with pkgs; [ pulsemixer bluez5-experimental ];
security.rtkit.enable = true;
environment.etc = {
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
services.pipewire = {
enable = true;
config = {
pipewire = {
"context.properties" = {
"log.level" = 2;
"default.clock.min-quantum" =
32; # default; going lower may cause crackles and distorted audio
};
pipewire-pulse = {
"context.modules" = [{
name = "libpipewire-module-protocol-pulse";
args = {
"pulse.min.quantum" = 32; # controls minimum playback quant
"pulse.min.req" = 32; # controls minimum recording quant
"pulse.min.frag" = 32; # controls minimum fragment size
"server.address" =
[ "unix:native" ]; # the default address of the server
};
}];
};
};
};
pulse.enable = true;
alsa.support32Bit = true;
jack.enable = true;
alsa.enable = true;
};
}

9
nixos/gui/sway.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, pkgs, std, lib, ... }: let
inherit (std) set list;
inherit (lib.modules) mkForce;
in {
programs.sway = {
enable = list.any (user: user.wayland.windowManager.sway.enable) (set.values config.home-manager.users);
extraPackages = with pkgs; mkForce [ xwayland swaylock swayidle swaylock-fancy wmctrl ];
};
}

11
nixos/gui/xdg-portals.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs, ... }: {
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
};
};
}

View file

@ -1,12 +1,12 @@
{inputs}: let
inherit (inputs.nixpkgs) lib;
std = import ./std.nix {inherit inputs;};
tree = import ./tree.nix {inherit inputs;};
lib = inputs.nixpkgs.lib;
systems = import ./systems {inherit inputs tree lib std;};
shells = import ./shells {inherit inputs tree lib std pkgs;};
inherit (import ./pkgs.nix {inherit inputs tree lib;}) pkgs;
inherit (import ./pkgs.nix {inherit inputs tree;}) pkgs;
formatter = import ./formatter.nix {inherit inputs pkgs;};
inherit (std) set;
checks = set.map (_: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib;
in
{inherit inputs tree lib std pkgs checks formatter;} // systems // shells
{inherit inputs tree std pkgs checks formatter lib;} // systems // shells

View file

@ -1,9 +1,8 @@
{
lib,
tree,
inputs,
...
}: let
overlays = import tree.overlays {inherit inputs;};
in
inputs.utils.lib.eachDefaultSystem (system: {pkgs = import inputs.nixpkgs {inherit system overlays;};})
inputs.utils.lib.eachDefaultSystem (system: {pkgs = import inputs.nixpkgs { inherit system overlays; config.allowUnfree = true; };})

View file

@ -77,7 +77,15 @@
];
builder =
{
nixos = inputs.nixpkgs.lib.nixosSystem;
nixos = let
lib = inputs.nixpkgs.lib.extend (self: super: import (inputs.arcexprs + "/lib") {
inherit super;
lib = self;
isOverlayLib = true;
});
in args: lib.nixosSystem ({
inherit lib;
} // args);
darwin = inputs.darwin.lib.darwinSystem;
macos = inputs.darwin.lib.darwinSystem;
}

View file

@ -1,7 +1,8 @@
_: let
hostConfig = {tree, ...}: {
imports = with tree; [
nixos.gnome
nixos.gui
kat.gui
];
fileSystems = {

View file

@ -68,6 +68,9 @@
]
++ (with (import (inputs.arcexprs + "/modules")).home-manager; [
base16
swaylock
i3gopher
konawall
]);
};
};