~ruther/nixos-config

ref: 38ce94f0f3f51277d0772c9995a1dc955f704c0e nixos-config/nixos/isos/dwl-installation.nix -rw-r--r-- 2.8 KiB
38ce94f0 — Frantisek Bohacek feat: add dwl iso image 10 months ago
                                                                                
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
{ config, lib, pkgs, modulesPath, ... }:

let
  inherit (config.deps-inject.inputs) self;

  dwl-startup = pkgs.writeShellScript "dwl-startup" ''
    exec &<-
    dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DISPLAY
    systemctl start --user dwl-session.target
  '';

  dwl-start = pkgs.writeShellScript "dwl-start" ''
    export XDG_CURRENT_DESKTOP=wlroots XDG_BACKEND=wayland QT_QPA_PLATFORM=wayland MOZ_ENABLE_WAYLAND=1 _JAVA_AWT_WM_NONREPARENTING=1
    @dwl@ -s "${dwl-startup}"
    systemctl stop --user dwl-session.target
  '';
in {
  imports = [
    (modulesPath + "/installer/cd-dvd/installation-cd-graphical-base.nix")
    ./common
  ];

  services.xserver.enable = lib.mkForce false;

  environment.systemPackages = [
    # Clipboard
    pkgs.cliphist
    pkgs.wl-clipboard
    # PrintScreening
    pkgs.grim
    pkgs.slurp
    # pkgs.wldash
    pkgs.imv
    # DWL control
    self.packages.${pkgs.system}.dwlb
    self.packages.${pkgs.system}.dwlmsg
    pkgs.wlr-randr
    pkgs.wlrctl
    pkgs.wlopm

    pkgs.rofi-wayland

    (
      pkgs.symlinkJoin {
        name = "dwl";
        paths = [ self.packages.${pkgs.system}.dwl ];
        postBuild = ''
          dwlPath=$(readlink $out/bin/dwl)
          cp -f ${dwl-start} $out/bin/dwl
          substituteInPlace $out/bin/dwl \
            --replace-fail "@dwl@" "$dwlPath"
        '';
      }
    )
  ];

  boot.plymouth.enable = lib.mkForce false;
  hardware.bluetooth.enable = true;
  services.blueman.enable = true;
  services.power-profiles-daemon.enable = true;
  programs.nm-applet.enable = true;

  systemd.user.targets.dwl-session = {
    requires = [ "graphical-session.target" ];
    partOf = [ "graphical-session.target" ];
  };

  xdg.portal = {
    enable = true;
    extraPortals = [
      pkgs.xdg-desktop-portal-wlr
      pkgs.xdg-desktop-portal-gtk
    ];
    config = {
      wlroots = {
        default = [ "gtk" "wlr" ];
        "org.freedesktop.impl.portal.ScreenCast" = "wlr";
        "org.freedesktop.impl.portal.Screenshot" = "wlr";
        # https://github.com/labwc/labwc/discussions/1503
        "org.freedesktop.impl.portal.Inhibit" = "none";
      };
    };
  };

  programs.waybar = {
    enable = true;
    package = pkgs.waybar.overrideAttrs (oldAttrs: {
      patches = (oldAttrs.patches or []) ++ [
        (pkgs.fetchpatch {
          url = "https://github.com/Rutherther/Waybar/commit/98b08880409cfd1277dc491b2f89de39a5107e50.patch";
          hash = "sha256-qnMnjL8ejGEO9SeIEclez1OISY7poKimr4Hu+ngKnxA=";
        })
      ];
    });
  };

  systemd.user.tmpfiles.rules = [
    "L+ %h/.config/waybar/style.css - - - - ${self + "/home/modules/profiles/desktop/dwl/waybar/style.css"}"
    "L+ %h/.config/waybar/config.jsonc - - - - ${self + "/home/modules/profiles/desktop/dwl/waybar/config.jsonc"}"
  ];
}
Do not follow this link