diff options
Diffstat (limited to 'tv')
-rw-r--r-- | tv/2configs/xserver/default.nix | 13 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/default.nix | 15 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/Helpers/Path.hs | 15 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/Paths.hs | 22 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/main.hs (renamed from tv/5pkgs/simple/xmonad-tv/default.nix) | 41 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal | 25 |
6 files changed, 97 insertions, 34 deletions
diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix index a44ece8b1..9cb487254 100644 --- a/tv/2configs/xserver/default.nix +++ b/tv/2configs/xserver/default.nix @@ -57,7 +57,9 @@ in { systemd.services.display-manager.enable = false; - systemd.services.xmonad = { + systemd.services.xmonad = let + xmonad = "${pkgs.haskellPackages.xmonad-tv}/bin/xmonad"; + in { wantedBy = [ "graphical.target" ]; requires = [ "xserver.service" ]; environment = { @@ -93,6 +95,11 @@ in { "za" "zh" "zj" "zs" ]); }; + path = [ + pkgs.alsaUtils + pkgs.fzmenu + pkgs.rxvt_unicode + ]; serviceConfig = { SyslogIdentifier = "xmonad"; ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${toString [ @@ -100,8 +107,8 @@ in { "\${XMONAD_CONFIG_DIR}" "\${XMONAD_DATA_DIR}" ]}"; - ExecStart = "${pkgs.xmonad-tv}/bin/xmonad-${currentSystem}"; - ExecStop = "${pkgs.xmonad-tv}/bin/xmonad-${currentSystem} --shutdown"; + ExecStart = "@${xmonad} xmonad-${currentSystem} "; + ExecStop = "@${xmonad} xmonad-${currentSystem} --shutdown"; User = cfg.user.name; WorkingDirectory = cfg.user.home; }; diff --git a/tv/5pkgs/haskell/xmonad-tv/default.nix b/tv/5pkgs/haskell/xmonad-tv/default.nix new file mode 100644 index 000000000..42eb13d41 --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/default.nix @@ -0,0 +1,15 @@ +{ mkDerivation, base, containers, directory, extra, stdenv, unix +, X11, xmonad, xmonad-contrib, xmonad-stockholm +}: +mkDerivation { + pname = "xmonad-tv"; + version = "1.0.0"; + src = ./src; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base containers directory extra unix X11 xmonad xmonad-contrib + xmonad-stockholm + ]; + license = stdenv.lib.licenses.mit; +} diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Helpers/Path.hs b/tv/5pkgs/haskell/xmonad-tv/src/Helpers/Path.hs new file mode 100644 index 000000000..1029d60be --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/Helpers/Path.hs @@ -0,0 +1,15 @@ +module Helpers.Path where + +import qualified Data.List +import qualified System.Directory +import qualified System.IO.Unsafe + + +findExecutable :: String -> FilePath +findExecutable = + System.IO.Unsafe.unsafePerformIO . find + where + find name = + maybe failure id <$> System.Directory.findExecutable name + where + failure = error (Data.List.intercalate " " [name, "not found"]) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs b/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs new file mode 100644 index 000000000..24a809bfe --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs @@ -0,0 +1,22 @@ +module Paths where + +import Helpers.Path + + +amixer :: FilePath +amixer = findExecutable "amixer" + +otpmenu :: FilePath +otpmenu = findExecutable "otpmenu" + +passmenu :: FilePath +passmenu = findExecutable "passmenu" + +slock :: FilePath +slock = "/run/wrappers/bin/slock" + +su :: FilePath +su = "/run/wrappers/bin/su" + +urxvtc :: FilePath +urxvtc = findExecutable "urxvtc" diff --git a/tv/5pkgs/simple/xmonad-tv/default.nix b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index edfee98a0..43461ab98 100644 --- a/tv/5pkgs/simple/xmonad-tv/default.nix +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -1,16 +1,3 @@ -{ pkgs, ... }: -pkgs.writeHaskellPackage "xmonad-tv" { - executables."xmonad-${builtins.currentSystem}" = { - extra-depends = [ - "containers" - "extra" - "unix" - "X11" - "xmonad" - "xmonad-contrib" - "xmonad-stockholm" - ]; - text = /* haskell */ '' {-# LANGUAGE DeriveDataTypeable #-} -- for XS {-# LANGUAGE FlexibleContexts #-} -- for xmonad' {-# LANGUAGE LambdaCase #-} @@ -46,14 +33,9 @@ import XMonad.Actions.PerWorkspaceKeys (chooseAction) import XMonad.Stockholm.Pager import XMonad.Stockholm.Rhombus import XMonad.Stockholm.Shutdown +import qualified Paths -amixerPath :: FilePath -amixerPath = "${pkgs.alsaUtils}/bin/amixer" - -urxvtcPath :: FilePath -urxvtcPath = "${pkgs.rxvt_unicode}/bin/urxvtc" - myFont :: String myFont = "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*" @@ -70,7 +52,7 @@ mainNoArgs = do xmonad $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ def - { terminal = urxvtcPath + { terminal = Paths.urxvtc , modMask = mod4Mask , keys = myKeys , workspaces = workspaces0 @@ -113,23 +95,23 @@ forkFile path args env = spawnRootTerm :: X () spawnRootTerm = forkFile - urxvtcPath - ["-name", "root-urxvt", "-e", "/run/wrappers/bin/su", "-"] + Paths.urxvtc + ["-name", "root-urxvt", "-e", Paths.su, "-"] Nothing spawnTermAt :: String -> X () spawnTermAt ws = do env <- io getEnvironment let env' = ("XMONAD_SPAWN_WORKSPACE", ws) : env - forkFile urxvtcPath [] (Just env') + forkFile Paths.urxvtc [] (Just env') myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ()) myKeys conf = Map.fromList $ - [ ((_4 , xK_Escape ), forkFile "/run/wrappers/bin/slock" [] Nothing) + [ ((_4 , xK_Escape ), forkFile Paths.slock [] Nothing) , ((_4S , xK_c ), kill) - , ((_4 , xK_o ), forkFile "${pkgs.fzmenu}/bin/otpmenu" [] Nothing) - , ((_4 , xK_p ), forkFile "${pkgs.fzmenu}/bin/passmenu" [] Nothing) + , ((_4 , xK_o ), forkFile Paths.otpmenu [] Nothing) + , ((_4 , xK_p ), forkFile Paths.passmenu [] Nothing) , ((_4 , xK_x ), chooseAction spawnTermAt) , ((_4C , xK_x ), spawnRootTerm) @@ -140,7 +122,7 @@ myKeys conf = Map.fromList $ , ((0 , xK_Menu ), gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.view) ) , ((_S , xK_Menu ), gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.shift) ) , ((_C , xK_Menu ), toggleWS) - , ((_4 , xK_Menu ), rhombus horseConfig (liftIO . hPutStrLn stderr) ["Correct", "Horse", "Battery", "Staple", "Stuhl", "Tisch"] ) + -- , ((_4 , xK_Menu ), rhombus horseConfig (io . hPutStrLn stderr) ["Correct", "Horse", "Battery", "Staple", "Stuhl", "Tisch"] ) -- %! Rotate through the available layout algorithms , ((_4 , xK_space ), sendMessage NextLayout) @@ -207,7 +189,7 @@ myKeys conf = Map.fromList $ _4CM = _4 .|. _C .|. _M _4SM = _4 .|. _S .|. _M - amixer args = forkFile amixerPath args Nothing + amixer args = forkFile Paths.amixer args Nothing pagerConfig :: PagerConfig @@ -257,6 +239,3 @@ wGSConfig = def allWorkspaceNames :: W.StackSet i l a sid sd -> X [i] allWorkspaceNames ws = return $ map W.tag (W.hidden ws) ++ [W.tag $ W.workspace $ W.current ws] - ''; - }; -} diff --git a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal new file mode 100644 index 000000000..f10bc4aeb --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal @@ -0,0 +1,25 @@ +name: xmonad-tv +version: 1.0.0 +license: MIT +author: tv <tv@krebsco.de> +maintainer: tv <tv@krebsco.de> +build-type: Simple +cabal-version: >=1.10 + +executable xmonad + main-is: main.hs + build-depends: + base, + containers, + directory, + extra, + unix, + X11, + xmonad, + xmonad-contrib, + xmonad-stockholm + other-modules: + Helpers.Path, + Paths + default-language: Haskell2010 + ghc-options: -O2 -Wall -threaded |