From 6c320e9fd6e6098ca13f69f0422c9ca93c3af94c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 14 May 2016 19:11:29 +0200 Subject: antiquotation instead of wrapper --- custom/thinklight.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'custom/thinklight.nix') diff --git a/custom/thinklight.nix b/custom/thinklight.nix index ced11d02..346bd21a 100644 --- a/custom/thinklight.nix +++ b/custom/thinklight.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation { source $stdenv/setup mkdir -p $out/bin $ghc/bin/ghc $src -o $out/bin/thinklight - wrapProgram $out/bin/thinklight --set THINKLIGHT ${thinklight} + chmod +4000 $out/bin/thinklight ''; src = builtins.toFile "source.hs" '' import Control.Monad (sequence) @@ -21,7 +21,6 @@ stdenv.mkDerivation { import Prelude hiding (readFile) import Data.List (intersperse) import Data.Maybe (fromMaybe) - import System.Posix.User (setEffectiveUserID) data Mode = On | Off | Toggle | Blink deriving (Read, Show, Eq) @@ -29,14 +28,11 @@ stdenv.mkDerivation { main = do args <- getArgs let mode = if length args >= 1 then read $ head args else Toggle - setEffectiveUserID 0 sequence $ map (\g -> catchIOError g (\e -> if isDoesNotExistError e then return () else ioError e)) [thinklight mode] return () findBase :: IO FilePath - findBase = do - env <- fromMaybe "thinklight" <$> lookupEnv "THINKLIGHT" - return $ "/sys/class/leds/tpacpi::" ++ env + findBase = return "/sys/class/leds/tpacpi::${thinklight}" readMax, readCurrent :: IO String readMax = readFile =<< (( "max_brightness") <$> findBase) -- cgit v1.2.3