tv xmonad: move to haskell packages
This commit is contained in:
parent
4319a38680
commit
94a09258ad
|
@ -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;
|
||||
};
|
||||
|
|
15
tv/5pkgs/haskell/xmonad-tv/default.nix
Normal file
15
tv/5pkgs/haskell/xmonad-tv/default.nix
Normal file
|
@ -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;
|
||||
}
|
15
tv/5pkgs/haskell/xmonad-tv/src/Helpers/Path.hs
Normal file
15
tv/5pkgs/haskell/xmonad-tv/src/Helpers/Path.hs
Normal file
|
@ -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"])
|
22
tv/5pkgs/haskell/xmonad-tv/src/Paths.hs
Normal file
22
tv/5pkgs/haskell/xmonad-tv/src/Paths.hs
Normal file
|
@ -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"
|
|
@ -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]
|
||||
'';
|
||||
};
|
||||
}
|
25
tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
Normal file
25
tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
Normal file
|
@ -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
|
Loading…
Reference in a new issue