kore / nixos / roles / desktop.nix109 lines · 2503B · raw
1{ lib, pkgs, outputs, ... }:
2
3let
4 c = lib.mapAttrs (_: lib.removePrefix "#") outputs.palette.colors;
5
6 garden-status = pkgs.writeShellApplication {
7 name = "garden-status";
8 runtimeInputs = [ pkgs.coreutils ];
9 text = ''
10 while :; do
11 case "$(date +%-H)" in
12 5|6) tod=dawn ;;
13 7|8|9|10) tod=morning ;;
14 11|12|13) tod=noon ;;
15 14|15|16) tod=afternoon ;;
16 17|18) tod=dusk ;;
17 19|20|21) tod=eventide ;;
18 *) tod=night ;;
19 esac
20 line="$(date "+%a %-d %b ยท $tod %H:%M")"
21 printf '%s\n' "''${line,,}"
22 sleep "$((60 - $(date +%-S)))"
23 done
24 '';
25 };
26in {
27 programs.dwl = {
28 enable = true;
29 extraSessionCommands = "exec < <(${lib.getExe garden-status})";
30 };
31
32 environment.loginShellInit = ''
33 if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = /dev/tty1 ]; then
34 /etc/xdg/dwl-session
35 systemctl --user stop dwl-session.target
36 exit
37 fi
38 '';
39
40 xdg = {
41 autostart.enable = true;
42 icons.enable = true;
43 mime.enable = true;
44 sounds.enable = true;
45
46 portal = {
47 enable = true;
48 extraPortals = [ pkgs.xdg-desktop-portal-wlr ];
49 configPackages = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];
50
51 wlr = {
52 enable = true;
53 settings.screencast = {
54 chooser_type = "dmenu";
55 chooser_cmd = lib.concatStringsSep " " [
56 (lib.getExe pkgs.wmenu) "-p share" "-f 'Fantasque Sans Mono 11'"
57 "-N ${c.bg}" "-n ${c.fg}" "-M ${c.bg}" "-m ${c.green}" "-S ${c.surface}" "-s ${c.fg}"
58 ];
59 };
60 };
61
62 config.common = {
63 default = [ "wlr" ];
64 };
65 };
66 };
67
68 fonts = {
69 enableDefaultPackages = false;
70
71 packages = with pkgs; [
72 noto-fonts
73 noto-fonts-cjk-sans
74 noto-fonts-cjk-serif
75 noto-fonts-color-emoji
76
77 fantasque-sans-mono
78 ];
79
80 fontconfig = {
81 hinting.autohint = true;
82
83 defaultFonts = {
84 serif = [ "Noto Serif" "Noto Color Emoji" ];
85 sansSerif = [ "Noto Sans" "Noto Color Emoji" ];
86 monospace = [ "Fantasque Sans Mono" "Noto Color Emoji" ];
87 emoji = [ "Noto Color Emoji" ];
88 };
89 };
90 };
91
92 services = {
93 openssh.enable = false;
94
95 udisks2.enable = true;
96
97 pipewire = {
98 enable = true;
99
100 alsa.enable = true;
101 alsa.support32Bit = true;
102
103 pulse.enable = true;
104 jack.enable = true;
105
106 wireplumber.enable = true;
107 };
108 };
109}