greenhouse

kore

my public infrastructure monorepo

git clone [email protected]:kore.git

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