[Nix-dev] thermald.nix

Thomas Strobel ts468 at cam.ac.uk
Sun Aug 3 23:20:33 CEST 2014


Hi,

maybe someone interested in pushing the .nix file for thermald online?
It's maybe not the latest version, and the systemd integration is quite
basic, but it works. It might benefit from a change in the kernel's
default configuration, though.

Best wishes,
Thomas
-------------- next part --------------
{ stdenv, fetchurl, unzip, autoconf, automake, libtool, pkgconfig, dbus_libs, dbus_glib, libxml2 }:

let
  version = "next";
in

stdenv.mkDerivation rec {
  name = "thermald-${version}";
  src = fetchurl {
    url = "https://github.com/01org/thermal_daemon/archive/thermal_daemon_next.zip";
    sha256 = "0rk2l1s1ar60j9hxbrhji8zmv730pzv2ysjamv0qvbynlhi4xzjp";
  };
  buildInputs = [ unzip autoconf automake libtool pkgconfig dbus_libs dbus_glib libxml2 ];

  patchPhase = ''sed -e 's/upstartconfdir = \/etc\/init/upstartconfdir = $(out)\/etc\/init/' -i data/Makefile.am'';

  preConfigure = ''
                   export PKG_CONFIG_PATH="${dbus_libs}/lib/pkgconfig:$PKG_CONFIG_PATH"
                   ./autogen.sh #--prefix="$out"
                 '';

  configureFlags = [
    "--sysconfdir=$(out)/etc" "--localstatedir=/var"
    "--with-dbus-sys-dir=$(out)/etc/dbus-1/system.d"
    "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
    ];

  preInstall = "sysconfdir=$out/etc";


  meta = {
    description = "Thermal Daemon";
    longDescription = ''
         Thermal Daemon
    '';
    homepage = https://01.org/linux-thermal-daemon;
    license = stdenv.lib.licenses.gpl2;
  };
}
-------------- next part --------------
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.thermald;

in {

  ###### interface

  options = { 

    services.thermald = { 

      enable = mkOption {
        default = false;
        description = ''
          Whether to enable thermald, the temperature management daemon.
        ''; 
      };  

    };  

  };  


  ###### implementation

  config = mkIf cfg.enable {

    systemd.services.thermald = {
      description = "Thermal Daemon Service";
      wantedBy = [ "multi-user.target" ];
      script = "exec ${pkgs.thermald}/sbin/thermald --no-daemon --dbus-enable";
    };

  };

}


More information about the nix-dev mailing list