From dfd8f1f93c492eb33de6d3642248b3f504ac4742 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 5 Dec 2022 14:35:20 +0100 Subject: tv nix: auto-optimise-store = true --- tv/2configs/default.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tv') diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index f3ce2da40..41dab525a 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -53,6 +53,10 @@ with import ; nix.binaryCaches = ["https://cache.nixos.org"]; + nix.extraOptions = '' + auto-optimise-store = true + ''; + nix.useSandbox = true; } { -- cgit v1.2.3 From 6a82f294335cbc0991f7a95355adfb9f7b7e6f43 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 5 Dec 2022 16:54:54 +0100 Subject: tv: use nix.settings --- tv/2configs/default.nix | 13 +++++-------- tv/2configs/hw/x220.nix | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'tv') diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 41dab525a..c9047023e 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -46,18 +46,15 @@ with import ; } { - # TODO check if both are required: - nix.sandboxPaths = [ "/etc/protocols" pkgs.iana-etc.outPath ]; - - nix.requireSignedBinaryCaches = true; - - nix.binaryCaches = ["https://cache.nixos.org"]; - nix.extraOptions = '' auto-optimise-store = true ''; - nix.useSandbox = true; + # TODO check if both are required: + nix.settings.extra-sandbox-paths = [ + "/etc/protocols" + pkgs.iana-etc.outPath + ]; } { nixpkgs.config.allowUnfree = false; diff --git a/tv/2configs/hw/x220.nix b/tv/2configs/hw/x220.nix index 8c68cdef0..25e2effbd 100644 --- a/tv/2configs/hw/x220.nix +++ b/tv/2configs/hw/x220.nix @@ -28,8 +28,8 @@ in } { - nix.buildCores = 2; - nix.maxJobs = 2; + nix.settings.cores = 2; + nix.settings.max-jobs = 2; } (if lib.versionAtLeast (lib.versions.majorMinor lib.version) "21.11" then { nix.daemonCPUSchedPolicy = "batch"; -- cgit v1.2.3 From 54f82ea7cbd2c1bb14761275d9310a0004c893fa Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 5 Dec 2022 15:10:15 +0100 Subject: tv vim: rtp -> outPath --- tv/2configs/vim.nix | 2 +- tv/5pkgs/vim/default.nix | 4 ++++ tv/5pkgs/vim/hack.nix | 2 +- tv/5pkgs/vim/nix.nix | 2 +- tv/5pkgs/vim/showsyntax.nix | 2 +- tv/5pkgs/vim/tv.nix | 2 +- tv/5pkgs/vim/vim.nix | 2 +- 7 files changed, 10 insertions(+), 6 deletions(-) (limited to 'tv') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index fed74c921..e296a0c8e 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -13,7 +13,7 @@ let { environment.variables.VIMINIT = ":so /etc/vimrc"; }; - extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ + extra-runtimepath = pkgs.tv.vim.makeRuntimePath [ pkgs.tv.vimPlugins.elixir pkgs.tv.vimPlugins.file-line pkgs.tv.vimPlugins.fzf diff --git a/tv/5pkgs/vim/default.nix b/tv/5pkgs/vim/default.nix index 5582be3fd..e0e2761d2 100644 --- a/tv/5pkgs/vim/default.nix +++ b/tv/5pkgs/vim/default.nix @@ -2,6 +2,10 @@ with import ; self: super: { tv = super.tv // { + vim = { + makePlugin = outPath: outPath // { inherit outPath; }; + makeRuntimePath = concatMapStringsSep "," (getAttr "outPath"); + }; vimPlugins = mapNixDir (path: self.callPackage path {}) ./.; }; } diff --git a/tv/5pkgs/vim/hack.nix b/tv/5pkgs/vim/hack.nix index 2145cc166..0e949688d 100644 --- a/tv/5pkgs/vim/hack.nix +++ b/tv/5pkgs/vim/hack.nix @@ -1,7 +1,7 @@ with import ; { pkgs }: -(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let +pkgs.tv.vim.makePlugin (pkgs.writeTextFile (let name = "hack"; in { name = "vim-color-${name}-1.0.2"; diff --git a/tv/5pkgs/vim/nix.nix b/tv/5pkgs/vim/nix.nix index 6715af737..01f769f16 100644 --- a/tv/5pkgs/vim/nix.nix +++ b/tv/5pkgs/vim/nix.nix @@ -1,7 +1,7 @@ with import ; { pkgs }: -(rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { +pkgs.tv.vim.makePlugin (pkgs.write "vim-syntax-nix-nested" { "/syntax/haskell.vim".text = '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ diff --git a/tv/5pkgs/vim/showsyntax.nix b/tv/5pkgs/vim/showsyntax.nix index a5547e46a..c27dd0447 100644 --- a/tv/5pkgs/vim/showsyntax.nix +++ b/tv/5pkgs/vim/showsyntax.nix @@ -1,6 +1,6 @@ { pkgs }: -(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let +pkgs.tv.vim.makePlugin (pkgs.writeTextFile (let name = "showsyntax"; in { name = "vim-plugin-${name}-1.0.0"; diff --git a/tv/5pkgs/vim/tv.nix b/tv/5pkgs/vim/tv.nix index ae6245b87..dee6b2df8 100644 --- a/tv/5pkgs/vim/tv.nix +++ b/tv/5pkgs/vim/tv.nix @@ -1,6 +1,6 @@ { pkgs }: -(rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { +pkgs.tv.vim.makePlugin (pkgs.write "vim-tv" { # # Haskell # diff --git a/tv/5pkgs/vim/vim.nix b/tv/5pkgs/vim/vim.nix index 216ab6abb..6034dbda8 100644 --- a/tv/5pkgs/vim/vim.nix +++ b/tv/5pkgs/vim/vim.nix @@ -1,7 +1,7 @@ with import ; { pkgs }: -(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let +pkgs.tv.vim.makePlugin (pkgs.writeTextFile (let name = "vim"; in { name = "vim-syntax-${name}-1.0.0"; -- cgit v1.2.3 From 7721142f255cd00d4dace91b0b26725e7b70e696 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 5 Dec 2022 16:02:32 +0100 Subject: tv fzf: bump complete-1 --- tv/5pkgs/override/fzf/complete1.patch | 90 ++++++++++++++++++++++------------- tv/5pkgs/override/fzf/default.nix | 8 ++-- 2 files changed, 59 insertions(+), 39 deletions(-) (limited to 'tv') diff --git a/tv/5pkgs/override/fzf/complete1.patch b/tv/5pkgs/override/fzf/complete1.patch index 4b2126a2c..3e3f2c4d5 100644 --- a/tv/5pkgs/override/fzf/complete1.patch +++ b/tv/5pkgs/override/fzf/complete1.patch @@ -1,50 +1,72 @@ +commit 57cbd76c068121b685399fdb4649e7ba537983d6 +Author: tv +Date: Mon Dec 5 15:24:30 2022 +0100 + + Add --complete-1 option + +diff --git a/man/man1/fzf.1 b/man/man1/fzf.1 +index 79e7291..3b8a753 100644 +--- a/man/man1/fzf.1 ++++ b/man/man1/fzf.1 +@@ -685,6 +685,9 @@ interactive finder and automatically select the only match + If there is no match for the initial query (\fB--query\fR), do not start + interactive finder and exit immediately + .TP ++.B "--complete-1" ++Exit interactive finder when there's exactly one match ++.TP + .BI "-f, --filter=" "STR" + Filter mode. Do not start interactive finder. When used with \fB--no-sort\fR, + fzf becomes a fuzzy-version of grep. diff --git a/src/core.go b/src/core.go -index a18c3a1..a3d92a4 100644 +index 2ddddc3..09afff2 100644 --- a/src/core.go +++ b/src/core.go -@@ -331,6 +331,13 @@ func Run(opts *Options, version string, revision string) { +@@ -337,8 +337,14 @@ func Run(opts *Options, version string, revision string) { + } + determine(val.final) } - } - terminal.UpdateList(val, clearSelection()) -+ if (opts.Complete1) { -+ count := val.Length() -+ if count == 1 { ++ } else { ++ if opts.Complete1 && val.Length() == 1 { + opts.Printer(val.Get(0).item.AsString(opts.Ansi)) + terminal.reqBox.Set(reqClose, nil) ++ } else { ++ terminal.UpdateList(val, clearSelection()) + } -+ } + } +- terminal.UpdateList(val, clearSelection()) } } } diff --git a/src/options.go b/src/options.go -index a55dc34..7f121cd 100644 +index 5400311..1e38fe4 100644 --- a/src/options.go +++ b/src/options.go -@@ -92,6 +92,7 @@ const usage = `usage: fzf [options] - -1, --select-1 Automatically select the only match - -0, --exit-0 Exit immediately when there's no match - -f, --filter=STR Filter mode. Do not start interactive finder. -+ --complete-1 Exit interactive finder when there's exactly one match - --print-query Print query as the first line - --expect=KEYS Comma-separated list of keys to complete fzf - --read0 Read input delimited by ASCII NUL characters -@@ -208,6 +209,7 @@ type Options struct { - Query string - Select1 bool - Exit0 bool -+ Complete1 bool - Filter *string - ToggleSort bool - Expect map[tui.Event]string -@@ -269,6 +271,7 @@ func defaultOptions() *Options { - Query: "", - Select1: false, - Exit0: false, -+ Complete1: false, - Filter: nil, - ToggleSort: false, - Expect: make(map[tui.Event]string), -@@ -1311,6 +1314,8 @@ func parseOptions(opts *Options, allArgs []string) { +@@ -108,6 +108,7 @@ const usage = `usage: fzf [options] + -1, --select-1 Automatically select the only match + -0, --exit-0 Exit immediately when there's no match + -f, --filter=STR Filter mode. Do not start interactive finder. ++ --complete-1 Exit interactive finder when there's exactly one match + --print-query Print query as the first line + --expect=KEYS Comma-separated list of keys to complete fzf + --read0 Read input delimited by ASCII NUL characters +@@ -274,6 +275,7 @@ type Options struct { + Query string + Select1 bool + Exit0 bool ++ Complete1 bool + Filter *string + ToggleSort bool + Expect map[tui.Event]string +@@ -342,6 +344,7 @@ func defaultOptions() *Options { + Query: "", + Select1: false, + Exit0: false, ++ Complete1: false, + Filter: nil, + ToggleSort: false, + Expect: make(map[tui.Event]string), +@@ -1546,6 +1549,8 @@ func parseOptions(opts *Options, allArgs []string) { opts.Exit0 = true case "+0", "--no-exit-0": opts.Exit0 = false diff --git a/tv/5pkgs/override/fzf/default.nix b/tv/5pkgs/override/fzf/default.nix index 661db0ed5..2254d455a 100644 --- a/tv/5pkgs/override/fzf/default.nix +++ b/tv/5pkgs/override/fzf/default.nix @@ -1,9 +1,7 @@ self: super: super.fzf.overrideAttrs (old: { - # XXX cannot use `patches` because fzf has a custom patchPhase - patchPhase = '' - patch -Np1 < ${./complete1.patch} - ${old.patchPhase or ""} - ''; + patches = old.patches or [] ++ [ + ./complete1.patch + ]; }) -- cgit v1.2.3 From f9d4a12916fbe6b46548b6526fd3ab697999a671 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Apr 2022 15:19:19 +0200 Subject: tv xmonad: move my* to Build This prevents Main from getting rebuilt due to TH whenever one of its imported modules changes. --- tv/5pkgs/haskell/xmonad-tv/src/Build.hs | 24 ++++++++++++++++++++++++ tv/5pkgs/haskell/xmonad-tv/src/main.hs | 17 +---------------- 2 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 tv/5pkgs/haskell/xmonad-tv/src/Build.hs (limited to 'tv') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs new file mode 100644 index 000000000..553a129b1 --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} + +module Build where + +import XMonad (Dimension) +import THEnv.JSON (getCompileEnvJSONExp) + + +myFont :: String +myFont = + "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*" + +myScreenWidth :: Dimension +myScreenWidth = + $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_SCREEN_WIDTH") + +myTermFontWidth :: Dimension +myTermFontWidth = + $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_TERM_FONT_WIDTH") + +myTermPadding :: Dimension +myTermPadding = + 2 diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 81373f410..b82f398e4 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -1,6 +1,4 @@ {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeApplications #-} module Main (main) where @@ -35,22 +33,9 @@ import XMonad.Actions.PerWorkspaceKeys (chooseAction) import XMonad.Stockholm.Pager import XMonad.Stockholm.Shutdown -import THEnv.JSON (getCompileEnvJSONExp) -myFont :: String -myFont = "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*" - -myScreenWidth :: Dimension -myScreenWidth = - $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_SCREEN_WIDTH") - -myTermFontWidth :: Dimension -myTermFontWidth = - $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_TERM_FONT_WIDTH") - -myTermPadding :: Dimension -myTermPadding = 2 +import Build (myFont, myScreenWidth, myTermFontWidth, myTermPadding) main :: IO () -- cgit v1.2.3 From 62669dadee53a26ea37f1caceeb01eb8d441be1a Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 5 Dec 2022 16:25:33 +0100 Subject: tv: deprecated xmonad-stockholm --- tv/2configs/gitrepos.nix | 2 +- tv/5pkgs/haskell/xmonad-tv/default.nix | 8 +- tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs | 113 +++++++++++++++++++++++++ tv/5pkgs/haskell/xmonad-tv/src/main.hs | 27 +----- tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal | 5 +- 5 files changed, 122 insertions(+), 33 deletions(-) create mode 100644 tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs (limited to 'tv') diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix index 50444c1ee..4fba5fe7b 100644 --- a/tv/2configs/gitrepos.nix +++ b/tv/2configs/gitrepos.nix @@ -134,7 +134,6 @@ let { web-routes-wai-custom = {}; xintmap = {}; xmonad-aeson = {}; - xmonad-stockholm = {}; xmonad-web = {}; } // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) { cac-api = { @@ -165,6 +164,7 @@ let { soundcloud = { cgit.desc = "SoundCloud command line interface"; }; + xmonad-stockholm = {}; }); restricted-repos = mapAttrs make-restricted-repo ( diff --git a/tv/5pkgs/haskell/xmonad-tv/default.nix b/tv/5pkgs/haskell/xmonad-tv/default.nix index edb5f258e..be3eca982 100644 --- a/tv/5pkgs/haskell/xmonad-tv/default.nix +++ b/tv/5pkgs/haskell/xmonad-tv/default.nix @@ -1,6 +1,6 @@ { mkDerivation, aeson, base, bytestring, containers, directory -, extra, lib, template-haskell, th-env, unix, X11, xmonad -, xmonad-contrib, xmonad-stockholm +, extra, filepath, lib, systemd, template-haskell, th-env +, transformers, unix, X11, xmonad, xmonad-contrib }: mkDerivation { pname = "xmonad-tv"; @@ -9,8 +9,8 @@ mkDerivation { isLibrary = false; isExecutable = true; executableHaskellDepends = [ - aeson base bytestring containers directory extra template-haskell - th-env unix X11 xmonad xmonad-contrib xmonad-stockholm + aeson base bytestring containers directory extra filepath systemd + template-haskell th-env transformers unix X11 xmonad xmonad-contrib ]; license = lib.licenses.mit; } diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs b/tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs new file mode 100644 index 000000000..d4a4d93cf --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs @@ -0,0 +1,113 @@ +{-# LANGUAGE LambdaCase #-} + +module Shutdown + ( newShutdownEventHandler + , shutdown + ) + where + +import Control.Applicative ((<|>), empty) +import Control.Concurrent (threadDelay) +import Control.Monad (forever, guard, when) +import Data.Monoid (All(All)) +import System.Directory (XdgDirectory(XdgData), createDirectoryIfMissing, doesFileExist, getAppUserDataDirectory, getXdgDirectory) +import System.Exit (exitSuccess) +import System.Environment (lookupEnv) +import System.FilePath (()) +import System.IO.Error (isDoesNotExistError, tryIOError) +import System.IO (hPutStrLn, stderr) +import System.Posix.Process (getProcessID) +import System.Posix.Signals (nullSignal, signalProcess) +import System.Posix.Types (ProcessID) +import XMonad hiding (getXMonadDataDir) + + +-- XXX this is for compatibility with both xmonad<0.17 and xmonad>=0.17 +getXMonadDataDir :: IO String +getXMonadDataDir = xmEnvDir <|> xmDir <|> xdgDir + where + -- | Check for xmonad's environment variables first + xmEnvDir :: IO String + xmEnvDir = + maybe empty pure =<< lookupEnv "XMONAD_DATA_DIR" + + -- | Check whether the config file or a build script is in the + -- @~\/.xmonad@ directory + xmDir :: IO String + xmDir = do + d <- getAppUserDataDirectory "xmonad" + conf <- doesFileExist $ d "xmonad.hs" + build <- doesFileExist $ d "build" + pid <- doesFileExist $ d "xmonad.pid" + + -- Place *everything* in ~/.xmonad if yes + guard $ conf || build || pid + pure d + + -- | Use XDG directories as a fallback + xdgDir :: IO String + xdgDir = do + d <- getXdgDirectory XdgData "xmonad" + d <$ createDirectoryIfMissing True d + + +newShutdownEventHandler :: IO (Event -> X All) +newShutdownEventHandler = do + writeProcessIDToFile + return handleShutdownEvent + +handleShutdownEvent :: Event -> X All +handleShutdownEvent = \case + ClientMessageEvent { ev_message_type = mt } -> do + isShutdownEvent <- (mt ==) <$> getAtom "XMONAD_SHUTDOWN" + when isShutdownEvent $ do + broadcastMessage ReleaseResources + writeStateToFile + io exitSuccess >> return () + return (All (not isShutdownEvent)) + _ -> + return (All True) + +sendShutdownEvent :: IO () +sendShutdownEvent = do + dpy <- openDisplay "" + rw <- rootWindow dpy $ defaultScreen dpy + a <- internAtom dpy "XMONAD_SHUTDOWN" False + allocaXEvent $ \e -> do + setEventType e clientMessage + setClientMessageEvent e rw a 32 0 currentTime + sendEvent dpy rw False structureNotifyMask e + sync dpy False + +shutdown :: IO () +shutdown = do + pid <- readProcessIDFromFile + sendShutdownEvent + hPutStrLn stderr ("waiting for: " <> show pid) + result <- tryIOError (waitProcess pid) + if isSuccess result + then hPutStrLn stderr ("result: " <> show result <> " [AKA success^_^]") + else hPutStrLn stderr ("result: " <> show result) + where + isSuccess = either isDoesNotExistError (const False) + +waitProcess :: ProcessID -> IO () +waitProcess pid = forever (signalProcess nullSignal pid >> threadDelay 10000) + +-- +-- PID file stuff +-- + +getProcessIDFileName :: IO FilePath +getProcessIDFileName = ( "xmonad.pid") <$> getXMonadDataDir + +writeProcessIDToFile :: IO () +writeProcessIDToFile = do + pidFileName <- getProcessIDFileName + pid <- getProcessID + writeFile pidFileName (show pid) + +readProcessIDFromFile :: IO ProcessID +readProcessIDFromFile = do + pidFileName <- getProcessIDFileName + read <$> readFile pidFileName diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index b82f398e4..d346bfd66 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -30,10 +30,7 @@ import Data.Ratio import XMonad.Hooks.Place (placeHook, smart) import XMonad.Actions.PerWorkspaceKeys (chooseAction) -import XMonad.Stockholm.Pager -import XMonad.Stockholm.Shutdown - - +import Shutdown (shutdown, newShutdownEventHandler) import Build (myFont, myScreenWidth, myTermFontWidth, myTermPadding) @@ -139,8 +136,6 @@ myKeys conf = Map.fromList $ , ((_4 , xK_x ), chooseAction spawnTermAt) , ((_4C , xK_x ), spawnRootTerm) - , ((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_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ sendMessage NextLayout) @@ -218,23 +213,3 @@ xdeny = , "-e", "sleep", "0.05" ] Nothing - - -pagerConfig :: PagerConfig -pagerConfig = def - { pc_font = myFont - , pc_cellwidth = 64 - , pc_matchmethod = MatchPrefix - , pc_windowColors = windowColors - } - where - windowColors _ _ _ True _ = ("#ef4242","#ff2323") - windowColors wsf m c u wf = do - let y = defaultWindowColors wsf m c u wf - if m == False && wf == True - then ("#402020", snd y) - else y - - -allWorkspaceNames :: W.StackSet i l a sid sd -> X [i] -allWorkspaceNames = return . map W.tag . W.workspaces diff --git a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal index f3bd2e0ab..a3ddcb039 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal +++ b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal @@ -15,14 +15,15 @@ executable xmonad containers, directory, extra, + filepath, template-haskell, th-env, unix, X11, xmonad, - xmonad-contrib, - xmonad-stockholm + xmonad-contrib other-modules: + Shutdown, THEnv.JSON default-language: Haskell2010 ghc-options: -O2 -Wall -threaded -- cgit v1.2.3 From 9a9b8e56eb6234650a369bbd24d41b8f4c66c78d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Dec 2022 19:51:40 +0100 Subject: tv imgur htgen: use scriptFile --- tv/2configs/imgur.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tv') diff --git a/tv/2configs/imgur.nix b/tv/2configs/imgur.nix index ba84fd2df..1df67f939 100644 --- a/tv/2configs/imgur.nix +++ b/tv/2configs/imgur.nix @@ -18,8 +18,6 @@ with import ; krebs.htgen.imgur = { port = 7771; - script = /* sh */ '' - (. ${pkgs.htgen-imgur}/bin/htgen-imgur) - ''; + scriptFile = "${pkgs.htgen-imgur}/bin/htgen-imgur"; }; } -- cgit v1.2.3 From 4939592fa67b4e07842d96f0beeee2f8eb4baff9 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 7 Dec 2022 20:31:34 +0100 Subject: tv x220: disable power-profiles-daemon --- tv/2configs/hw/x220.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tv') diff --git a/tv/2configs/hw/x220.nix b/tv/2configs/hw/x220.nix index 25e2effbd..c3ec7b40e 100644 --- a/tv/2configs/hw/x220.nix +++ b/tv/2configs/hw/x220.nix @@ -61,6 +61,9 @@ in emulateWheel = true; }; + # Conflicts with TLP, but gets enabled by DEs. + services.power-profiles-daemon.enable = false; + services.tlp.enable = true; services.tlp.settings = { START_CHARGE_THRESH_BAT0 = 80; -- cgit v1.2.3 From aabdb85c81407448c81d85efe0b4c08a0a86bfa4 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 7 Dec 2022 21:08:02 +0100 Subject: tv imagescan-plugin-networkscan: stdenv -> pkgs.pkgsi686Linux --- tv/5pkgs/simple/imagescan-plugin-networkscan.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tv') diff --git a/tv/5pkgs/simple/imagescan-plugin-networkscan.nix b/tv/5pkgs/simple/imagescan-plugin-networkscan.nix index c3f2deaca..4f9b84b22 100644 --- a/tv/5pkgs/simple/imagescan-plugin-networkscan.nix +++ b/tv/5pkgs/simple/imagescan-plugin-networkscan.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { preFixup = '' patchelf --set-interpreter \ - ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \ + ${pkgs.pkgsi686Linux.glibc}/lib/ld-linux-x86-64.so.2 \ $out/lib/utsushi/networkscan # libstdc++.so.6 -- cgit v1.2.3 From b1d1322e25459f1f7c79a866b2abf06fc5535e33 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 8 Dec 2022 16:12:00 +0100 Subject: tv pinentry-urxvt: show tinted screenshots --- tv/5pkgs/simple/pinentry-urxvt/default.nix | 74 ++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) (limited to 'tv') diff --git a/tv/5pkgs/simple/pinentry-urxvt/default.nix b/tv/5pkgs/simple/pinentry-urxvt/default.nix index 65b76c077..6e4f6b002 100644 --- a/tv/5pkgs/simple/pinentry-urxvt/default.nix +++ b/tv/5pkgs/simple/pinentry-urxvt/default.nix @@ -20,7 +20,11 @@ let type = lib.types.str; }; display = lib.mkOption { - default = ":0"; + default = null; + type = lib.types.nullOr lib.types.str; + }; + xwud.className = lib.mkOption { + default = "PinentryUrxvtXwudFloat"; type = lib.types.str; }; }; @@ -30,12 +34,76 @@ let in + # pinentry-urxvt - A mechanism for PIN entry utilizing rxvt-unicode + # + # This spawns a PIN entry terminal on top of a tinted screenshot of the + # current display's root window. The display for spawning the terminal can + # be predefined, in which case both the current and the predefined display + # will show the screenshot. + # + # The purpose of the screenshot, aside from looking nice, is to prevent entry + # of the PIN into the wrong window, e.g. by accidentally moving the cursor + # while typing. If necessary, the screenshot can be closed by sending 'q', + # 'Q', or ctrl-c while its focused. + # pkgs.write "pinentry-urxvt" { "/bin/pinentry".link = pkgs.writeDash "pinentry-urxvt-wrapper" '' set -efu + + trap cleanup EXIT + + cleanup() { + rm "$screenshot" + # Kill process group in order to kill screenshot windows. + ${pkgs.utillinux}/bin/kill 0 + } + + screenshot=$(${pkgs.coreutils}/bin/mktemp -t pinentry-urxvt.screenshot.XXXXXXXX) + + ${pkgs.xorg.xwd}/bin/xwd -root | + ${pkgs.imagemagick}/bin/convert xwd:- -fill \#424242 -colorize 80% xwd:"$screenshot" + + show_screenshot() { + ${pkgs.exec "pinentry-urxvt.show_screenshot" { + filename = "${pkgs.xorg.xwud}/bin/xwud"; + argv = [ + cfg.xwud.className + "-noclick" + ]; + }} < "$screenshot" & + wait_for_screenshot $! + } + + # Wait for the xwud window by trying to intercept the call to munmap(). + # If it cannot be intercepted within 0.1s, assume that attaching strace + # wasn't fast enough or xwud doesn't call munmap() anymore. In either + # case fall back to search the window by class name, assuming there can + # be only one per display. + wait_for_screenshot() { + if ! \ + ${pkgs.coreutils}/bin/timeout 0.1 \ + ${pkgs.strace}/bin/strace -p "$1" -e munmap 2>&1 | + read -r _ + then + until ${pkgs.xdotool}/bin/xdotool search \ + --classname ${lib.shell.escape cfg.xwud.className} + do + ${pkgs.coreutils}/bin/sleep 0.1 + done + fi + } + + show_screenshot + + ${lib.optionalString (cfg.display != null) /* sh */ '' + if test "$DISPLAY" != ${lib.shell.escape cfg.display}; then + export DISPLAY=${lib.shell.escape cfg.display} + show_screenshot + fi + ''} + exec 3<&0 4>&1 5>&2 - export DISPLAY=${lib.shell.escape cfg.display} - exec ${pkgs.rxvt_unicode}/bin/urxvt \ + ${pkgs.rxvt_unicode}/bin/urxvt \ -name ${lib.shell.escape cfg.appName} \ -e ${pkgs.writeDash "pinentry-urxvt-tty" '' set -efu -- cgit v1.2.3 From e56f5d7e61e46852ebe1b4904d6f4085091bd469 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Dec 2022 00:30:44 +0100 Subject: tv pkgs: use isNixDirEntry --- tv/5pkgs/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tv') diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index 5a018a166..494cb9e63 100644 --- a/tv/5pkgs/default.nix +++ b/tv/5pkgs/default.nix @@ -14,7 +14,6 @@ fix (foldl' (flip extends) (_: super) (map (name: import (./. + "/${name}")) - (filter - (name: name != "default.nix" && !hasPrefix "." name) - (pushBack "override" - (attrNames (readDir ./.)))))) + (pushBack "override" + (attrNames + (filterAttrs isNixDirEntry (readDir ./.)))))) -- cgit v1.2.3 From 6d64096cd99db27357bf2d038bdfdfc2d3a3aeae Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Dec 2022 01:31:56 +0100 Subject: tv: normalize lib imports --- tv/1systems/alnus/config.nix | 3 +-- tv/1systems/alnus/lib | 1 + tv/1systems/au/lib | 1 + tv/1systems/bu/config.nix | 6 ++---- tv/1systems/bu/lib | 1 + tv/1systems/lib | 1 + tv/1systems/mu/config.nix | 3 +-- tv/1systems/mu/lib | 1 + tv/1systems/nomic/config.nix | 3 +-- tv/1systems/nomic/lib | 1 + tv/1systems/querel/config.nix | 3 +-- tv/1systems/querel/lib | 1 + tv/1systems/wu/config.nix | 3 +-- tv/1systems/wu/lib | 1 + tv/1systems/xu/config.nix | 3 +-- tv/1systems/xu/lib | 1 + tv/1systems/zu/config.nix | 3 +-- tv/2configs/backup.nix | 5 ++--- tv/2configs/bash/default.nix | 7 ++----- tv/2configs/bash/lib | 1 + tv/2configs/binary-cache/default.nix | 2 +- tv/2configs/binary-cache/lib | 1 + tv/2configs/br.nix | 2 +- tv/2configs/default.nix | 3 +-- tv/2configs/exim-retiolum.nix | 7 ++----- tv/2configs/exim-smarthost.nix | 7 ++----- tv/2configs/gitconfig.nix | 7 ++----- tv/2configs/gitrepos.nix | 7 ++----- tv/2configs/htop.nix | 7 ++----- tv/2configs/hw/AO753.nix | 7 ++----- tv/2configs/hw/lib | 1 + tv/2configs/hw/w110er.nix | 5 ++--- tv/2configs/hw/x220.nix | 6 ++---- tv/2configs/imgur.nix | 3 +-- tv/2configs/lib | 1 + tv/2configs/nginx/default.nix | 7 ++----- tv/2configs/nginx/lib | 1 + tv/2configs/nginx/public_html.nix | 7 ++----- tv/2configs/pki/default.nix | 2 +- tv/2configs/pki/lib | 1 + tv/2configs/ppp.nix | 2 +- tv/2configs/pulse.nix | 6 ++---- tv/2configs/repo-sync/lib | 1 + tv/2configs/repo-sync/wiki.nix | 5 ++--- tv/2configs/retiolum.nix | 7 ++----- tv/2configs/ssh.nix | 7 ++----- tv/2configs/sshd.nix | 2 +- tv/2configs/urlwatch.nix | 2 +- tv/2configs/vim.nix | 6 ++---- tv/2configs/xdg.nix | 7 ++----- tv/2configs/xp-332.nix | 2 +- tv/2configs/xserver/Xmodmap.nix | 2 +- tv/2configs/xserver/default.nix | 5 ++--- tv/2configs/xserver/lib | 1 + tv/2configs/xserver/sxiv.nix | 2 +- tv/2configs/xserver/urxvt.nix | 2 +- tv/2configs/xserver/xserver.conf.nix | 5 ++--- tv/3modules/Xresources.nix | 2 +- tv/3modules/charybdis/config.nix | 2 +- tv/3modules/charybdis/default.nix | 3 ++- tv/3modules/charybdis/lib | 1 + tv/3modules/dnsmasq.nix | 2 +- tv/3modules/ejabberd/default.nix | 4 ++-- tv/3modules/ejabberd/lib | 1 + tv/3modules/focus.nix | 2 +- tv/3modules/hosts.nix | 7 ++----- tv/3modules/hw.nix | 2 +- tv/3modules/im.nix | 2 +- tv/3modules/iptables.nix | 6 ++---- tv/3modules/lib | 1 + tv/3modules/org.freedesktop.machine1.host-shell.nix | 3 ++- tv/3modules/slock.nix | 2 +- tv/3modules/x0vncserver.nix | 4 +--- tv/5pkgs/default.nix | 2 +- tv/5pkgs/haskell/default.nix | 2 +- tv/5pkgs/haskell/lib | 1 + tv/5pkgs/lib | 1 + tv/5pkgs/override/default.nix | 2 +- tv/5pkgs/override/lib | 1 + tv/5pkgs/rpi/default.nix | 4 +--- tv/5pkgs/rpi/lib | 1 + tv/5pkgs/simple/bash-fzf-history.nix | 2 +- tv/5pkgs/simple/default.nix | 2 +- tv/5pkgs/simple/lib | 1 + tv/5pkgs/simple/pinentry-urxvt/default.nix | 3 +-- tv/5pkgs/simple/pinentry-urxvt/lib | 1 + tv/5pkgs/simple/q/default.nix | 4 ++-- tv/5pkgs/simple/q/lib | 1 + tv/5pkgs/vim/default.nix | 2 +- tv/5pkgs/vim/hack.nix | 2 +- tv/5pkgs/vim/lib | 1 + tv/5pkgs/vim/nix.nix | 2 +- tv/5pkgs/vim/vim.nix | 2 +- tv/lib | 1 + 94 files changed, 121 insertions(+), 158 deletions(-) create mode 120000 tv/1systems/alnus/lib create mode 120000 tv/1systems/au/lib create mode 120000 tv/1systems/bu/lib create mode 120000 tv/1systems/lib create mode 120000 tv/1systems/mu/lib create mode 120000 tv/1systems/nomic/lib create mode 120000 tv/1systems/querel/lib create mode 120000 tv/1systems/wu/lib create mode 120000 tv/1systems/xu/lib create mode 120000 tv/2configs/bash/lib create mode 120000 tv/2configs/binary-cache/lib create mode 120000 tv/2configs/hw/lib create mode 120000 tv/2configs/lib create mode 120000 tv/2configs/nginx/lib create mode 120000 tv/2configs/pki/lib create mode 120000 tv/2configs/repo-sync/lib create mode 120000 tv/2configs/xserver/lib create mode 120000 tv/3modules/charybdis/lib create mode 120000 tv/3modules/ejabberd/lib create mode 120000 tv/3modules/lib create mode 120000 tv/5pkgs/haskell/lib create mode 120000 tv/5pkgs/lib create mode 120000 tv/5pkgs/override/lib create mode 120000 tv/5pkgs/rpi/lib create mode 120000 tv/5pkgs/simple/lib create mode 120000 tv/5pkgs/simple/pinentry-urxvt/lib create mode 120000 tv/5pkgs/simple/q/lib create mode 120000 tv/5pkgs/vim/lib create mode 120000 tv/lib (limited to 'tv') diff --git a/tv/1systems/alnus/config.nix b/tv/1systems/alnus/config.nix index c36fbc4bf..90501d56d 100644 --- a/tv/1systems/alnus/config.nix +++ b/tv/1systems/alnus/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - imports = [ diff --git a/tv/1systems/alnus/lib b/tv/1systems/alnus/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/alnus/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/au/lib b/tv/1systems/au/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/au/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/bu/config.nix b/tv/1systems/bu/config.nix index 11cdac398..22e5f1484 100644 --- a/tv/1systems/bu/config.nix +++ b/tv/1systems/bu/config.nix @@ -1,7 +1,5 @@ -{ config, pkgs, ... }: let - lib = import ../../../lib; -in { - +with import ./lib; +{ config, pkgs, ... }: { imports = [ ./disks.nix diff --git a/tv/1systems/bu/lib b/tv/1systems/bu/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/bu/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/lib b/tv/1systems/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/mu/config.nix b/tv/1systems/mu/config.nix index 00bd5da15..00cdf84c1 100644 --- a/tv/1systems/mu/config.nix +++ b/tv/1systems/mu/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - imports = [ diff --git a/tv/1systems/mu/lib b/tv/1systems/mu/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/mu/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/nomic/config.nix b/tv/1systems/nomic/config.nix index 4dc0b4e82..fb67814db 100644 --- a/tv/1systems/nomic/config.nix +++ b/tv/1systems/nomic/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - krebs.build.host = config.krebs.hosts.nomic; imports = [ diff --git a/tv/1systems/nomic/lib b/tv/1systems/nomic/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/nomic/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/querel/config.nix b/tv/1systems/querel/config.nix index 44c7685e8..8df29f75e 100644 --- a/tv/1systems/querel/config.nix +++ b/tv/1systems/querel/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - imports = [ diff --git a/tv/1systems/querel/lib b/tv/1systems/querel/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/querel/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/wu/config.nix b/tv/1systems/wu/config.nix index bf250cefa..4d45f6d40 100644 --- a/tv/1systems/wu/config.nix +++ b/tv/1systems/wu/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ../lib; { config, pkgs, ... }: { - krebs.build.host = config.krebs.hosts.wu; imports = [ diff --git a/tv/1systems/wu/lib b/tv/1systems/wu/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/wu/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix index 8a86e209b..1d143ce3a 100644 --- a/tv/1systems/xu/config.nix +++ b/tv/1systems/xu/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - krebs.build.host = config.krebs.hosts.xu; imports = [ diff --git a/tv/1systems/xu/lib b/tv/1systems/xu/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/1systems/xu/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/1systems/zu/config.nix b/tv/1systems/zu/config.nix index 8a3040a36..169fa6bd6 100644 --- a/tv/1systems/zu/config.nix +++ b/tv/1systems/zu/config.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - krebs.build.host = config.krebs.hosts.zu; imports = [ diff --git a/tv/2configs/backup.nix b/tv/2configs/backup.nix index a5e0cf4c7..c8ab73b50 100644 --- a/tv/2configs/backup.nix +++ b/tv/2configs/backup.nix @@ -1,6 +1,5 @@ -{ config, lib, ... }: -with import ; -{ +with import ./lib; +{ config, pkgs, ... }: { krebs.backup.plans = { } // mapAttrs (_: recursiveUpdate { snapshots = { diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix index 92e2499a9..c0855bb26 100644 --- a/tv/2configs/bash/default.nix +++ b/tv/2configs/bash/default.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { programs.bash = { interactiveShellInit = /* sh */ '' HISTCONTROL='erasedups:ignorespace' diff --git a/tv/2configs/bash/lib b/tv/2configs/bash/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/bash/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/binary-cache/default.nix b/tv/2configs/binary-cache/default.nix index 58791f4f6..66d740715 100644 --- a/tv/2configs/binary-cache/default.nix +++ b/tv/2configs/binary-cache/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: with import ; +{ config, lib, pkgs, ... }: with import ./lib; { environment.etc."binary-cache.pubkey".text = config.krebs.build.host.binary-cache.pubkey; diff --git a/tv/2configs/binary-cache/lib b/tv/2configs/binary-cache/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/binary-cache/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/br.nix b/tv/2configs/br.nix index e6a46e903..4a8db2e38 100644 --- a/tv/2configs/br.nix +++ b/tv/2configs/br.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { imports = [ diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index c9047023e..5710f28f4 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - boot.tmpOnTmpfs = true; krebs.enable = true; diff --git a/tv/2configs/exim-retiolum.nix b/tv/2configs/exim-retiolum.nix index 3d4ada46b..fefc6dd24 100644 --- a/tv/2configs/exim-retiolum.nix +++ b/tv/2configs/exim-retiolum.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { environment.systemPackages = [ pkgs.eximlog ]; diff --git a/tv/2configs/exim-smarthost.nix b/tv/2configs/exim-smarthost.nix index 4a0dcf616..e905536df 100644 --- a/tv/2configs/exim-smarthost.nix +++ b/tv/2configs/exim-smarthost.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { environment.systemPackages = [ pkgs.eximlog ]; diff --git a/tv/2configs/gitconfig.nix b/tv/2configs/gitconfig.nix index 771a4b2a4..fb9b78e6a 100644 --- a/tv/2configs/gitconfig.nix +++ b/tv/2configs/gitconfig.nix @@ -1,8 +1,5 @@ -{ config, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { environment.etc.gitconfig.text = '' [alias] patch = !${pkgs.git}/bin/git --no-pager diff --no-color diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix index 4fba5fe7b..d8e7755fe 100644 --- a/tv/2configs/gitrepos.nix +++ b/tv/2configs/gitrepos.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -let { +with import ./lib; +{ config, pkgs, ... }: let { body = { diff --git a/tv/2configs/htop.nix b/tv/2configs/htop.nix index e78caeb5f..09372980f 100644 --- a/tv/2configs/htop.nix +++ b/tv/2configs/htop.nix @@ -1,8 +1,5 @@ -{ pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ pkgs, ... }: { nixpkgs.config.packageOverrides = super: { htop = pkgs.symlinkJoin { name = "htop"; diff --git a/tv/2configs/hw/AO753.nix b/tv/2configs/hw/AO753.nix index dd6fcfe67..b998fcf7c 100644 --- a/tv/2configs/hw/AO753.nix +++ b/tv/2configs/hw/AO753.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { imports = [ ../smartd.nix diff --git a/tv/2configs/hw/lib b/tv/2configs/hw/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/hw/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/hw/w110er.nix b/tv/2configs/hw/w110er.nix index 09dd9a49d..bf749a98a 100644 --- a/tv/2configs/hw/w110er.nix +++ b/tv/2configs/hw/w110er.nix @@ -1,6 +1,5 @@ -{ pkgs, ... }: let - lib = import ; -in { +with import ./lib; +{ pkgs, ... }: { imports = [ ../smartd.nix { diff --git a/tv/2configs/hw/x220.nix b/tv/2configs/hw/x220.nix index c3ec7b40e..ee3c7dc04 100644 --- a/tv/2configs/hw/x220.nix +++ b/tv/2configs/hw/x220.nix @@ -1,7 +1,5 @@ -{ config, pkgs, ... }: let - lib = import ; -in -{ +with import ./lib; +{ config, pkgs, ... }: { imports = [ ../smartd.nix { diff --git a/tv/2configs/imgur.nix b/tv/2configs/imgur.nix index 1df67f939..e22122761 100644 --- a/tv/2configs/imgur.nix +++ b/tv/2configs/imgur.nix @@ -1,6 +1,5 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { - services.nginx.virtualHosts."ni.r" = { locations."/image" = { extraConfig = /* nginx */ '' diff --git a/tv/2configs/lib b/tv/2configs/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/nginx/default.nix b/tv/2configs/nginx/default.nix index efea3a844..6844df99b 100644 --- a/tv/2configs/nginx/default.nix +++ b/tv/2configs/nginx/default.nix @@ -1,8 +1,5 @@ -{ config, lib, ... }: - -with import ; - -{ +with import ./lib; +{ config, ... }: { services.nginx = { enableReload = true; diff --git a/tv/2configs/nginx/lib b/tv/2configs/nginx/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/nginx/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/nginx/public_html.nix b/tv/2configs/nginx/public_html.nix index 43d7189ef..c2403cd8d 100644 --- a/tv/2configs/nginx/public_html.nix +++ b/tv/2configs/nginx/public_html.nix @@ -1,8 +1,5 @@ -{ config, lib, ... }: - -with import ; - -{ +with import ./lib; +{ config, ... }: { services.nginx = { enable = true; virtualHosts.default = { diff --git a/tv/2configs/pki/default.nix b/tv/2configs/pki/default.nix index 51a5c716f..415755b16 100644 --- a/tv/2configs/pki/default.nix +++ b/tv/2configs/pki/default.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let certFile = config.environment.etc."ssl/certs/ca-certificates.crt".source; diff --git a/tv/2configs/pki/lib b/tv/2configs/pki/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/pki/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/ppp.nix b/tv/2configs/ppp.nix index c801401b2..24d2831c4 100644 --- a/tv/2configs/ppp.nix +++ b/tv/2configs/ppp.nix @@ -1,5 +1,5 @@ +with import ./lib; { config, pkgs, ... }: let - lib = import ; cfg = { pin = "@${toString }"; ttys.ppp = "/dev/ttyACM0"; diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index 513a0eb17..7a07e8154 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -1,7 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; -let +with import ./lib; +{ config, pkgs, ... }: let pkg = pkgs.pulseaudio; runDir = "/run/pulse"; diff --git a/tv/2configs/repo-sync/lib b/tv/2configs/repo-sync/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/repo-sync/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/repo-sync/wiki.nix b/tv/2configs/repo-sync/wiki.nix index 913439906..515e731c4 100644 --- a/tv/2configs/repo-sync/wiki.nix +++ b/tv/2configs/repo-sync/wiki.nix @@ -1,6 +1,5 @@ -{ config, pkgs, ... }: let - lib = import ; -in { +with import ./lib; +{ config, pkgs, ... }: { krebs.repo-sync.enable = true; krebs.repo-sync.repos.wiki.branches.hotdog = { origin.url = "http://cgit.hotdog.r/wiki"; diff --git a/tv/2configs/retiolum.nix b/tv/2configs/retiolum.nix index 3c3b2adf0..de77de381 100644 --- a/tv/2configs/retiolum.nix +++ b/tv/2configs/retiolum.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { krebs.tinc.retiolum = { enable = true; connectTo = filter (ne config.krebs.build.host.name) [ diff --git a/tv/2configs/ssh.nix b/tv/2configs/ssh.nix index 84d247362..ad828813d 100644 --- a/tv/2configs/ssh.nix +++ b/tv/2configs/ssh.nix @@ -1,8 +1,5 @@ -{ config, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { # Override NixOS's "Allow DSA keys for now." environment.etc."ssh/ssh_config".text = mkForce '' AddressFamily ${if config.networking.enableIPv6 then "any" else "inet"} diff --git a/tv/2configs/sshd.nix b/tv/2configs/sshd.nix index 79af5b01f..4da8c8216 100644 --- a/tv/2configs/sshd.nix +++ b/tv/2configs/sshd.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, ... }: let cfg.host = config.krebs.build.host; in { diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index 619b04459..7ba364ff3 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let exec = filename: args: url: { inherit url; diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index e296a0c8e..909213d3d 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -1,7 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; -let { +with import ./lib; +{ config, pkgs, ... }: let { body = { environment.systemPackages = [ vim-wrapper diff --git a/tv/2configs/xdg.nix b/tv/2configs/xdg.nix index 18bac9b38..b7c14af5a 100644 --- a/tv/2configs/xdg.nix +++ b/tv/2configs/xdg.nix @@ -1,8 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; - -{ +with import ./lib; +{ config, pkgs, ... }: { environment.variables.XDG_RUNTIME_DIR = "/run/xdg/$LOGNAME"; systemd.tmpfiles.rules = let diff --git a/tv/2configs/xp-332.nix b/tv/2configs/xp-332.nix index a97fb3679..51fd1ae8c 100644 --- a/tv/2configs/xp-332.nix +++ b/tv/2configs/xp-332.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: { environment.etc."utsushi.conf".text = '' diff --git a/tv/2configs/xserver/Xmodmap.nix b/tv/2configs/xserver/Xmodmap.nix index 8e8e3dfdd..8e555e927 100644 --- a/tv/2configs/xserver/Xmodmap.nix +++ b/tv/2configs/xserver/Xmodmap.nix @@ -1,6 +1,6 @@ { config, pkgs, ... }: -with import ; +with import ./lib; pkgs.writeText "Xmodmap" '' !keycode 66 = Caps_Lock diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix index 8bedb0e81..f534b557e 100644 --- a/tv/2configs/xserver/default.nix +++ b/tv/2configs/xserver/default.nix @@ -1,6 +1,5 @@ -{ config, pkgs, ... }@args: -with import ; -let +with import ./lib; +{ config, pkgs, ... }@args: let cfg = { cacheDir = cfg.dataDir; configDir = "/var/empty"; diff --git a/tv/2configs/xserver/lib b/tv/2configs/xserver/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/2configs/xserver/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/2configs/xserver/sxiv.nix b/tv/2configs/xserver/sxiv.nix index 10e450da4..eb862f887 100644 --- a/tv/2configs/xserver/sxiv.nix +++ b/tv/2configs/xserver/sxiv.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let cfg.user = config.krebs.build.user; in { diff --git a/tv/2configs/xserver/urxvt.nix b/tv/2configs/xserver/urxvt.nix index 2d504e165..3502c6356 100644 --- a/tv/2configs/xserver/urxvt.nix +++ b/tv/2configs/xserver/urxvt.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let cfg.user = config.krebs.build.user; in { diff --git a/tv/2configs/xserver/xserver.conf.nix b/tv/2configs/xserver/xserver.conf.nix index 99038e5fc..3fdfebf1b 100644 --- a/tv/2configs/xserver/xserver.conf.nix +++ b/tv/2configs/xserver/xserver.conf.nix @@ -1,6 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; +with import ./lib; +{ config, pkgs, ... }: let cfg = config.services.xserver; diff --git a/tv/3modules/Xresources.nix b/tv/3modules/Xresources.nix index ab233dd65..266531de9 100644 --- a/tv/3modules/Xresources.nix +++ b/tv/3modules/Xresources.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let cfg = { enable = config.services.xserver.enable && config.tv.Xresources != {}; diff --git a/tv/3modules/charybdis/config.nix b/tv/3modules/charybdis/config.nix index dccbfde67..4669345eb 100644 --- a/tv/3modules/charybdis/config.nix +++ b/tv/3modules/charybdis/config.nix @@ -1,4 +1,4 @@ -{ config, ... }: with import ; let +{ config, ... }: with import ./lib; let cfg = config.tv.charybdis; in toFile "charybdis.conf" '' /* doc/example.conf - brief example configuration file diff --git a/tv/3modules/charybdis/default.nix b/tv/3modules/charybdis/default.nix index 96aae702a..4a0f99503 100644 --- a/tv/3modules/charybdis/default.nix +++ b/tv/3modules/charybdis/default.nix @@ -1,4 +1,5 @@ -{ config, lib, pkgs, ... }@args: with import ; let +with import ./lib; +{ config, pkgs, ... }@args: let cfg = config.tv.charybdis; in { options.tv.charybdis = { diff --git a/tv/3modules/charybdis/lib b/tv/3modules/charybdis/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/3modules/charybdis/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/3modules/dnsmasq.nix b/tv/3modules/dnsmasq.nix index ab24ac089..e1dfdea34 100644 --- a/tv/3modules/dnsmasq.nix +++ b/tv/3modules/dnsmasq.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, ... }: let cfg = config.tv.dnsmasq; in { diff --git a/tv/3modules/ejabberd/default.nix b/tv/3modules/ejabberd/default.nix index edc5296b0..e3a41a57b 100644 --- a/tv/3modules/ejabberd/default.nix +++ b/tv/3modules/ejabberd/default.nix @@ -1,5 +1,5 @@ -{ config, lib, pkgs, ... }@args: with import ; let - +with import ./lib; +{ config, pkgs, ... }: let cfg = config.tv.ejabberd; gen-dhparam = pkgs.writeDash "gen-dhparam" '' diff --git a/tv/3modules/ejabberd/lib b/tv/3modules/ejabberd/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/3modules/ejabberd/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/3modules/focus.nix b/tv/3modules/focus.nix index b1a7b2e52..c16d44243 100644 --- a/tv/3modules/focus.nix +++ b/tv/3modules/focus.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { options.tv.focus.enable = mkEnableOption "tv.focus"; } diff --git a/tv/3modules/hosts.nix b/tv/3modules/hosts.nix index 118740510..2d382e266 100644 --- a/tv/3modules/hosts.nix +++ b/tv/3modules/hosts.nix @@ -1,8 +1,5 @@ -{ config, ... }: - -with import ; - -{ +with import ./lib; +{ config, ... }: { options.tv.hosts = mkOption { type = types.attrsOf types.host; default = diff --git a/tv/3modules/hw.nix b/tv/3modules/hw.nix index 6eb722d2f..db1a77c85 100644 --- a/tv/3modules/hw.nix +++ b/tv/3modules/hw.nix @@ -1,5 +1,5 @@ +with import ./lib; let - lib = import ; local.types.screen = lib.types.submodule { options.width = lib.mkOption { type = lib.types.uint; diff --git a/tv/3modules/im.nix b/tv/3modules/im.nix index e98a57327..76a61b191 100644 --- a/tv/3modules/im.nix +++ b/tv/3modules/im.nix @@ -1,6 +1,6 @@ +with import ./lib; { config, pkgs, ... }: let im = config.tv.im; - lib = import ; in { options = { tv.im.client.enable = lib.mkEnableOption "tv.im.client" // { diff --git a/tv/3modules/iptables.nix b/tv/3modules/iptables.nix index 9cf0bd5a2..c4bf4644d 100644 --- a/tv/3modules/iptables.nix +++ b/tv/3modules/iptables.nix @@ -1,7 +1,5 @@ -{ config, lib, pkgs, ... }: - -with import ; -let { +with import ./lib; +{ config, pkgs, ... }: let { cfg = config.tv.iptables; body = { diff --git a/tv/3modules/lib b/tv/3modules/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/3modules/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/3modules/org.freedesktop.machine1.host-shell.nix b/tv/3modules/org.freedesktop.machine1.host-shell.nix index e1a5323d6..7d31edf9d 100644 --- a/tv/3modules/org.freedesktop.machine1.host-shell.nix +++ b/tv/3modules/org.freedesktop.machine1.host-shell.nix @@ -1,4 +1,5 @@ -{ config, ... }: let lib = import ../../lib; in { +with import ./lib; +{ config, ... }: { options.org.freedesktop.machine1.host-shell.access = lib.mkOption { default = {}; type = diff --git a/tv/3modules/slock.nix b/tv/3modules/slock.nix index 926adc8e0..a08303215 100644 --- a/tv/3modules/slock.nix +++ b/tv/3modules/slock.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let cfg = config.tv.slock; in { diff --git a/tv/3modules/x0vncserver.nix b/tv/3modules/x0vncserver.nix index 4dbb34df0..f19bfebcc 100644 --- a/tv/3modules/x0vncserver.nix +++ b/tv/3modules/x0vncserver.nix @@ -1,8 +1,6 @@ -with import ; +with import ./lib; { config, pkgs, ... }: let - cfg = config.tv.x0vncserver; - in { options.tv.x0vncserver = { display = mkOption { diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index 494cb9e63..245d0542b 100644 --- a/tv/5pkgs/default.nix +++ b/tv/5pkgs/default.nix @@ -1,4 +1,4 @@ -with import ../../lib; +with import ./lib; let pushBack = x: xs: if elem x xs then diff --git a/tv/5pkgs/haskell/default.nix b/tv/5pkgs/haskell/default.nix index 33fd2506a..f05223d72 100644 --- a/tv/5pkgs/haskell/default.nix +++ b/tv/5pkgs/haskell/default.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; let overrides = self: super: mapNixDir (path: self.callPackage path {}) [ diff --git a/tv/5pkgs/haskell/lib b/tv/5pkgs/haskell/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/haskell/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/lib b/tv/5pkgs/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/override/default.nix b/tv/5pkgs/override/default.nix index f719a9f69..87b7ce929 100644 --- a/tv/5pkgs/override/default.nix +++ b/tv/5pkgs/override/default.nix @@ -1,4 +1,4 @@ -with import ../../../lib; +with import ./lib; self: super: mapNixDir (path: import path self super) ./. diff --git a/tv/5pkgs/override/lib b/tv/5pkgs/override/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/override/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/rpi/default.nix b/tv/5pkgs/rpi/default.nix index f0ac47f6a..e41d6373f 100644 --- a/tv/5pkgs/rpi/default.nix +++ b/tv/5pkgs/rpi/default.nix @@ -1,6 +1,4 @@ -let - lib = import ; -in +with import ./lib; self: super: diff --git a/tv/5pkgs/rpi/lib b/tv/5pkgs/rpi/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/rpi/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix index 88a8e9e4a..1166ec7fd 100644 --- a/tv/5pkgs/simple/bash-fzf-history.nix +++ b/tv/5pkgs/simple/bash-fzf-history.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { pkgs , edit-key ? "ctrl-e" diff --git a/tv/5pkgs/simple/default.nix b/tv/5pkgs/simple/default.nix index 9fb45dd1a..82a19a9b1 100644 --- a/tv/5pkgs/simple/default.nix +++ b/tv/5pkgs/simple/default.nix @@ -1,4 +1,4 @@ -with import ../../../lib; +with import ./lib; self: super: diff --git a/tv/5pkgs/simple/lib b/tv/5pkgs/simple/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/simple/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/simple/pinentry-urxvt/default.nix b/tv/5pkgs/simple/pinentry-urxvt/default.nix index 6e4f6b002..c768a9f5b 100644 --- a/tv/5pkgs/simple/pinentry-urxvt/default.nix +++ b/tv/5pkgs/simple/pinentry-urxvt/default.nix @@ -1,8 +1,7 @@ +with import ./lib; { pkgs, ... }@args: let - lib = import ; - # config cannot be declared in the input attribute set because that would # cause callPackage to inject the wrong config. Instead, get it from ... # via args. diff --git a/tv/5pkgs/simple/pinentry-urxvt/lib b/tv/5pkgs/simple/pinentry-urxvt/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/simple/pinentry-urxvt/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix index e17282e17..2ae71db52 100644 --- a/tv/5pkgs/simple/q/default.nix +++ b/tv/5pkgs/simple/q/default.nix @@ -1,5 +1,5 @@ -{ pkgs, ... }: -with import ; +with import ./lib; +{ pkgs }: let q-cal = let diff --git a/tv/5pkgs/simple/q/lib b/tv/5pkgs/simple/q/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/simple/q/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/vim/default.nix b/tv/5pkgs/vim/default.nix index e0e2761d2..c143592ad 100644 --- a/tv/5pkgs/vim/default.nix +++ b/tv/5pkgs/vim/default.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; self: super: { tv = super.tv // { diff --git a/tv/5pkgs/vim/hack.nix b/tv/5pkgs/vim/hack.nix index 0e949688d..922d85ba2 100644 --- a/tv/5pkgs/vim/hack.nix +++ b/tv/5pkgs/vim/hack.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { pkgs }: pkgs.tv.vim.makePlugin (pkgs.writeTextFile (let diff --git a/tv/5pkgs/vim/lib b/tv/5pkgs/vim/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/5pkgs/vim/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/tv/5pkgs/vim/nix.nix b/tv/5pkgs/vim/nix.nix index 01f769f16..43caf46c2 100644 --- a/tv/5pkgs/vim/nix.nix +++ b/tv/5pkgs/vim/nix.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { pkgs }: pkgs.tv.vim.makePlugin (pkgs.write "vim-syntax-nix-nested" { diff --git a/tv/5pkgs/vim/vim.nix b/tv/5pkgs/vim/vim.nix index 6034dbda8..c5693a243 100644 --- a/tv/5pkgs/vim/vim.nix +++ b/tv/5pkgs/vim/vim.nix @@ -1,4 +1,4 @@ -with import ; +with import ./lib; { pkgs }: pkgs.tv.vim.makePlugin (pkgs.writeTextFile (let diff --git a/tv/lib b/tv/lib new file mode 120000 index 000000000..dc598c56d --- /dev/null +++ b/tv/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file -- cgit v1.2.3 From 3a0d3fed99265617503236e573733cb5c27e7139 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Dec 2022 04:42:09 +0100 Subject: =?UTF-8?q?tv:=20XMONAD=5FSPAWN=5FWORKSPACE=20=E2=86=92=20=5FCURRE?= =?UTF-8?q?NT=5FDESKTOP=5FNAME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tv/2configs/bash/default.nix | 16 ++++++++++++++-- tv/2configs/default.nix | 2 +- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 9 +-------- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'tv') diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix index c0855bb26..e38566b78 100644 --- a/tv/2configs/bash/default.nix +++ b/tv/2configs/bash/default.nix @@ -14,8 +14,20 @@ with import ./lib; case $UID in ${shell.escape (toString config.krebs.users.tv.uid)}) - if test ''${SHLVL-1} = 1; then - case ''${XMONAD_SPAWN_WORKSPACE-} in + if test ''${SHLVL-1} = 1 && test -n "''${DISPLAY-}"; then + _CURRENT_DESKTOP_NAME=''${_CURRENT_DESKTOP_NAME-$( + ${pkgs.xorg.xprop}/bin/xprop -notype -root \ + 32i _NET_CURRENT_DESKTOP \ + 8s _NET_DESKTOP_NAMES \ + | + ${pkgs.gnused}/bin/sed -r 's/.* = //;s/"//g;s/, /\a/g' | + { + read -r _NET_CURRENT_DESKTOP + IFS=$'\a' read -ra _NET_DESKTOP_NAMES + echo "''${_NET_DESKTOP_NAMES[$_NET_CURRENT_DESKTOP]}" + } + )} + case $_CURRENT_DESKTOP_NAME in stockholm) cd ~/stockholm ;; diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 5710f28f4..9babb92c2 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -37,7 +37,7 @@ with import ./lib; { i18n.defaultLocale = mkDefault "C.UTF-8"; security.sudo.extraConfig = '' - Defaults env_keep+="SSH_CLIENT XMONAD_SPAWN_WORKSPACE" + Defaults env_keep+="SSH_CLIENT _CURRENT_DESKTOP_NAME" Defaults mailto="${config.krebs.users.tv.mail}" Defaults !lecture ''; diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv