greenhouse

kore

my public infrastructure monorepo

git clone [email protected]:kore.git

kore / nixos / roles / desktop.nix98 lines · 2087B · raw

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