about summary refs log tree commit diff stats
path: root/modules/home.legacy/wms/river/default.nix
blob: 274b92237e60e0524d3e5041829f8154fd4fe036 (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
{
  pkgs,
  sysLib,
  river_init_lesser,
  nixosConfig,
  system,
  ...
}: let
  inherit (nixosConfig.networking) hostName;
  mappings =
    if hostName == "tiamat"
    then ''
      err_fail riverctl keyboard-layout 'us-modified'
      err_fail river_init_lesser ~/.config/river/res/moonlander.ron
    ''
    else if hostName == "lahmu" || hostName == "apzu" || hostName == "mammun" || hostName == "isimud"
    then ''
      err_fail riverctl keyboard-layout 'dvorak-modified'
      err_fail river_init_lesser ~/.config/river/res/keys.ron
    ''
    else builtins.throw "Host not covered in river mappings";
  screen_setup =
    if hostName == "lahmu"
    then ''
      err_fail wlr-randr --output Virtual-1 --mode 1920x1080
    ''
    else if hostName == "tiamat"
    then ''
      err_fail wlr-randr --output DP-2 --pos 2560,0
      err_fail wlr-randr --output DP-1 --scale 1.5 --pos 0,0
      err_fail gammastep &
    ''
    else if hostName == "apzu" || hostName == "mammun" || hostName == "isimud"
    then ''
      err_fail gammastep &
    ''
    else builtins.throw "Host not covered in river screen setup";
  env_vars = "XDG_CURRENT_DESKTOP=river DESKTOP_SESSION=river";
  init_scr = pkgs.substituteAll {
    src = ./init.sh;
    inherit mappings screen_setup env_vars;
  };
in {
  home.sessionVariables = {
    WM = "river";
    XDG_CURRENT_DESKTOP = "river";
    DESKTOP_SESSION = "river";

    # Export Wayland env Vars {{{
    QT_QPA_PLATFORM = "wayland";
    QT_QPA_PLATFORMTHEME = "qt5ct"; # needs qt5ct
    CLUTTER_BACKEND = "wayland";
    SDL_VIDEODRIVER = "wayland"; # might brake some things
    # }}}
  };

  xdg.configFile."river/init".source =
    sysLib.writeShellScript {
      name = "river_init";
      src = init_scr;
      keepPath = true;
      dependencies = builtins.attrValues {
        river_init_lesser = river_init_lesser.packages.${system}.default;
        inherit
          (pkgs)
          dash
          river
          glib # gnome lib
          gammastep
          wlr-randr
          yambar
          mako
          swaybg
          swayidle
          swaylock
          alacritty
          ;
      };
    }
    + /bin/river_init;

  # TODO: These mappings should be generated in nix. (Which would allow to replace the
  # `mpc` pat adding.) <2024-11-16>

  # Needed for the key-mappings.
  home.packages = [pkgs.mpc];
  xdg.configFile."river/res".source = ./res;
}