fix e18 cpufreq module: set setuid to freqset

This commit is contained in:
Matej Cotman 2014-07-25 12:43:46 +02:00
parent 50510d1985
commit 5b97751a8f
2 changed files with 20 additions and 3 deletions

View File

@ -6,6 +6,7 @@ let
xcfg = config.services.xserver; xcfg = config.services.xserver;
cfg = xcfg.desktopManager.e18; cfg = xcfg.desktopManager.e18;
e18_enlightenment = pkgs.e18.enlightenment.override { set_freqset_setuid = true; };
in in
@ -23,18 +24,20 @@ in
config = mkIf (xcfg.enable && cfg.enable) { config = mkIf (xcfg.enable && cfg.enable) {
environment.systemPackages = [ 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 pkgs.e18.terminology pkgs.e18.econnman
]; ];
services.xserver.desktopManager.session = [ services.xserver.desktopManager.session = [
{ name = "E18"; { name = "E18";
start = '' start = ''
${pkgs.e18.enlightenment}/bin/enlightenment_start ${e18_enlightenment}/bin/enlightenment_start
waitPID=$! waitPID=$!
''; '';
}]; }];
security.setuidPrograms = [ "e18_freqset" ];
}; };
} }

View File

@ -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 { stdenv.mkDerivation rec {
name = "enlightenment-${version}"; name = "enlightenment-${version}";
version = "0.18.8"; version = "0.18.8";
@ -10,6 +10,20 @@ stdenv.mkDerivation rec {
preConfigure = '' 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" 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 = { meta = {
description = "The Compositing Window Manager and Desktop Shell"; description = "The Compositing Window Manager and Desktop Shell";
homepage = http://enlightenment.org/; homepage = http://enlightenment.org/;