Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

slim: Sort sessions

This ensures that xfce and most others DMs are preferred over
xterm. Previously slim used directory order, which is undefined.

Of course, it's just lucky that xfce < xterm lexicographically, but
that also applies to the other display managers, AFAIK. We should have
a way to specify a DM order, but that can be accomodated by generating
desktop entries like "<NN>-session.desktop".

Fixes #4300. Parenthetical to #12516.

+45 -1
+5 -1
pkgs/applications/display-managers/slim/default.nix
··· 18 18 # slim's broken PAM session handling (see 19 19 # http://developer.berlios.de/bugs/?func=detailbug&bug_id=19102&group_id=2663). 20 20 ./run-once.patch 21 + 22 + # Ensure that sessions appear in sort order, rather than in 23 + # directory order. 24 + ./sort-sessions.patch 21 25 ]; 22 26 23 27 preConfigure = "substituteInPlace CMakeLists.txt --replace /lib $out/lib"; 24 28 25 29 cmakeFlags = [ "-DUSE_PAM=1" ]; 26 30 27 - NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype"; 31 + NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype -std=c++11"; 28 32 29 33 enableParallelBuilding = true; 30 34
+40
pkgs/applications/display-managers/slim/sort-sessions.patch
··· 1 + diff -ru -x '*~' slim-1.3.6-orig/cfg.cpp slim-1.3.6/cfg.cpp 2 + --- slim-1.3.6-orig/cfg.cpp 2013-10-02 00:38:05.000000000 +0200 3 + +++ slim-1.3.6/cfg.cpp 2016-01-30 10:35:51.108766802 +0100 4 + @@ -14,6 +14,7 @@ 5 + #include <iostream> 6 + #include <unistd.h> 7 + #include <stdlib.h> 8 + +#include <algorithm> 9 + 10 + #include <sys/types.h> 11 + #include <sys/stat.h> 12 + @@ -293,6 +294,8 @@ 13 + 14 + sessions.clear(); 15 + 16 + + typedef pair<string,string> session_t; 17 + + 18 + if( !strSessionDir.empty() ) { 19 + DIR *pDir = opendir(strSessionDir.c_str()); 20 + 21 + @@ -325,7 +328,7 @@ 22 + } 23 + } 24 + desktop_file.close(); 25 + - pair<string,string> session(session_name,session_exec); 26 + + session_t session(session_name,session_exec); 27 + sessions.push_back(session); 28 + cout << session_exec << " - " << session_name << endl; 29 + } 30 + @@ -341,6 +344,10 @@ 31 + pair<string,string> session("",""); 32 + sessions.push_back(session); 33 + } 34 + + 35 + + std::sort(sessions.begin(), sessions.end(), [](session_t& a, session_t& b) -> bool{ 36 + + return a.first < b.first; 37 + + }); 38 + } 39 + 40 + pair<string,string> Cfg::nextSession() {