dotfiles/hm/desktop/default.nix

298 lines
10 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
2023-12-08 22:44:21 +01:00
let
2024-01-06 18:40:20 +01:00
nixGLIntelPrefix = "${pkgs.nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ";
2023-12-08 22:44:21 +01:00
wmPrefix = "${lib.optionalString config.frogeye.desktop.nixGLIntel nixGLIntelPrefix}";
in
2023-10-28 22:09:36 +02:00
{
2023-12-08 22:44:21 +01:00
imports = [
./frobar
2024-01-07 23:29:16 +01:00
./i3.nix
2024-01-07 22:38:42 +01:00
./qutebrowser.nix
2023-12-08 22:44:21 +01:00
];
2023-11-22 14:05:48 +01:00
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.shellAliases = {
noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise'';
beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null'';
2023-12-08 22:44:21 +01:00
x = "startx ${config.home.homeDirectory}/${config.xsession.scriptPath}; logout";
};
2023-11-22 14:05:48 +01:00
xsession = {
enable = true;
2023-12-08 22:44:21 +01:00
# Not using config.xdg.configHome because it needs to be $HOME-relative paths and path manipulation is hard
scriptPath = ".config/xsession";
profilePath = ".config/xprofile";
2023-11-22 14:05:48 +01:00
windowManager = {
2023-12-08 22:44:21 +01:00
command = lib.mkForce "${wmPrefix} ${config.xsession.windowManager.i3.package}/bin/i3";
2024-01-07 23:29:16 +01:00
i3.enable = true;
2023-11-03 18:18:38 +01:00
};
2023-12-04 22:47:02 +01:00
numlock.enable = config.frogeye.desktop.numlock;
2023-11-05 21:32:31 +01:00
};
2023-10-29 00:49:22 +02:00
2023-11-22 14:05:48 +01:00
programs = {
# Terminal
alacritty = {
2023-12-04 22:47:02 +01:00
# TODO Emojis. Or maybe they work on NixOS?
# Arch (working) shows this with alacritty -vvv:
# [TRACE] [crossfont] Got font path="/usr/share/fonts/twemoji/twemoji.ttf", index=0
# [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: MONOCHROME | TARGET_MONO | COLOR, render_mode: "Mono", lcd_filter: 1 }
# Nix (not working) shows this:
# [TRACE] [crossfont] Got font path="/nix/store/872g3w9vcr5nh93r0m83a3yzmpvd2qrj-home-manager-path/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf", index=0
# [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | COLOR, render_mode: "Lcd", lcd_filter: 1 }
2023-11-22 14:05:48 +01:00
enable = true;
settings = {
bell = {
animation = "EaseOutExpo";
color = "#000000";
command = { program = "${pkgs.sox}/bin/play"; args = [ "-n" "synth" "sine" "C5" "sine" "E4" "remix" "1-2" "fade" "0.1" "0.2" "0.1" ]; };
duration = 100;
};
cursor = { vi_mode_style = "Underline"; };
2023-12-04 22:47:02 +01:00
env = {
WINIT_X11_SCALE_FACTOR = "1";
# Prevents Alacritty from resizing from one monitor to another.
# Might cause issue on HiDPI screens but we'll get there when we get there
};
2023-11-22 14:05:48 +01:00
hints = {
enabled = [
{
binding = { mods = "Control|Alt"; key = "F"; };
command = "${pkgs.xdg-utils}/bin/xdg-open";
mouse = { enabled = true; mods = "Control"; };
post_processing = true;
regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\\\s{-}\\\\^`]+";
}
];
};
key_bindings = [
{ mode = "~Search"; mods = "Alt|Control"; key = "Space"; action = "ToggleViMode"; }
{ mode = "Vi|~Search"; mods = "Control"; key = "K"; action = "ScrollHalfPageUp"; }
{ mode = "Vi|~Search"; mods = "Control"; key = "J"; action = "ScrollHalfPageDown"; }
{ mode = "~Vi"; mods = "Control|Alt"; key = "V"; action = "Paste"; }
{ mods = "Control|Alt"; key = "C"; action = "Copy"; }
{ mode = "~Search"; mods = "Control|Alt"; key = "F"; action = "SearchForward"; }
{ mode = "~Search"; mods = "Control|Alt"; key = "B"; action = "SearchBackward"; }
{ mode = "Vi|~Search"; mods = "Control|Alt"; key = "C"; action = "ClearSelection"; }
2023-11-02 21:57:06 +01:00
];
2023-11-22 14:05:48 +01:00
window = {
dynamic_padding = false;
dynamic_title = true;
};
2023-11-02 21:57:06 +01:00
};
};
2023-11-22 14:05:48 +01:00
# Backup terminal
urxvt = {
enable = true;
package = pkgs.rxvt-unicode-emoji;
scroll = {
bar.enable = false;
};
iso14755 = false; # Disable Ctrl+Shift default bindings
keybindings = {
"Shift-Control-C" = "eval:selection_to_clipboard";
"Shift-Control-V" = "eval:paste_clipboard";
# TODO Not sure resizing works, Nix doesn't have the package (urxvt-resize-font-git on Arch)
"Control-KP_Subtract" = "resize-font:smaller";
"Control-KP_Add" = "resize-font:bigger";
};
extraConfig = {
"letterSpace" = 0;
"perl-ext-common" = "resize-font,bell-command,readline,selection";
"bell-command" = "${pkgs.sox}/bin/play -n synth sine C5 sine E4 remix 1-2 fade 0.1 0.2 0.1 &> /dev/null";
};
2023-11-19 23:19:03 +01:00
};
2023-11-22 14:05:48 +01:00
rofi = {
# TODO This theme template, that was used for Arch, looks much better:
# https://gitlab.com/jordiorlando/base16-rofi/-/blob/master/templates/default.mustache
2023-11-22 14:05:48 +01:00
enable = true;
pass.enable = true;
extraConfig = {
lazy-grab = false;
matching = "regex";
};
2023-11-19 21:48:35 +01:00
};
autorandr = {
enable = true;
2023-12-08 22:44:21 +01:00
hooks.postswitch = {
2023-12-16 17:06:04 +01:00
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
2023-12-08 22:44:21 +01:00
};
};
2023-11-22 14:05:48 +01:00
mpv = {
enable = true;
config = {
audio-display = false;
save-position-on-quit = true;
2023-12-18 19:32:16 +01:00
osc = false; # Required by thumbnail script
# Hardware acceleration (from https://nixos.wiki/wiki/Accelerated_Video_Playback#MPV)
hwdec = "auto-safe";
vo = "gpu";
profile = "gpu-hq";
2023-11-22 14:05:48 +01:00
};
scripts = with pkgs.mpvScripts; [ thumbnail ];
scriptOpts = {
mpv_thumbnail_script = {
autogenerate = false; # TODO It creates too many processes at once, crashing the system
2023-11-22 14:05:48 +01:00
cache_directory = "/tmp/mpv_thumbs_${config.home.username}";
2023-12-18 19:32:16 +01:00
mpv_hwdec = "auto-safe";
2023-11-22 14:05:48 +01:00
};
2023-11-19 21:48:35 +01:00
};
};
2024-01-07 23:29:16 +01:00
qutebrowser.enable = true;
2023-11-19 21:48:35 +01:00
};
2023-11-05 14:32:01 +01:00
2023-11-22 14:05:48 +01:00
xdg = {
userDirs = {
enable = true; # TODO Which ones do we want?
createDirectories = true;
# French, because then it there's a different initial for each, making navigation easier
desktop = null;
download = "${config.home.homeDirectory}/Téléchargements";
music = "${config.home.homeDirectory}/Musiques";
pictures = "${config.home.homeDirectory}/Images";
publicShare = null;
templates = null;
videos = "${config.home.homeDirectory}/Vidéos";
extraConfig = {
XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Screenshots";
};
2023-11-19 22:41:09 +01:00
};
2023-11-22 14:05:48 +01:00
configFile = {
"pulse/client.conf" = {
text = ''cookie-file = .config/pulse/pulse-cookie'';
};
"rofimoji.rc" = {
text = ''
skin-tone = neutral
files = [emojis, math]
action = clipboard
2023-11-19 22:41:09 +01:00
'';
};
2023-11-26 22:45:07 +01:00
"vimpc/vimpcrc" = {
text = ''
map FF :browse<C-M>gg/
map à :set add next<C-M>a:set add end<C-M>
map @ :set add next<C-M>a:set add end<C-M>:next<C-M>
map ° D:browse<C-M>A:shuffle<C-M>:play<C-M>:playlist<C-M>
set songformat {%a - %b: %t}|{%f}$E$R $H[$H%l$H]$H
set libraryformat %n \| {%t}|{%f}$E$R $H[$H%l$H]$H
set ignorecase
set sort library
'';
};
2023-11-19 23:19:03 +01:00
};
2023-11-19 22:41:09 +01:00
};
2023-11-22 14:05:48 +01:00
services = {
2023-12-16 17:07:44 +01:00
blueman-applet.enable = true;
2023-11-22 14:05:48 +01:00
unclutter.enable = true;
dunst =
{
enable = true;
settings =
# TODO Change dmenu for rofi, so we can use context
with config.lib.stylix.colors.withHashtag; {
global = {
separator_color = lib.mkForce base05;
idle_threshold = 120;
markup = "full";
max_icon_size = 48;
# TODO Those shortcuts don't seem to work, maybe try:
# > define shortcuts inside your window manager and bind them to dunstctl(1) commands
close_all = "ctrl+mod4+n";
close = "mod4+n";
context = "mod1+mod4+n";
history = "shift+mod4+n";
};
2023-11-05 15:52:09 +01:00
2023-11-22 14:05:48 +01:00
urgency_low = {
background = lib.mkForce base01;
foreground = lib.mkForce base03;
frame_color = lib.mkForce base05;
};
urgency_normal = {
background = lib.mkForce base02;
foreground = lib.mkForce base05;
frame_color = lib.mkForce base05;
};
urgency_critical = {
background = lib.mkForce base08;
foreground = lib.mkForce base06;
frame_color = lib.mkForce base05;
};
2023-11-05 15:52:09 +01:00
};
2023-11-22 14:05:48 +01:00
};
mpd = {
enable = true;
network = {
listenAddress = "0.0.0.0"; # So it can be controlled from home
# TODO ... and whoever is the Wi-Fi network I'm using, which, not great
startWhenNeeded = true;
};
extraConfig = ''
restore_paused "yes"
'';
2023-11-19 21:28:42 +01:00
};
2023-11-22 14:05:48 +01:00
autorandr.enable = true;
2023-11-19 21:28:42 +01:00
};
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
home = {
2023-12-25 11:04:01 +01:00
file = {
2024-01-05 18:41:10 +01:00
".face" = {
# TODO Only works on pindakaas? See https://wiki.archlinux.org/title/LightDM#Changing_your_avatar
2023-12-25 11:04:01 +01:00
source = pkgs.runCommand "face.png" { } "${pkgs.inkscape}/bin/inkscape ${./face.svg} -w 1024 -o $out";
};
};
2023-11-22 14:05:48 +01:00
packages = with pkgs; [
2023-12-16 22:39:11 +01:00
pavucontrol # Because can't use Win+F1X on Pinebook 🙃
2023-11-22 14:05:48 +01:00
# remote
tigervnc
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# music
mpc-cli
ashuffle
vimpc
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# multimedia common
gimp
inkscape
libreoffice
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# data management
freefilesync
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# browsers
firefox
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# fonts
dejavu_fonts
twemoji-color-font
gnome.gedit
feh
zbar
zathura
meld
python3Packages.magic
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# x11-exclusive
numlockx
simplescreenrecorder
trayer
xclip
keynav
xorg.xinit
# TODO Make this clean. Service?
2023-10-28 22:09:36 +02:00
2023-11-22 14:05:48 +01:00
# organisation
pass
thunderbird
];
sessionVariables = {
MPD_PORT = "${toString config.services.mpd.network.port}";
2023-12-04 22:47:02 +01:00
ALSA_PLUGIN_DIR = "${pkgs.alsa-plugins}/lib/alsa-lib"; # Fixes an issue with sox (Cannot open shared library libasound_module_pcm_pulse.so)
# UPST Patch this upstream like: https://github.com/NixOS/nixpkgs/blob/216b111fb87091632d077898df647d1438fc2edb/pkgs/applications/audio/espeak-ng/default.nix#L84
2023-11-22 14:05:48 +01:00
};
2023-11-19 21:28:42 +01:00
};
2023-11-05 21:32:31 +01:00
};
2023-10-28 22:09:36 +02:00
}