kore / nixos / roles / desktop.nix113 lines · 2577B · 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 security.pam.services.swaylock = { };
33
34 programs.dconf.enable = true;
35
36 environment.loginShellInit = ''
37 if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = /dev/tty1 ]; then
38 /etc/xdg/dwl-session
39 systemctl --user stop dwl-session.target
40 exit
41 fi
42 '';
43
44 xdg = {
45 autostart.enable = true;
46 icons.enable = true;
47 mime.enable = true;
48 sounds.enable = true;
49
50 portal = {
51 enable = true;
52 extraPortals = [ pkgs.xdg-desktop-portal-wlr ];
53 configPackages = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];
54
55 wlr = {
56 enable = true;
57 settings.screencast = {
58 chooser_type = "dmenu";
59 chooser_cmd = lib.concatStringsSep " " [
60 (lib.getExe pkgs.wmenu) "-p share" "-f 'Fantasque Sans Mono 11'"
61 "-N ${c.bg}" "-n ${c.fg}" "-M ${c.bg}" "-m ${c.green}" "-S ${c.surface}" "-s ${c.fg}"
62 ];
63 };
64 };
65
66 config.common = {
67 default = [ "wlr" ];
68 };
69 };
70 };
71
72 fonts = {
73 enableDefaultPackages = false;
74
75 packages = with pkgs; [
76 noto-fonts
77 noto-fonts-cjk-sans
78 noto-fonts-cjk-serif
79 noto-fonts-color-emoji
80
81 fantasque-sans-mono
82 ];
83
84 fontconfig = {
85 hinting.autohint = true;
86
87 defaultFonts = {
88 serif = [ "Noto Serif" "Noto Color Emoji" ];
89 sansSerif = [ "Noto Sans" "Noto Color Emoji" ];
90 monospace = [ "Fantasque Sans Mono" "Noto Color Emoji" ];
91 emoji = [ "Noto Color Emoji" ];
92 };
93 };
94 };
95
96 services = {
97 openssh.enable = false;
98
99 udisks2.enable = true;
100
101 pipewire = {
102 enable = true;
103
104 alsa.enable = true;
105 alsa.support32Bit = true;
106
107 pulse.enable = true;
108 jack.enable = true;
109
110 wireplumber.enable = true;
111 };
112 };
113}