Commit 18ae903b0dff

Vincent Demeester <vincent@sbr.pm>
2025-09-20 21:59:05
systems and home: update niri configuration
- uses niri flake - move things around Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 6154b81
Changed files (8)
home/common/desktop/niri/default.nix
@@ -0,0 +1,39 @@
+{ config, pkgs, ... }:
+{
+  imports = [
+    ../sway/mako.nix
+    ../sway/swayidle.nix
+    ../sway/rofi.nix
+  ];
+
+  home.packages = with pkgs; [
+    pinentry-gnome3
+    wf-recorder
+    wl-clipboard
+    wl-kbptr
+    wtype
+    wlprop
+
+    zenity
+    wofi
+    swaybg
+  ];
+
+  services = {
+    avizo.enable = true;
+    wlsunset = {
+      enable = true;
+      latitude = "48.87";
+      longitude = "2.33";
+    };
+    cliphist = {
+      enable = true;
+      package = pkgs.cliphist;
+    };
+  };
+  programs.niri = {
+    enable = true;
+    package = pkgs.niri-stable;
+    config = null; # FIXME I will need to migrate this
+  };
+}
home/common/desktop/default.nix
@@ -1,9 +1,13 @@
-{ config, pkgs, ... }:
+{
+  config,
+  pkgs,
+  desktop,
+  ...
+}:
 {
   imports = [
     # FIXME why the infinite recusion
-    # (./. + "/${desktop}")
-    ./sway
+    (./. + "/${desktop}/default.nix")
 
     ./firefox.nix
     ./gtk.nix
home/common/desktop/xdg.nix
@@ -16,14 +16,18 @@ in
       enable = true;
       xdgOpenUsePortal = true;
       extraPortals = with pkgs; [
-        # xdg-desktop-portal-hyprland
+        xdg-desktop-portal-gnome
         xdg-desktop-portal-gtk
       ];
       config = {
         common = {
           default = [
+            "gnome"
             "gtk"
           ];
+          "org.freedesktop.impl.portal.ScreenCast" = "gnome";
+          "org.freedesktop.impl.portal.Screenshot" = "gnome";
+          "org.freedesktop.impl.portal.RemoteDesktop" = "gnome";
         };
       };
     };
home/common/shell/zsh.nix
@@ -103,9 +103,10 @@
         source "$EAT_SHELL_INTEGRATION_DIR/zsh"
     '';
     loginExtra = ''
-      if [[ -z $DISPLAY && $TTY = /dev/tty1 ]]; then
-        exec dbus-run-session sway
-      fi
+            # if [[ -z $DISPLAY && $TTY = /dev/tty1 ]]; then
+            #   # exec dbus-run-session sway
+      			# 	exec dbus-run-session niri-session
+            # fi
     '';
     sessionVariables = {
       RPROMPT = "";
home/default.nix
@@ -12,19 +12,19 @@
   ...
 }:
 {
-  imports =
-    [
-      ./common/shell
-    ]
-    ++ lib.optional (builtins.isString desktop) ./common/desktop
-    ++ lib.optional (builtins.pathExists (./. + "/common/users/${username}")) ./common/users/${username}
-    ++ lib.optional (
-      builtins.hasAttr "${hostname}" globals.machines
-      && libx.hasSyncthingFolders globals.machines."${hostname}"
-    ) ./common/services/syncthing.nix
-    ++ lib.optional (builtins.pathExists (
-      ../systems/. + "/${hostname}/home.nix"
-    )) ../systems/${hostname}/home.nix;
+  imports = [
+    inputs.niri.homeModules.niri
+    ./common/shell
+  ]
+  ++ lib.optional (builtins.isString desktop) ./common/desktop
+  ++ lib.optional (builtins.pathExists (./. + "/common/users/${username}")) ./common/users/${username}
+  ++ lib.optional (
+    builtins.hasAttr "${hostname}" globals.machines
+    && libx.hasSyncthingFolders globals.machines."${hostname}"
+  ) ./common/services/syncthing.nix
+  ++ lib.optional (builtins.pathExists (
+    ../systems/. + "/${hostname}/home.nix"
+  )) ../systems/${hostname}/home.nix;
 
   home = {
     inherit username stateVersion;
@@ -51,6 +51,7 @@
       inputs.chapeau-rouge.overlays.openshift
       inputs.chick-group.overlays.default
       inputs.agenix.overlays.default
+      inputs.niri.overlays.niri
 
       # Migrate to "modifications"
       (_: prev: {
lib/default.nix
@@ -82,6 +82,7 @@
         inputs.agenix.nixosModules.default
         inputs.lanzaboote.nixosModules.lanzaboote
         homeInput.nixosModules.home-manager
+        # inputs.niri.nixosModules.niri
         { home-manager.extraSpecialArgs = specialArgs; }
         ../systems
       ];
systems/common/desktop/niri.nix
@@ -3,39 +3,47 @@
   lib,
   ...
 }:
-let
-  niriRun = pkgs.writeShellScript "niri-run" ''
-    export XDG_SESSION_TYPE=wayland
-    export XDG_SESSION_DESKTOP=niri
-    export XDG_CURRENT_DESKTOP=niri
-
-    systemd-run --user --scope --collect --quiet --unit=niri systemd-cat --identifier=niri ${pkgs.niri}/bin/niri $@
-  '';
-in
 {
   imports = [
     ./tiling-common.nix
   ];
 
-  programs.niri = {
-    enable = true;
+  environment.systemPackages = with pkgs; [
+    xwayland-satellite
+    wlogout
+  ];
+
+  xdg.portal = {
+    config.niri = {
+      default = [
+        "gnome"
+        "gtk"
+      ];
+      "org.freedesktop.impl.portal.Access" = "gtk";
+      "org.freedesktop.impl.portal.Notification" = "gtk";
+      "org.freedesktop.impl.portal.Secret" = "gnome-keyring";
+      "org.freedesktop.impl.portal.FileChooser" = "gtk";
+      "org.freedesktop.impl.portal.ScreenCast" = "gnome";
+      "org.freedesktop.portal.ScreenCast" = "gnome";
+    };
   };
+
   # Allow swaylock to unlock the computer for us
   security.pam.services.swaylock = {
     text = "auth include login";
   };
 
-  services.greetd.settings = {
-    default_session = {
-      # command = "${pkgs.greetd.greetd}/bin/agreety --cmd niri";
-      command = "${
-        lib.makeBinPath [ pkgs.greetd.tuigreet ]
-      }/tuigreet -r --asterisks --time --cmd ${niriRun}";
-      users = "greeter";
-    };
-    initial_session = {
-      command = "${niriRun}";
-      user = "vincent";
-    };
-  };
+  # services.greetd.settings = {
+  #   default_session = {
+  #     # command = "${pkgs.greetd.greetd}/bin/agreety --cmd niri";
+  #     command = "${
+  #       lib.makeBinPath [ pkgs.greetd.tuigreet ]
+  #     }/tuigreet -r --asterisks --time --cmd ${niriRun}";
+  #     users = "greeter";
+  #   };
+  #   initial_session = {
+  #     command = "${niriRun}";
+  #     user = "vincent";
+  #   };
+  # };
 }
systems/common/desktop/tiling-common.nix
@@ -24,10 +24,10 @@
         pkgs.gcr
       ];
     };
-    greetd = {
-      enable = true;
-      restart = false;
-    };
+    # greetd = {
+    #   enable = true;
+    #   restart = false;
+    # };
     gvfs.enable = true; # trying this one out
 
     libinput = {