From 5b97751a8f7edd122d13eeea33146b72b4629761 Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Fri, 25 Jul 2014 12:43:46 +0200 Subject: [PATCH] fix e18 cpufreq module: set setuid to freqset --- .../services/x11/desktop-managers/e18.nix | 7 +++++-- pkgs/desktops/e18/enlightenment.nix | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/x11/desktop-managers/e18.nix b/nixos/modules/services/x11/desktop-managers/e18.nix index e59b7f426837..cb717eea909c 100644 --- a/nixos/modules/services/x11/desktop-managers/e18.nix +++ b/nixos/modules/services/x11/desktop-managers/e18.nix @@ -6,6 +6,7 @@ let xcfg = config.services.xserver; cfg = xcfg.desktopManager.e18; + e18_enlightenment = pkgs.e18.enlightenment.override { set_freqset_setuid = true; }; in @@ -23,18 +24,20 @@ in config = mkIf (xcfg.enable && cfg.enable) { environment.systemPackages = [ - pkgs.e18.efl pkgs.e18.evas pkgs.e18.emotion pkgs.e18.elementary pkgs.e18.enlightenment + pkgs.e18.efl pkgs.e18.evas pkgs.e18.emotion pkgs.e18.elementary e18_enlightenment pkgs.e18.terminology pkgs.e18.econnman ]; services.xserver.desktopManager.session = [ { name = "E18"; start = '' - ${pkgs.e18.enlightenment}/bin/enlightenment_start + ${e18_enlightenment}/bin/enlightenment_start waitPID=$! ''; }]; + security.setuidPrograms = [ "e18_freqset" ]; + }; } diff --git a/pkgs/desktops/e18/enlightenment.nix b/pkgs/desktops/e18/enlightenment.nix index fde939c146ae..ab374ad23346 100644 --- a/pkgs/desktops/e18/enlightenment.nix +++ b/pkgs/desktops/e18/enlightenment.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, e18, xlibs, libffi, pam, alsaLib, luajit }: +{ stdenv, fetchurl, pkgconfig, e18, xlibs, libffi, pam, alsaLib, luajit, set_freqset_setuid ? false }: stdenv.mkDerivation rec { name = "enlightenment-${version}"; version = "0.18.8"; @@ -10,6 +10,20 @@ stdenv.mkDerivation rec { preConfigure = '' export NIX_CFLAGS_COMPILE="-I${e18.efl}/include/eo-1 -I${e18.efl}/include/ecore-imf-1 -I${e18.efl}/include/ethumb-client-1 -I${e18.efl}/include/ethumb-1 $NIX_CFLAGS_COMPILE" ''; + + # this is a hack and without this cpufreq module is not working: + # when set_freqset_setuid is true and "e18_freqset" is set in setuidPrograms (this is taken care of in e18 NixOS module), + # then this postInstall does the folowing: + # 1. moves the "freqset" binary to "e18_freqset", + # 2. linkes "e18_freqset" to enlightenment/bin so that, + # 3. setuidPrograms detects it and makes appropriate stuff to /var/setuid-wrappers/e18_freqset, + # 4. and finaly, linkes /var/setuid-wrappers/e18_freqset to original destination where enlightenment wants it + postInstall = if set_freqset_setuid then '' + export CPUFREQ_DIRPATH=`readlink -f $out/lib/enlightenment/modules/cpufreq/linux-gnu-*`; + mv $CPUFREQ_DIRPATH/freqset $CPUFREQ_DIRPATH/e18_freqset + ln -sv $CPUFREQ_DIRPATH/e18_freqset $out/bin/e18_freqset + ln -sv /var/setuid-wrappers/e18_freqset $CPUFREQ_DIRPATH/freqset + '' else ""; meta = { description = "The Compositing Window Manager and Desktop Shell"; homepage = http://enlightenment.org/;