summary refs log tree commit diff
diff options
context:
space:
mode:
authorTor Hedin Brønner <torhedinbronner@gmail.com>2019-01-12 08:33:05 +0100
committerJan Tojnar <jtojnar@gmail.com>2019-12-15 04:16:18 +0100
commitdd7144b8601958562d78f795abcab4668404d15d (patch)
treee2f2e0a620ccfa455ad701e6d1add0969d0b8eae
parentd362df6682d3506e17c069f95cb39b10e516d123 (diff)
downloadnixpkgs-dd7144b8601958562d78f795abcab4668404d15d.tar
nixpkgs-dd7144b8601958562d78f795abcab4668404d15d.tar.gz
nixpkgs-dd7144b8601958562d78f795abcab4668404d15d.tar.bz2
nixpkgs-dd7144b8601958562d78f795abcab4668404d15d.tar.lz
nixpkgs-dd7144b8601958562d78f795abcab4668404d15d.tar.xz
nixpkgs-dd7144b8601958562d78f795abcab4668404d15d.tar.zst
nixpkgs-dd7144b8601958562d78f795abcab4668404d15d.zip
nixos/sessionPackages: provide session names in passthru
We want access to the valid session names at evaluation time.
-rw-r--r--nixos/modules/programs/sway.nix1
-rw-r--r--nixos/modules/services/x11/display-managers/default.nix15
-rw-r--r--pkgs/desktops/gnome-3/core/gnome-session/default.nix1
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix2
-rw-r--r--pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix1
-rw-r--r--pkgs/desktops/surf-display/default.nix4
6 files changed, 23 insertions, 1 deletions
diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix
index f5c66cbd663..d685a525932 100644
--- a/nixos/modules/programs/sway.nix
+++ b/nixos/modules/programs/sway.nix
@@ -24,6 +24,7 @@ let
   swayJoined = pkgs.symlinkJoin {
     name = "sway-joined";
     paths = [ swayWrapped swayPackage ];
+    passthru.providedSessions = [ "sway" ];
   };
 in {
   options.programs.sway = {
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index 4a75787f715..4dc06b30c7a 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -263,7 +263,20 @@ in
       };
 
       sessionPackages = mkOption {
-        type = types.listOf types.package;
+        type = with types; listOf (package // {
+          description = "package with provided sessions";
+          check = p: assertMsg
+            (package.check p && p ? providedSessions
+            && p.providedSessions != [] && all isString p.providedSessions)
+            ''
+              Package, '${p.name}', did not specify any session names, as strings, in
+              'passthru.providedSessions'. This is required when used as a session package.
+
+              The session names can be looked up in:
+                ${p}/share/xsessions
+                ${p}/share/wayland-sessions
+           '';
+        });
         default = [];
         description = ''
           A list of packages containing x11 or wayland session files to be passed to the display manager.
diff --git a/pkgs/desktops/gnome-3/core/gnome-session/default.nix b/pkgs/desktops/gnome-3/core/gnome-session/default.nix
index 8aaf68ea1e3..d63435ce2e9 100644
--- a/pkgs/desktops/gnome-3/core/gnome-session/default.nix
+++ b/pkgs/desktops/gnome-3/core/gnome-session/default.nix
@@ -55,6 +55,7 @@ stdenv.mkDerivation rec {
       packageName = "gnome-session";
       attrPath = "gnome3.gnome-session";
     };
+    providedSessions = [ "gnome" "gnome-xorg" ];
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix b/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
index 808d36dab95..c1791ee5bbd 100644
--- a/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
+++ b/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
@@ -141,6 +141,8 @@ let
           Type=Application
           DesktopNames=GNOME-Flashback;GNOME;
         '';
+      } // {
+        providedSessions = [ "gnome-flashback-${wmName}" ];
       };
 
       mkSystemdTargetForWm = { wmName }:
diff --git a/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix b/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix
index ab7333212a0..07c9e724fc6 100644
--- a/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix
+++ b/pkgs/desktops/pantheon/desktop/elementary-session-settings/default.nix
@@ -131,6 +131,7 @@ stdenv.mkDerivation rec {
       inherit repoName;
       attrPath = pname;
     };
+    providedSessions = [ "pantheon" ];
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/desktops/surf-display/default.nix b/pkgs/desktops/surf-display/default.nix
index 47b7e117206..dd064486647 100644
--- a/pkgs/desktops/surf-display/default.nix
+++ b/pkgs/desktops/surf-display/default.nix
@@ -43,6 +43,10 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "PREFIX=${placeholder "out"}" ];
 
+  passthru = {
+    providedSessions = [ "surf-display" ];
+  };
+
   meta = with stdenv.lib; {
     description = "Kiosk browser session manager based on the surf browser";
     homepage = "https://code.it-zukunft-schule.de/cgit/surf-display/";