summaryrefslogtreecommitdiff
path: root/features/wayland.nix
blob: b21534dd7ae66dbf9ba508120b10f2d0f170a9c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{ config, pkgs, lib, ... }:

let
  # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
  dbus-xdp-environment = pkgs.writeTextFile {
    name = "dbus-xdp-environment";
    destination = "/bin/dbus-xdp-environment";
    executable = true;

    text = ''
        dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=wlroots
        systemctl --user stop pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr
        systemctl --user start pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr
      '';
  };

  # gtk theming: https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
  # for gsettings to work, we need to tell it where the schemas are
  # using the XDG_DATA_DIR environment variable
  configure-gtk = pkgs.writeTextFile {
      name = "configure-gtk";
      destination = "/bin/configure-gtk";
      executable = true;
      text = let
        schema = pkgs.gsettings-desktop-schemas;
        datadir = "${schema}/share/gsettings-schemas/${schema.name}";
      in
        ''
          export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
          gnome_schema=org.gnome.desktop.interface
          gsettings set $gnome_schema gtk-theme 'Dracula'
        '';
  };

  dwl-sinan = with pkgs; dwl.overrideAttrs (oldAttrs: {
    name = "dwl-sinan";
    src = fetchgit {
      url = "https://git.sinanmohd.com/dwl";
      rev = "f708547efb0b3afe4149f6eb7bcc685fc39f351a";
      sha256 = "04rb90hasicm4aj51403hjxyyszm87qiqz6phrjy3364vkqvrx3c";
    };
  });
in
{
  # pkgs
  environment.systemPackages = with pkgs; [
    dwl-sinan
    zathura
    pinentry-gnome
    mpv
    qemu
    OVMFFull
    element-desktop
    firefox
    dbus-xdp-environment
    swaylock
    swayidle
    swaybg
    foot
    grim
    slurp
    wl-clipboard
    wmenu
    mako
    wayland
    xdg-utils
    imv
    libnotify
    wob
    wlr-randr
    tor-browser-bundle-bin
    wtype
    # gtk
    configure-gtk
    dracula-theme # gtk theme
    gnome3.adwaita-icon-theme  # default gnome cursors
    glib # gsettings
  ];

  # xdg desktop portal
  services.dbus.enable = true;
  xdg.portal = {
    enable = true;
    wlr.enable = true;
    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
  };

  # font
  fonts = {
    fonts = [ pkgs.terminus-nerdfont pkgs.dm-sans ];
    enableDefaultFonts = true;
    fontconfig = {
      hinting.style = "hintfull";
      defaultFonts = {
        monospace = [ "Terminess Nerd Font" ];
        serif = [ "DeepMind Sans" ];
        sansSerif = [ "DeepMind Sans" ];
      };
    };
  };

  # misc
  security.polkit.enable = true;
  hardware.opengl.enable = true;
  programs.dconf.enable = true;
  programs.xwayland.enable = true;
  programs.gnupg.agent = {
    enable = true;
    pinentryFlavor = "gnome3";
  };
}