diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-05-14 19:05:05 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-05-14 19:05:05 +0200 |
commit | a2c5c016a4e0997de31b0b5df492c0999d66710c (patch) | |
tree | 8f48310adfe237731a893a0bcf226ddfa5e415a4 /custom | |
parent | a0e221e0760c835c4245a1f56a72fd0811e1b44c (diff) | |
download | nixos-a2c5c016a4e0997de31b0b5df492c0999d66710c.tar nixos-a2c5c016a4e0997de31b0b5df492c0999d66710c.tar.gz nixos-a2c5c016a4e0997de31b0b5df492c0999d66710c.tar.bz2 nixos-a2c5c016a4e0997de31b0b5df492c0999d66710c.tar.xz nixos-a2c5c016a4e0997de31b0b5df492c0999d66710c.zip |
thinklight setUserID
Diffstat (limited to 'custom')
-rw-r--r-- | custom/thinklight.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/custom/thinklight.nix b/custom/thinklight.nix index 87a5264e..bd0fd6d9 100644 --- a/custom/thinklight.nix +++ b/custom/thinklight.nix | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | stdenv.mkDerivation { | 3 | stdenv.mkDerivation { |
4 | name = "thinklight-0.1"; | 4 | name = "thinklight-0.1"; |
5 | ghc = haskellPackages.ghcWithPackages (self: [self.strict]); | 5 | ghc = haskellPackages.ghcWithPackages (self: [self.strict self.unix]); |
6 | outputs = [ "out" ]; | 6 | outputs = [ "out" ]; |
7 | buildInputs = [ makeWrapper ]; | 7 | buildInputs = [ makeWrapper ]; |
8 | builder = builtins.toFile "builder.sh" '' | 8 | builder = builtins.toFile "builder.sh" '' |
@@ -21,6 +21,7 @@ stdenv.mkDerivation { | |||
21 | import Prelude hiding (readFile) | 21 | import Prelude hiding (readFile) |
22 | import Data.List (intersperse) | 22 | import Data.List (intersperse) |
23 | import Data.Maybe (fromMaybe) | 23 | import Data.Maybe (fromMaybe) |
24 | import System.Unix.User (setUserID) | ||
24 | 25 | ||
25 | data Mode = On | Off | Toggle | Blink deriving (Read, Show, Eq) | 26 | data Mode = On | Off | Toggle | Blink deriving (Read, Show, Eq) |
26 | 27 | ||
@@ -28,6 +29,7 @@ stdenv.mkDerivation { | |||
28 | main = do | 29 | main = do |
29 | args <- getArgs | 30 | args <- getArgs |
30 | let mode = if length args >= 1 then read $ head args else Toggle | 31 | let mode = if length args >= 1 then read $ head args else Toggle |
32 | setUserID 0 | ||
31 | sequence $ map (\g -> catchIOError g (\e -> if isDoesNotExistError e then return () else ioError e)) [thinklight mode] | 33 | sequence $ map (\g -> catchIOError g (\e -> if isDoesNotExistError e then return () else ioError e)) [thinklight mode] |
32 | return () | 34 | return () |
33 | 35 | ||