From b81598ccd93ed2583ce6e9366184992b6f41a177 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 3 Jan 2023 16:58:37 +0100 Subject: tv alacritty: mkdir and cp only when needed --- tv/5pkgs/simple/alacritty-tv.nix | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index d80c46cbb..fd4dec9ec 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -51,6 +51,20 @@ let scrolling.multiplier = 8; }; config-file = pkgs.writeJSON "alacritty-tv.json" config; + profile = pkgs.writeText "alacritty-tv.profile" /* sh */ '' + # Use home so Alacritty can find the configuration without arguments. + # HOME will be reset once in Alacritty. + HOME=$TMPDIR/Alacritty + export HOME + + # Install stored configuration if it has changed. + # This allows for both declarative updates and runtime modifications. + ${pkgs.coreutils}/bin/mkdir -p "$HOME" + if test "$(${pkgs.coreutils}/bin/cat "$HOME"/ref)" != ${config-file}; then + echo ${config-file} > "$HOME"/ref + ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml + fi + ''; in pkgs.symlinkJoin { @@ -62,27 +76,16 @@ pkgs.symlinkJoin { set -efu - # Use home so Alacritty can find the configuration without arguments. - # HOME will be reset once in Alacritty. - HOME=$TMPDIR/Alacritty - export HOME - - # Install stored configuration if it has changed. - # This allows for both declarative updates and runtime modifications. - ${pkgs.coreutils}/bin/mkdir -p "$HOME" - if test "$(${pkgs.coreutils}/bin/cat "$HOME"/ref)" != ${config-file}; then - echo ${config-file} > "$HOME"/ref - ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml - fi - case ''${1-} in --singleton) shift if ! ${pkgs.alacritty}/bin/alacritty msg create-window "$@"; then + . ${profile} ${pkgs.alacritty}/bin/alacritty "$@" & fi ;; *) + . ${profile} exec ${pkgs.alacritty}/bin/alacritty "$@" ;; esac -- cgit v1.2.3 From 221d5dc01244ffce0c14426e90b76f392d4c5dfa Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 4 Jan 2023 14:01:34 +0100 Subject: github: add update script --- krebs/3modules/github/known-hosts.nix | 3 +-- krebs/3modules/github/update | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 krebs/3modules/github/update diff --git a/krebs/3modules/github/known-hosts.nix b/krebs/3modules/github/known-hosts.nix index f2705caa4..c0d0b588a 100644 --- a/krebs/3modules/github/known-hosts.nix +++ b/krebs/3modules/github/known-hosts.nix @@ -3,8 +3,7 @@ hostNames = ["github.com"] ++ - # List generated with (IPv6 addresses are currently ignored): - # curl -sS https://api.github.com/meta | jq -r .git[] | grep -v : | nix-shell -p cidr2glob --run cidr2glob | jq -Rs 'split("\n")|map(select(.!=""))' > known-hosts.json + # update known-hosts.json using ./update lib.importJSON ./known-hosts.json ; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; diff --git a/krebs/3modules/github/update b/krebs/3modules/github/update new file mode 100755 index 000000000..3952dabae --- /dev/null +++ b/krebs/3modules/github/update @@ -0,0 +1,15 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p cidr2glob curl git jq + +# update known-hosts.json +# +# usage: ./update + +set -efu + +# XXX IPv6 addresses are currently ignored +curl -sS https://api.github.com/meta | jq -r .git[] | grep -v : | cidr2glob | jq -Rs 'split("\n")|map(select(.!=""))' > known-hosts.json + +if git diff --exit-code known-hosts.json; then + echo known-hosts.json is up to date: nothing to do >&2 +fi -- cgit v1.2.3 From 1b1632dfb5cc363563e97a9b950a825b54cc8ece Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 9 Nov 2022 15:44:06 +0100 Subject: tv iptables: admit wiregrill --- tv/3modules/iptables.nix | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tv/3modules/iptables.nix b/tv/3modules/iptables.nix index c4bf4644d..5b36c5acb 100644 --- a/tv/3modules/iptables.nix +++ b/tv/3modules/iptables.nix @@ -34,6 +34,10 @@ with import ./lib; type = with types; listOf str; default = []; }; + filter.Wiregrill = mkOption { + type = with types; listOf str; + default = []; + }; }; }; }; @@ -66,6 +70,16 @@ with import ./lib; default = []; }; + input-wiregrill-accept-tcp = mkOption { + type = with types; listOf (either int str); + default = []; + }; + + input-wiregrill-accept-udp = mkOption { + type = with types; listOf (either int str); + default = []; + }; + extra = mkOption { default = {}; type = extraTypes.rules; @@ -141,6 +155,7 @@ with import ./lib; :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] :Retiolum - [0:0] + :Wiregrill - [0:0] ${concatMapStringsSep "\n" (rule: "-A INPUT ${rule}") ([] ++ [ "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" @@ -150,6 +165,7 @@ with import ./lib; ++ map accept-tcp (unique (map toString cfg.input-internet-accept-tcp)) ++ map accept-udp (unique (map toString cfg.input-internet-accept-udp)) ++ ["-i retiolum -j Retiolum"] + ++ ["-i wiregrill -j Wiregrill"] )} ${formatTable cfg.extra.filter} ${formatTable cfg."extra${toString iptables-version}".filter} @@ -170,6 +186,23 @@ with import ./lib; ]; }."ip${toString iptables-version}tables" )} + ${concatMapStringsSep "\n" (rule: "-A Wiregrill ${rule}") ([] + ++ optional (cfg.accept-echo-request == "wiregrill") accept-echo-request + ++ map accept-tcp (unique (map toString cfg.input-wiregrill-accept-tcp)) + ++ map accept-udp (unique (map toString cfg.input-wiregrill-accept-udp)) + ++ { + ip4tables = [ + "-p tcp -j REJECT --reject-with tcp-reset" + "-p udp -j REJECT --reject-with icmp-port-unreachable" + "-j REJECT --reject-with icmp-proto-unreachable" + ]; + ip6tables = [ + "-p tcp -j REJECT --reject-with tcp-reset" + "-p udp -j REJECT --reject-with icmp6-port-unreachable" + "-j REJECT" + ]; + }."ip${toString iptables-version}tables" + )} COMMIT ''; } -- cgit v1.2.3 From 2ad769ccdd46763a5b0bedc0bde5d905338575a6 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 4 Jan 2023 16:15:18 +0100 Subject: tv nix: auto-optimise-store via settings --- tv/2configs/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 9babb92c2..f780709f0 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -45,9 +45,7 @@ with import ./lib; } { - nix.extraOptions = '' - auto-optimise-store = true - ''; + nix.settings.auto-optimise-store = true; # TODO check if both are required: nix.settings.extra-sandbox-paths = [ -- cgit v1.2.3 From 7a45a35a58c1dca19bdd3102f6fa700ec52a38bf Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 4 Jan 2023 16:17:42 +0100 Subject: tv: move nix settings to separate file --- tv/2configs/default.nix | 10 +--------- tv/2configs/nix.nix | 9 +++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 tv/2configs/nix.nix diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index f780709f0..4e2fd517d 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -16,6 +16,7 @@ with import ./lib; ./nets/hkw.nix ./networkd.nix ./nginx + ./nix.nix ./pki ./ssh.nix ./sshd.nix @@ -44,15 +45,6 @@ with import ./lib; time.timeZone = "Europe/Berlin"; } - { - nix.settings.auto-optimise-store = 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/nix.nix b/tv/2configs/nix.nix new file mode 100644 index 000000000..fa96d459f --- /dev/null +++ b/tv/2configs/nix.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + nix.settings.auto-optimise-store = true; + + # TODO check if both are required: + nix.settings.extra-sandbox-paths = [ + "/etc/protocols" + pkgs.iana-etc.outPath + ]; +} -- cgit v1.2.3 From fbd33d19895dac77056af04595c2a22ca7552517 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 6 Jan 2023 21:27:58 +0100 Subject: tv AO753: use nix.settings --- tv/2configs/hw/AO753.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/2configs/hw/AO753.nix b/tv/2configs/hw/AO753.nix index b998fcf7c..f2268a9b2 100644 --- a/tv/2configs/hw/AO753.nix +++ b/tv/2configs/hw/AO753.nix @@ -4,8 +4,8 @@ with import ./lib; ../smartd.nix { - 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 ffa810484c16ffb0a1d1a9f27b77dbcf24212da9 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 27 Nov 2022 22:05:55 +0100 Subject: tv xmonad: Full -> StateFull --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index c921d428b..d7c45f189 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE PatternSynonyms #-} module Main (main) where @@ -20,6 +21,7 @@ import XMonad.Actions.CycleWS (toggleWS) import XMonad.Layout.NoBorders ( smartBorders ) import XMonad.Layout.ResizableTile (ResizableTall(ResizableTall)) import XMonad.Layout.ResizableTile (MirrorResize(MirrorExpand,MirrorShrink)) +import XMonad.Layout.StateFull (pattern StateFull) import qualified XMonad.Prompt import qualified XMonad.StackSet as W import Data.Map (Map) @@ -67,7 +69,7 @@ mainNoArgs = do (fromIntegral (80 * myTermFontWidth + 2 * (myTermPadding + borderWidth def)) / fromIntegral myScreenWidth) [] ||| - Full + StateFull , manageHook = composeAll [ appName =? "fzmenu-urxvt" --> doCenterFloat -- cgit v1.2.3 From d27b33d5efe50d88fc326084c839375bca0ab915 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Apr 2022 00:24:49 +0200 Subject: tv xmonad: add audioMicMute --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index d7c45f189..2a1793616 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -164,6 +164,7 @@ myKeys conf = Map.fromList $ , ((0, xF86XK_AudioLowerVolume), audioLowerVolume) , ((0, xF86XK_AudioRaiseVolume), audioRaiseVolume) , ((0, xF86XK_AudioMute), audioMute) + , ((0, xF86XK_AudioMicMute), audioMicMute) , ((_4, xF86XK_AudioMute), pavucontrol []) , ((_4, xK_Prior), forkFile {-pkg-}"xcalib" ["-invert", "-alter"] Nothing) @@ -190,6 +191,7 @@ myKeys conf = Map.fromList $ audioLowerVolume = amixer ["-q", "sset", "Master", "5%-"] audioRaiseVolume = amixer ["-q", "sset", "Master", "5%+"] audioMute = amixer ["-q", "sset", "Master", "toggle"] + audioMicMute = amixer ["-q", "sset", "Capture", "toggle"] resetLayout = setLayout $ XMonad.layoutHook conf -- cgit v1.2.3 From 09ea97a7f265d61e4627816d471f05ddf8d8888e Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 31 Mar 2022 23:12:39 +0200 Subject: tv xmonad: use BorderUrgencyHook --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 2a1793616..d4c9c6adf 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -26,7 +26,13 @@ import qualified XMonad.Prompt import qualified XMonad.StackSet as W import Data.Map (Map) import qualified Data.Map as Map -import XMonad.Hooks.UrgencyHook (SpawnUrgencyHook(..), withUrgencyHook) +import XMonad.Hooks.UrgencyHook + ( BorderUrgencyHook(BorderUrgencyHook,urgencyBorderColor) + , RemindWhen(Dont) + , SuppressWhen(Never) + , UrgencyConfig(UrgencyConfig,remindWhen,suppressWhen) + , withUrgencyHookC + ) import XMonad.Hooks.ManageHelpers (doCenterFloat,doRectFloat) import Data.Ratio import XMonad.Hooks.Place (placeHook, smart) @@ -55,7 +61,14 @@ mainNoArgs = do let config = id - $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") + $ withUrgencyHookC + BorderUrgencyHook + { urgencyBorderColor = "#ff0000" + } + UrgencyConfig + { remindWhen = Dont + , suppressWhen = Never + } $ def { terminal = {-pkg:rxvt_unicode-}"urxvtc" , modMask = mod4Mask -- cgit v1.2.3 From bd2aef1cd269185e0aa2ea42204b339fc6710bb6 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 10 Jan 2023 16:05:00 +0100 Subject: kartei tv: add ru --- kartei/tv/hosts/ru.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 kartei/tv/hosts/ru.nix diff --git a/kartei/tv/hosts/ru.nix b/kartei/tv/hosts/ru.nix new file mode 100644 index 000000000..334df5d07 --- /dev/null +++ b/kartei/tv/hosts/ru.nix @@ -0,0 +1,24 @@ +{ + ci = true; + nets = { + retiolum = { + ip4.addr = "10.243.13.42"; + aliases = [ + "ru.r" + ]; + tinc.pubkey = '' + -----BEGIN RSA PUBLIC KEY----- + MIIBCgKCAQEAr4xgpXPr/OGrLO5vwur35esesbAwREwShGJf9btt65UQXst090tD + GWev8Yfi3Mr241r1TG7zpW3Idh5nth2yhzVvqGc9m6QmK27v2MKpb+ppjOKab7RL + 1KfdBAwjdrWdL2xO3XAYOUljxWoIV4VKX8kEBvjJEDOwl/u+g5mB3yLWebtIT7Wk + EneMU6wvCVKhOPeqyXmbqO/+j6+bqxkKP2/5hHcX3a91+15YbR3SvREK2rUm9stx + Rc3kmGUO/DiGK6MmUmt+qieGo/4vheK8hij57dY0uXFIC7U680QzV7jsUmtlKGBL + PoK/Xn6TLLG6nozgmF+q8esYyaYQFrwU2QIDAQAB + -----END RSA PUBLIC KEY----- + ''; + tinc.pubkey_ed25519 = "Eg9l+RxFSNrQ9RkTd8tSkoTIG2m7zhQpjUJBWJRft1J"; + }; + }; + secure = true; + ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIcNClgsey79WzdEQs/8qkLMHzc1SCU/MqyMerPcUi8X root@ru"; +} -- cgit v1.2.3 From 59a447ac046424c27fa926a2416885c4f6724a7a Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 15:17:10 +0100 Subject: tv xmonad: get font and screen info from env --- tv/5pkgs/haskell/xmonad-tv/src/Build.hs | 24 ------------- tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs | 18 ---------- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 47 +++++++++++++++----------- tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal | 3 +- 4 files changed, 29 insertions(+), 63 deletions(-) delete mode 100644 tv/5pkgs/haskell/xmonad-tv/src/Build.hs delete mode 100644 tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs deleted file mode 100644 index 553a129b1..000000000 --- a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs +++ /dev/null @@ -1,24 +0,0 @@ -{-# 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/THEnv/JSON.hs b/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs deleted file mode 100644 index 2a3a0e523..000000000 --- a/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} - -module THEnv.JSON where - -import Data.Aeson (eitherDecode,FromJSON) -import Data.ByteString.Lazy.Char8 (pack) -import Language.Haskell.TH.Syntax (Exp,Lift(lift),Q) -import THEnv (getCompileEnv) -import Control.Monad - -getCompileEnvJSON :: (FromJSON a) => String -> Q a -getCompileEnvJSON name = - either error (id :: a -> a) . eitherDecode . pack <$> getCompileEnv name - -getCompileEnvJSONExp :: - forall proxy a. (FromJSON a, Lift a) => proxy a -> String -> Q Exp -getCompileEnvJSONExp _ = - (lift :: a -> Q Exp) <=< getCompileEnvJSON diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index d4c9c6adf..a5b3489bc 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -7,7 +7,10 @@ import System.Exit (exitFailure) import Control.Exception import Control.Monad.Extra (whenJustM) +import qualified Data.Aeson +import qualified Data.ByteString.Char8 import qualified Data.List +import qualified Data.Maybe import Graphics.X11.ExtraTypes.XF86 import Text.Read (readEither) import XMonad @@ -40,8 +43,6 @@ import XMonad.Actions.PerWorkspaceKeys (chooseAction) import Shutdown (shutdown, newShutdownEventHandler) -import Build (myFont, myScreenWidth, myTermFontWidth, myTermPadding) - main :: IO () main = getArgs >>= \case @@ -53,9 +54,19 @@ main = getArgs >>= \case (=??) :: Query a -> (a -> Bool) -> Query Bool (=??) x p = fmap p x +readEnv :: Data.Aeson.FromJSON b => String -> IO b +readEnv name = + Data.Maybe.fromJust + . Data.Aeson.decodeStrict' + . Data.ByteString.Char8.pack + <$> getEnv name mainNoArgs :: IO () mainNoArgs = do + myScreenWidth <- readEnv "XMONAD_SCREEN_WIDTH" :: IO Dimension + myTermFont <- getEnv "XMONAD_TERM_FONT" + myTermFontWidth <- readEnv "XMONAD_TERM_FONT_WIDTH" :: IO Dimension + myTermPadding <- readEnv "XMONAD_TERM_PADDING" :: IO Dimension workspaces0 <- getWorkspaces0 handleShutdownEvent <- newShutdownEventHandler let @@ -72,7 +83,7 @@ mainNoArgs = do $ def { terminal = {-pkg:rxvt_unicode-}"urxvtc" , modMask = mod4Mask - , keys = myKeys + , keys = myKeys myTermFont , workspaces = workspaces0 , layoutHook = smartBorders $ @@ -133,8 +144,8 @@ spawnRootTerm = Nothing -myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ()) -myKeys conf = Map.fromList $ +myKeys :: String -> XConfig Layout -> Map (KeyMask, KeySym) (X ()) +myKeys font conf = Map.fromList $ [ ((_4 , xK_Escape ), forkFile {-pkg-}"slock" [] Nothing) , ((_4S , xK_c ), kill) @@ -209,17 +220,15 @@ myKeys conf = Map.fromList $ resetLayout = setLayout $ XMonad.layoutHook conf promptXPConfig = - def { XMonad.Prompt.font = myFont } - - -xdeny :: X () -xdeny = - forkFile - {-pkg-}"xterm" - [ "-fn", myFont - , "-geometry", "300x100" - , "-name", "AlertFloat" - , "-bg", "#E4002B" - , "-e", "sleep", "0.05" - ] - Nothing + def { XMonad.Prompt.font = font } + + xdeny = + forkFile + {-pkg-}"xterm" + [ "-fn", font + , "-geometry", "300x100" + , "-name", "AlertFloat" + , "-bg", "#E4002B" + , "-e", "sleep", "0.05" + ] + Nothing diff --git a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal index a3ddcb039..62faf2f00 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal +++ b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal @@ -23,7 +23,6 @@ executable xmonad xmonad, xmonad-contrib other-modules: - Shutdown, - THEnv.JSON + Shutdown default-language: Haskell2010 ghc-options: -O2 -Wall -threaded -- cgit v1.2.3 From ab8139704a331b88d72d533ac4206464ae069f7c Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 16:53:26 +0100 Subject: tv bash: optionally source $BASH_EXTRA_INIT --- tv/2configs/bash/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix index e38566b78..57801d964 100644 --- a/tv/2configs/bash/default.nix +++ b/tv/2configs/bash/default.nix @@ -39,6 +39,10 @@ with import ./lib; esac ${pkgs.bash-fzf-history.bind} + + if test -n "''${BASH_EXTRA_INIT-}"; then + . "$BASH_EXTRA_INIT" + fi ''; promptInit = /* sh */ '' case $UID in -- cgit v1.2.3 From 48f91cbeb1b6bfd751cc7ed26ddee2fcf97a4f99 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:14:19 +0100 Subject: tv alacritty: add support for multiple profiles --- tv/5pkgs/simple/alacritty-tv.nix | 46 +++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index fd4dec9ec..f66bcdc0b 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -6,7 +6,7 @@ let program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; args = [arg]; }; - config = { + configs.default = { bell.animation = "EaseOut"; bell.duration = 50; bell.color = "#ff00ff"; @@ -50,16 +50,31 @@ let ]; scrolling.multiplier = 8; }; - config-file = pkgs.writeJSON "alacritty-tv.json" config; - profile = pkgs.writeText "alacritty-tv.profile" /* sh */ '' + writeProfile = name: config: let + config-file = + assert lib.types.filename.check name; + pkgs.writeJSON "alacritty-tv-${name}.json" config; + in pkgs.writeText "alacritty-tv-${name}.profile" /* sh */ '' # Use home so Alacritty can find the configuration without arguments. # HOME will be reset once in Alacritty. - HOME=$TMPDIR/Alacritty + HOME=$TMPDIR/Alacritty-${name} export HOME + # Tell Alacritty via XDG_RUNTIME_DIR where to create sockets. + # XDG_RUNTIME_DIR needs to be reset manually. + export ALACRITTY_XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" + export BASH_EXTRA_INIT=${pkgs.writeDash "alacritty-tv.cleanup.sh" '' + XDG_RUNTIME_DIR=$ALACRITTY_XDG_RUNTIME_DIR + unset ALACRITTY_XDG_RUNTIME_DIR + unset BASH_EXTRA_INIT + ''} + export XDG_RUNTIME_DIR="$HOME" + # Install stored configuration if it has changed. # This allows for both declarative updates and runtime modifications. - ${pkgs.coreutils}/bin/mkdir -p "$HOME" + # rust-xdg requires XDG_RUNTIME_DIR to be secure: + # https://docs.rs/xdg/2.4.1/src/xdg/lib.rs.html#311 + ${pkgs.coreutils}/bin/mkdir -m 0700 -p "$HOME" if test "$(${pkgs.coreutils}/bin/cat "$HOME"/ref)" != ${config-file}; then echo ${config-file} > "$HOME"/ref ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml @@ -72,20 +87,35 @@ pkgs.symlinkJoin { paths = [ (pkgs.writeDashBin "alacritty" '' # usage: - # alacritty [--singleton] [ARGS...] + # alacritty [--profile=PROFILE] [--singleton] [ARGS...] + # where + # PROFILE one of ${lib.toJSON (lib.attrNames configs)} set -efu + case ''${1-} in + ${lib.concatMapStringsSep "\n" (name: /* sh */ '' + --${lib.shell.escape name}|--profile=${lib.shell.escape name}) + shift + profile=${writeProfile name configs.${name}} + ;; + '') (lib.attrNames configs)} + *) + profile=${writeProfile "default" configs.default} + ;; + esac + + case ''${1-} in --singleton) shift if ! ${pkgs.alacritty}/bin/alacritty msg create-window "$@"; then - . ${profile} + . "$profile" ${pkgs.alacritty}/bin/alacritty "$@" & fi ;; *) - . ${profile} + . "$profile" exec ${pkgs.alacritty}/bin/alacritty "$@" ;; esac -- cgit v1.2.3 From a7a0dc6982f5399598ce4261a03fb1355620c1d2 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:16:32 +0100 Subject: tv alacritty: add root profile --- tv/5pkgs/simple/alacritty-tv.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index f66bcdc0b..bca779df7 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -50,6 +50,11 @@ let ]; scrolling.multiplier = 8; }; + configs.root = lib.recursiveUpdate configs.default { + colors.primary.background = "#230000"; + colors.primary.foreground = "#e0c0c0"; + colors.normal.black = "#800000"; + }; writeProfile = name: config: let config-file = assert lib.types.filename.check name; -- cgit v1.2.3 From 93cba42c36634e83a128cd73f85a4302adb27f5b Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:20:34 +0100 Subject: tv xmonad: urxvt -> alacritty --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index a5b3489bc..6ac6b6b10 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -81,7 +81,7 @@ mainNoArgs = do , suppressWhen = Never } $ def - { terminal = {-pkg:rxvt_unicode-}"urxvtc" + { terminal = {-pkg:alacritty-tv-}"alacritty" , modMask = mod4Mask , keys = myKeys myTermFont , workspaces = workspaces0 @@ -139,8 +139,8 @@ forkFile path args env = spawnRootTerm :: X () spawnRootTerm = forkFile - {-pkg:rxvt_unicode-}"urxvtc" - ["-name", "root-urxvt", "-e", "/run/wrappers/bin/su", "-"] + {-pkg:alacritty-tv-}"alacritty" + ["--profile=root", "-e", "/run/wrappers/bin/su", "-"] Nothing @@ -152,7 +152,7 @@ myKeys font conf = Map.fromList $ , ((_4 , xK_o ), forkFile {-pkg:fzmenu-}"otpmenu" [] Nothing) , ((_4 , xK_p ), forkFile {-pkg:fzmenu-}"passmenu" [] Nothing) - , ((_4 , xK_x ), forkFile {-pkg:rxvt_unicode-}"urxvtc" [] Nothing) + , ((_4 , xK_x ), forkFile {-pkg:alacritty-tv-}"alacritty" ["--singleton"] Nothing) , ((_4C , xK_x ), spawnRootTerm) , ((_C , xK_Menu ), toggleWS) -- cgit v1.2.3 From 9c4a8aa82bea9407f3ce1b140e20cf8a34c93c30 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:23:21 +0100 Subject: tv alacritty: add fzmenu profile --- tv/5pkgs/simple/alacritty-tv.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index bca779df7..447926cfb 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -55,6 +55,11 @@ let colors.primary.foreground = "#e0c0c0"; colors.normal.black = "#800000"; }; + configs.fzmenu = lib.recursiveUpdate configs.default { + colors.primary.background = "#2A172A"; + window.dimensions.columns = 70; + window.dimensions.lines = 9; + }; writeProfile = name: config: let config-file = assert lib.types.filename.check name; -- cgit v1.2.3 From 52c5f6ee553c5af8e3daaaa2bdcfc47094f96965 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:21:51 +0100 Subject: tv fzmenu: urxvt -> alacritty --- tv/5pkgs/simple/fzmenu/bin/otpmenu | 2 +- tv/5pkgs/simple/fzmenu/bin/passmenu | 2 +- tv/5pkgs/simple/fzmenu/default.nix | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tv/5pkgs/simple/fzmenu/bin/otpmenu b/tv/5pkgs/simple/fzmenu/bin/otpmenu index ad8a0fda9..12bd60a9d 100755 --- a/tv/5pkgs/simple/fzmenu/bin/otpmenu +++ b/tv/5pkgs/simple/fzmenu/bin/otpmenu @@ -6,7 +6,7 @@ set -efu case ${FZMENU_PHASE-0} in 0) export FZMENU_PHASE=1 - exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0" + exec setsid -f terminal dash "$0" ;; 1) if result=$( diff --git a/tv/5pkgs/simple/fzmenu/bin/passmenu b/tv/5pkgs/simple/fzmenu/bin/passmenu index 00b36c3af..da8e739ee 100755 --- a/tv/5pkgs/simple/fzmenu/bin/passmenu +++ b/tv/5pkgs/simple/fzmenu/bin/passmenu @@ -6,7 +6,7 @@ set -efu case ${FZMENU_PHASE-0} in 0) export FZMENU_PHASE=1 - exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0" + exec setsid -f terminal dash "$0" ;; 1) if result=$( diff --git a/tv/5pkgs/simple/fzmenu/default.nix b/tv/5pkgs/simple/fzmenu/default.nix index 634d8338b..7e19505c1 100644 --- a/tv/5pkgs/simple/fzmenu/default.nix +++ b/tv/5pkgs/simple/fzmenu/default.nix @@ -1,5 +1,15 @@ { lib, pkgs, stdenv }: +let + terminal = pkgs.writeDashBin "terminal" '' + # usage: terminal COMMAND [ARGS...] + exec ${pkgs.alacritty-tv}/bin/alacritty \ + --profile=fzmenu \ + --class AlacrittyFzmenuFloat \ + -e "$@" + ''; +in + pkgs.runCommand "fzmenu" { } /* sh */ '' mkdir $out @@ -16,9 +26,9 @@ pkgs.runCommand "fzmenu" { (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) - pkgs.rxvt_unicode pkgs.utillinux pkgs.xdotool + terminal ]} substituteInPlace $out/bin/passmenu \ @@ -31,8 +41,8 @@ pkgs.runCommand "fzmenu" { (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) - pkgs.rxvt_unicode pkgs.utillinux pkgs.xdotool + terminal ]} '' -- cgit v1.2.3 From 339f5d7ad3a45bad7bc090178ecefcf9d308b465 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:35:55 +0100 Subject: tv iosevka-tv-1: init --- tv/5pkgs/simple/iosevka-tv-1.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tv/5pkgs/simple/iosevka-tv-1.nix diff --git a/tv/5pkgs/simple/iosevka-tv-1.nix b/tv/5pkgs/simple/iosevka-tv-1.nix new file mode 100644 index 000000000..f72565bc7 --- /dev/null +++ b/tv/5pkgs/simple/iosevka-tv-1.nix @@ -0,0 +1,18 @@ +{ pkgs }: + +pkgs.iosevka.override { + # https://typeof.net/Iosevka/customizer + privateBuildPlan = { + family = "iosevka-tv-1"; + spacing = "term"; + serifs = "sans"; + export-glyph-names = true; + no-ligation = true; + no-cv-ss = false; + + widths.normal.shape = 600; + widths.normal.menu = 5; + widths.normal.css = "normal"; + }; + set = "iosevka-tv-1"; +} -- cgit v1.2.3 From dba0afc600eb447b3fa088b0ef96d891fc7be2cc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 17:34:26 +0100 Subject: tv alacritty: add x220 and hidpi variants --- tv/5pkgs/simple/alacritty-tv.nix | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index 447926cfb..9da850620 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -1,4 +1,6 @@ -{ pkgs }: +{ pkgs +, variant ? "x220" +}: let lib = import ./lib; @@ -6,7 +8,7 @@ let program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; args = [arg]; }; - configs.default = { + configs.default = lib.recursiveUpdate variants.${variant} { bell.animation = "EaseOut"; bell.duration = 50; bell.color = "#ff00ff"; @@ -30,10 +32,6 @@ let colors.bright.cyan = "#72fbfb"; colors.bright.white = "#fbfbfb"; draw_bold_text_with_bright_colors = true; - font.normal.family = "Clean"; - font.bold.family = "Clean"; - font.bold.style = "Regular"; - font.size = 10; hints.enabled = [ { regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+"; @@ -42,12 +40,6 @@ let action = "Select"; } ]; - key_bindings = [ - { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; } - { key = "Up"; mods = "Control"; command = font-size "+1"; } - { key = "Down"; mods = "Control"; command = font-size "-1"; } - { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; } - ]; scrolling.multiplier = 8; }; configs.root = lib.recursiveUpdate configs.default { @@ -60,6 +52,30 @@ let window.dimensions.columns = 70; window.dimensions.lines = 9; }; + variants.hidpi = { + font.normal.family = "iosevka-tv-1"; + font.bold.family = "iosevka-tv-1"; + font.italic.family = "iosevka-tv-1"; + font.bold_italic.family = "iosevka-tv-1"; + font.size = 5; + key_bindings = [ + { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; } + { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; } + { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; } + ]; + }; + variants.x220 = { + font.normal.family = "Clean"; + font.bold.family = "Clean"; + font.bold.style = "Regular"; + font.size = 10; + key_bindings = [ + { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; } + { key = "Up"; mods = "Control"; command = font-size "+1"; } + { key = "Down"; mods = "Control"; command = font-size "-1"; } + { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; } + ]; + }; writeProfile = name: config: let config-file = assert lib.types.filename.check name; -- cgit v1.2.3 From 70303049c0d169e3aece41d31015bca15a869c73 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 19:35:55 +0100 Subject: tv lidControl: init --- tv/3modules/default.nix | 1 + tv/3modules/lidControl.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tv/3modules/lidControl.nix diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix index b6b4faa51..ea3efbcca 100644 --- a/tv/3modules/default.nix +++ b/tv/3modules/default.nix @@ -8,6 +8,7 @@ ./hw.nix ./im.nix ./iptables.nix + ./lidControl.nix ./org.freedesktop.machine1.host-shell.nix ./slock.nix ./x0vncserver.nix diff --git a/tv/3modules/lidControl.nix b/tv/3modules/lidControl.nix new file mode 100644 index 000000000..6a48da18d --- /dev/null +++ b/tv/3modules/lidControl.nix @@ -0,0 +1,45 @@ +with import ./lib; +{ config, pkgs, ... }: { + options = { + tv.lidControl.enable = mkEnableOption "tv.lidControl"; + }; + config = let + cfg = config.tv.lidControl; + in mkIf cfg.enable { + services.acpid.enable = true; + services.acpid.lidEventCommands = /* sh */ '' + set -- $1 + + # usage: vt_is_xserver NUMBER + vt_is_xserver() { + ${pkgs.iproute}/bin/ss -lp src unix:/tmp/.X11-unix/X* | + ${pkgs.gnused}/bin/sed -n 's|.*/tmp/.X11-unix/X\([0-9]\+\)\>.*|\1|p' | + ${pkgs.gnugrep}/bin/grep -Fqx "$1" + } + + console=$(${pkgs.kbd}/bin/fgconsole) + + if vt_is_xserver "$console"; then + # usage: run_on_display COMMAND [ARG...] + run_on_display() { + owner=$(${pkgs.coreutils}/bin/stat -c %u /tmp/.X11-unix/X$console) + ${pkgs.systemd}/bin/systemd-run -GPq \ + -E DISPLAY=:$console \ + --uid=$owner \ + "$@" + } + case $3 in + open) + run_on_display ${pkgs.xorg.xset}/bin/xset dpms force on + ;; + close) + run_on_display ${pkgs.xorg.xset}/bin/xset dpms force off + ;; + esac + fi + ''; + services.logind.lidSwitch = "ignore"; + services.logind.lidSwitchDocked = "ignore"; + services.logind.lidSwitchExternalPower = "ignore"; + }; +} -- cgit v1.2.3 From 99eafa9d79c06219e3e1145bb3434f7d14a57e83 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 19:50:44 +0100 Subject: tv winmax2: init --- tv/2configs/hw/winmax2.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tv/2configs/hw/winmax2.nix diff --git a/tv/2configs/hw/winmax2.nix b/tv/2configs/hw/winmax2.nix new file mode 100644 index 000000000..bda349e96 --- /dev/null +++ b/tv/2configs/hw/winmax2.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: { + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" ]; + boot.initrd.kernelModules = [ "amdgpu" ]; + boot.kernelModules = [ "kvm-amd" ]; + + hardware.cpu.amd.updateMicrocode = true; + hardware.enableRedistributableFirmware = true; + + hardware.opengl.enable = true; + hardware.opengl.extraPackages = [ + pkgs.amdvlk + pkgs.rocm-opencl-icd + pkgs.rocm-opencl-runtime + ]; + + hardware.video.hidpi.enable = true; + + networking.wireless.enable = true; + networking.wireless.interfaces = [ + "wlp1s0" + ]; + networking.interfaces.wlp1s0.useDHCP = true; + + nixpkgs.hostPlatform = "x86_64-linux"; + + services.illum.enable = true; + + tv.lidControl.enable = true; + + tv.hw.screens.primary.width = 2560; + tv.hw.screens.primary.height = 1600; +} -- cgit v1.2.3 From 82589eef82d0af4237ad6747d2576659bba3e0b8 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 20:03:07 +0100 Subject: tv: put ~/bin into PATH by default --- tv/1systems/bu/config.nix | 2 -- tv/1systems/nomic/config.nix | 2 -- tv/2configs/default.nix | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tv/1systems/bu/config.nix b/tv/1systems/bu/config.nix index 22e5f1484..c7f7da24d 100644 --- a/tv/1systems/bu/config.nix +++ b/tv/1systems/bu/config.nix @@ -11,8 +11,6 @@ with import ./lib; ]; - environment.homeBinInPath = true; - krebs.build.host = config.krebs.hosts.bu; networking.hostId = lib.mkDefault "00000000"; diff --git a/tv/1systems/nomic/config.nix b/tv/1systems/nomic/config.nix index fb67814db..5bc25fd36 100644 --- a/tv/1systems/nomic/config.nix +++ b/tv/1systems/nomic/config.nix @@ -41,8 +41,6 @@ with import ./lib; fsType = "btrfs"; }; - environment.homeBinInPath = true; - environment.systemPackages = with pkgs; [ (writeDashBin "play" '' set -euf diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 4e2fd517d..540587254 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -49,6 +49,8 @@ with import ./lib; nixpkgs.config.allowUnfree = false; } { + environment.homeBinInPath = true; + environment.profileRelativeEnvVars.PATH = mkForce [ "/bin" ]; environment.systemPackages = with pkgs; [ -- cgit v1.2.3 From 3fc184a22607952db257c9c76a6f8f1d7afd16d6 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Jan 2023 20:08:56 +0100 Subject: tv alacritty: automatically select hidpi variant --- tv/2configs/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 540587254..d1384845a 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -129,4 +129,11 @@ with import ./lib; ]; } ]; + + nixpkgs.overlays = + mkAfter (optional config.hardware.video.hidpi.enable (self: super: { + alacritty-tv = super.alacritty-tv.override { + variant = "hidpi"; + }; + })); } -- cgit v1.2.3 From 59d6ab20b6acfb024d8f88dede18fb6a88437668 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 12 Jan 2023 03:06:18 +0100 Subject: syncthing-device-id: use python3 --- krebs/5pkgs/simple/syncthing-device-id.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/krebs/5pkgs/simple/syncthing-device-id.nix b/krebs/5pkgs/simple/syncthing-device-id.nix index 9533800fd..74983fc18 100644 --- a/krebs/5pkgs/simple/syncthing-device-id.nix +++ b/krebs/5pkgs/simple/syncthing-device-id.nix @@ -1,12 +1,13 @@ -{ openssl, writePython2Bin }: +{ openssl, writePython3Bin }: -writePython2Bin "syncthing-device-id" { +writePython3Bin "syncthing-device-id" { flakeIgnore = [ "E226" "E302" "E305" "E501" "F401" + "W504" ]; } /* python */ '' import base64 -- cgit v1.2.3 From 99667ab5fbb90adaaa1c40aae0fedd9b480c2474 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 13 Jan 2023 04:36:51 +0100 Subject: tv alacritty: add touchscreen support --- tv/5pkgs/override/alacritty.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tv/5pkgs/override/alacritty.nix diff --git a/tv/5pkgs/override/alacritty.nix b/tv/5pkgs/override/alacritty.nix new file mode 100644 index 000000000..17baa048f --- /dev/null +++ b/tv/5pkgs/override/alacritty.nix @@ -0,0 +1,14 @@ +self: super: + +super.alacritty.overrideAttrs (old: + assert self.lib.versions.majorMinor old.version == "0.11"; + { + version = "${old.version}-tv"; + src = self.fetchFromGitHub { + owner = "4z3"; + repo = "alacritty"; + rev = "touchscreen-support-0.11"; + hash = "sha256-oA4earrJ7lPVSBm9vRccWatAQ49hfDKsa7M72B5uQpY="; + }; + } +) -- cgit v1.2.3 From 983b993e4c764e4e9f8071c23d9ede13b8eedf67 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 14 Jan 2023 00:39:35 +0100 Subject: tv vim: scroll linewise when there's a touchscreen --- tv/2configs/vim.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index b8819ee36..a0225807c 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -140,5 +140,16 @@ with import ./lib; " edit alternate buffer " For some reason neither putting 6 nor ^ works here... nnoremap a  + + if $TOUCHSCREEN == 1 + nnoremap + nnoremap + nnoremap 3 + nnoremap 3 + nnoremap 3 + nnoremap 3 + nnoremap + nnoremap + endif ''; } -- cgit v1.2.3 From 2c05d17476932ecd23e3ce902366d4c3d08dcaca Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Jan 2023 01:50:04 +0100 Subject: tv vim: split plugins into base and extra --- tv/2configs/vim.nix | 27 +++++++++++++++++++++------ tv/5pkgs/vim/tv.nix | 11 ----------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index a0225807c..f3986e4f2 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -11,18 +11,31 @@ with import ./lib; environment.variables.VIMINIT = ":so /etc/vimrc"; }; - extra-runtimepath = pkgs.tv.vim.makeRuntimePath [ - pkgs.tv.vimPlugins.elixir + base-plugins = [ pkgs.tv.vimPlugins.file-line - pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.hack + pkgs.vimPlugins.undotree + (pkgs.tv.vim.makePlugin (pkgs.write "vim-tv-base" { + "/ftplugin/haskell.vim".text = '' + if exists("g:vim_tv_ftplugin_haskell_loaded") + finish + endif + let g:vim_tv_ftplugin_haskell_loaded = 1 + + setlocal iskeyword+=' + ''; + })) + ]; + + extra-plugins = [ + pkgs.tv.vimPlugins.elixir + pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.jq pkgs.tv.vimPlugins.nix pkgs.tv.vimPlugins.showsyntax pkgs.tv.vimPlugins.tv pkgs.tv.vimPlugins.vim pkgs.vimPlugins.fzfWrapper - pkgs.vimPlugins.undotree pkgs.vimPlugins.vim-nftables ]; @@ -71,7 +84,7 @@ with import ./lib; set mouse=a set noruler set pastetoggle= - set runtimepath=${extra-runtimepath},$VIMRUNTIME + set runtimepath=${pkgs.tv.vim.makeRuntimePath base-plugins},$VIMRUNTIME set shortmess+=I set showcmd set showmatch @@ -88,13 +101,15 @@ with import ./lib; set wildmenu set wildmode=longest,full + set runtimepath^=${pkgs.tv.vim.makeRuntimePath extra-plugins} + syntax on + set et ts=2 sts=2 sw=2 filetype plugin indent on set t_Co=256 colorscheme hack - syntax on au Syntax * syn match Garbage containedin=ALL /\s\+$/ \ | syn match TabStop containedin=ALL /\t\+/ diff --git a/tv/5pkgs/vim/tv.nix b/tv/5pkgs/vim/tv.nix index dee6b2df8..10816ce96 100644 --- a/tv/5pkgs/vim/tv.nix +++ b/tv/5pkgs/vim/tv.nix @@ -1,17 +1,6 @@ { pkgs }: pkgs.tv.vim.makePlugin (pkgs.write "vim-tv" { - # - # Haskell - # - "/ftplugin/haskell.vim".text = '' - if exists("g:vim_tv_ftplugin_haskell_loaded") - finish - endif - let g:vim_tv_ftplugin_haskell_loaded = 1 - - setlocal iskeyword+=' - ''; # # TODO # -- cgit v1.2.3 From 29bbb02a427d2fed5fbe39792ab46db9f8b55c1e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Jan 2023 03:08:23 +0100 Subject: tv uqmi: init at unstable-2022-05-04 --- tv/5pkgs/override/uqmi.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tv/5pkgs/override/uqmi.nix diff --git a/tv/5pkgs/override/uqmi.nix b/tv/5pkgs/override/uqmi.nix new file mode 100644 index 000000000..1eaecbd67 --- /dev/null +++ b/tv/5pkgs/override/uqmi.nix @@ -0,0 +1,10 @@ +self: super: + +super.uqmi.overrideAttrs (old: { + version = "unstable-2022-05-04"; + src = self.fetchgit { + url = "https://git.openwrt.org/project/uqmi.git"; + rev = "56cb2d4056fef132ccf78dfb6f3074ae5d109992"; + hash = "sha256-PwnR24PbNKfLrsBlU5JTOHDzs/9Wgcuwfnu3dJuuZcM="; + }; +}) -- cgit v1.2.3 From 0a3ad1b7c361897e7bf965424ab59e0cffe6673e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Jan 2023 16:02:32 +0100 Subject: tv br: use modulesPath --- tv/2configs/br.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/2configs/br.nix b/tv/2configs/br.nix index 4a8db2e38..47d657c46 100644 --- a/tv/2configs/br.nix +++ b/tv/2configs/br.nix @@ -1,8 +1,8 @@ with import ./lib; -{ config, pkgs, ... }: { +{ config, modulesPath, pkgs, ... }: { imports = [ - + (modulesPath + "/services/hardware/sane_extra_backends/brscan4.nix") ]; krebs.nixpkgs.allowUnfreePredicate = pkg: any (eq (packageName pkg)) [ -- cgit v1.2.3 From 21f878d929fdfb0f277aa33c2fa32c5a63f3018a Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Jan 2023 11:04:51 +0100 Subject: tv vim: DRY F{1,2} mapping --- tv/2configs/vim.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index f3986e4f2..fde66d777 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -130,8 +130,8 @@ with import ./lib; nnoremap :tabp nnoremap :tabn - inoremap :tabp - inoremap :tabn + imap + imap noremap :ShowSyntax -- cgit v1.2.3 From 250a394da48120bd2deb791eb4c7fb6232a342bb Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Jan 2023 11:05:41 +0100 Subject: tv vim: tabm with S-F{1,2} --- tv/2configs/vim.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index fde66d777..2b5cd8d21 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -133,6 +133,11 @@ with import ./lib; imap imap + nnoremap :tabm -1 + nnoremap :tabm +1 + imap + imap + noremap :ShowSyntax " -- cgit v1.2.3 From deb83ad51fa7153bb777381412366532f4e23f61 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Jan 2023 11:52:19 +0100 Subject: tv vim hack: hi TabLine{,Fill} --- tv/5pkgs/vim/hack.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tv/5pkgs/vim/hack.nix b/tv/5pkgs/vim/hack.nix index 922d85ba2..d378f355b 100644 --- a/tv/5pkgs/vim/hack.nix +++ b/tv/5pkgs/vim/hack.nix @@ -42,5 +42,8 @@ in { hi diffRemoved ctermfg=009 hi Search cterm=NONE ctermbg=216 + + hi TabLine cterm=underline guifg=#424242 guibg=#232323 + hi TabLineFill cterm=underline guifg=#424242 guibg=#232323 ''; })) -- cgit v1.2.3 From 051dd045d3f0e3ab14d63347bd46b887c1c34e6d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Jan 2023 12:40:21 +0100 Subject: tv fzf.vim: 2018-11-14 -> 2023-01-16 --- tv/5pkgs/vim/fzf.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tv/5pkgs/vim/fzf.nix b/tv/5pkgs/vim/fzf.nix index 14b6900b5..e24bee5d4 100644 --- a/tv/5pkgs/vim/fzf.nix +++ b/tv/5pkgs/vim/fzf.nix @@ -2,10 +2,10 @@ # cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg pkgs.vimUtils.buildVimPlugin { - name = "fzf-2018-11-14"; + name = "fzf-2023-01-16"; src = pkgs.fetchgit { url = https://github.com/junegunn/fzf.vim; - rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc"; - sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m"; + rev = "bdf48c282ad2174c25c059b3cdb7956427b07a99"; + hash = "sha256-eCCk+Q596Ljjdtjd0cYGqR77K3Me5gf+ts5icP22S3Y="; }; } -- cgit v1.2.3 From 70472d8c45caba8df6f57b43cec686e4df459135 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Jan 2023 00:37:46 +0100 Subject: tv alacritty: TMPDIR -> XDG_RUNTIME_DIR --- tv/5pkgs/simple/alacritty-tv.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index 9da850620..7e24b7e1b 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -83,7 +83,7 @@ let in pkgs.writeText "alacritty-tv-${name}.profile" /* sh */ '' # Use home so Alacritty can find the configuration without arguments. # HOME will be reset once in Alacritty. - HOME=$TMPDIR/Alacritty-${name} + HOME=$XDG_RUNTIME_DIR/Alacritty-${name} export HOME # Tell Alacritty via XDG_RUNTIME_DIR where to create sockets. -- cgit v1.2.3 From 29c8c3ecf1cc66a638020a564e1b72966c259a8b Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Jan 2023 00:42:15 +0100 Subject: tv alacritty: admit missing ref file --- tv/5pkgs/simple/alacritty-tv.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index 7e24b7e1b..1c7730a71 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -101,7 +101,8 @@ let # rust-xdg requires XDG_RUNTIME_DIR to be secure: # https://docs.rs/xdg/2.4.1/src/xdg/lib.rs.html#311 ${pkgs.coreutils}/bin/mkdir -m 0700 -p "$HOME" - if test "$(${pkgs.coreutils}/bin/cat "$HOME"/ref)" != ${config-file}; then + ref=$(! test -e "$HOME"/ref || ${pkgs.coreutils}/bin/cat "$HOME"/ref) + if test "$ref" != ${config-file}; then echo ${config-file} > "$HOME"/ref ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml fi -- cgit v1.2.3 From dc3f5c683822d177001b71cc9ee6afa49f3b9969 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Jan 2023 01:04:45 +0100 Subject: tv vimrc: rewrite to vim9script --- tv/2configs/vim.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 2b5cd8d21..2c17fbc74 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -71,7 +71,9 @@ with import ./lib; ]; }; - vimrc = pkgs.writeText "vimrc" '' + vimrc = pkgs.writeText "vimrc" /* vim */ '' + vim9script + set nocompatible set autoindent @@ -140,28 +142,28 @@ with import ./lib; noremap :ShowSyntax - " + # noremap Oa | noremap! Oa noremap Ob | noremap! Ob noremap Oc | noremap! Oc noremap Od | noremap! Od - " <[C]S-{Up,Down,Right,Left> + # <[C]S-{Up,Down,Right,Left}> noremap [a | noremap! [a noremap [b | noremap! [b noremap [c | noremap! [c noremap [d | noremap! [d vnoremap u - " fzf + # fzf nnoremap q :Buffers nnoremap f :Files nnoremap w :Rg - " edit alternate buffer - " For some reason neither putting 6 nor ^ works here... + # edit alternate buffer + # For some reason neither putting 6 nor ^ works here... nnoremap a  - if $TOUCHSCREEN == 1 + if $TOUCHSCREEN == "1" nnoremap nnoremap nnoremap 3 -- cgit v1.2.3 From ab43821bb1b084228146c47eb5f529415e617392 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Jan 2023 01:05:26 +0100 Subject: tv vim: remember last position --- tv/2configs/vim.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 2c17fbc74..8aee31082 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -173,5 +173,11 @@ with import ./lib; nnoremap nnoremap endif + + # remember last position + autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif ''; } -- cgit v1.2.3 From 5eb821ab1bea5efd2f845115b3dbc31f4f475ca9 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 17:13:30 +0100 Subject: tv.systemd.services.*.operators: init --- tv/3modules/default.nix | 1 + tv/3modules/systemd.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tv/3modules/systemd.nix diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix index ea3efbcca..c49f1582f 100644 --- a/tv/3modules/default.nix +++ b/tv/3modules/default.nix @@ -10,6 +10,7 @@ ./iptables.nix ./lidControl.nix ./org.freedesktop.machine1.host-shell.nix + ./systemd.nix ./slock.nix ./x0vncserver.nix ./Xresources.nix diff --git a/tv/3modules/systemd.nix b/tv/3modules/systemd.nix new file mode 100644 index 000000000..bbbab0632 --- /dev/null +++ b/tv/3modules/systemd.nix @@ -0,0 +1,46 @@ +with import ./lib; +{ config, ... }: let + normalUsers = filterAttrs (_: getAttr "isNormalUser") config.users.users; +in { + options = { + tv.systemd.services = mkOption { + type = types.attrsOf (types.submodule (self: { + options = { + operators = mkOption { + type = with types; listOf (enum (attrNames normalUsers)); + default = []; + }; + }; + })); + }; + }; + config = { + security.polkit.extraConfig = let + access = + mapAttrs' + (name: cfg: + nameValuePair "${name}.service" + (genAttrs cfg.operators (const true)) + ) + config.tv.systemd.services; + in optionalString (access != {}) /* js */ '' + polkit.addRule(function () { + const access = ${lib.toJSON access}; + return function (action, subject) { + if (action.id === "org.freedesktop.systemd1.manage-units") { + const unit = action.lookup("unit"); + if ( + (access[unit]||{})[subject.user] || + ( + unit.includes("@") && + (access[unit.replace(/@[^.]+/, "@")]||{})[subject.user] + ) + ) { + return polkit.Result.YES; + } + } + } + }()); + ''; + }; +} -- cgit v1.2.3 From 1da6186814c94512c1cbc41f2dfd3b4ac7b2e44f Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 17:14:27 +0100 Subject: tv.wwan: init --- tv/3modules/default.nix | 1 + tv/3modules/wwan.nix | 163 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 tv/3modules/wwan.nix diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix index c49f1582f..8c1066b71 100644 --- a/tv/3modules/default.nix +++ b/tv/3modules/default.nix @@ -14,5 +14,6 @@ ./slock.nix ./x0vncserver.nix ./Xresources.nix + ./wwan.nix ]; } diff --git a/tv/3modules/wwan.nix b/tv/3modules/wwan.nix new file mode 100644 index 000000000..703a903c9 --- /dev/null +++ b/tv/3modules/wwan.nix @@ -0,0 +1,163 @@ +with import ./lib; +{ config, pkgs, ... }: { + options = { + tv.wwan.enable = mkEnableOption "tv.wwan"; + tv.wwan.apn = mkOption { + type = with types; filename; + }; + tv.wwan.device = mkOption { + type = with types; pathname; + default = "/dev/cdc-wdm0"; + }; + tv.wwan.interface = mkOption { + type = with types; nullOr filename; + default = null; + }; + tv.wwan.operators = mkOption { + type = with types; listOf username; + default = []; + }; + tv.wwan.secrets = mkOption { + type = with types; pathname; + default = toString ; + # format: {"pin1":number} + }; + }; + config = let + cfg = config.tv.wwan; + in mkIf cfg.enable { + systemd.services.wwan = { + environment = { + DEVICE = cfg.device; + SECRETS = "%d/secrets"; + }; + path = [ + pkgs.busybox + pkgs.coreutils + pkgs.iproute2 + pkgs.jq + (pkgs.symlinkJoin { + name = "uqmi-wrapper"; + paths = [ + (pkgs.writeDashBin "uqmi" '' + set -efu + exec ${pkgs.uqmi}/bin/uqmi --device="$DEVICE" "$@" + '') + pkgs.uqmi + ]; + }) + (pkgs.writeDashBin "get-interface" ( + if cfg.interface != null then /* sh */ '' + echo ${cfg.interface} + '' else /* sh */ '' + exec ${pkgs.libqmi}/bin/qmicli -d "$DEVICE" -p --get-wwan-iface + '' + )) + ]; + serviceConfig = { + LoadCredential = [ + "secrets:${cfg.secrets}" + ]; + Type = "oneshot"; + RemainAfterExit = true; + SyslogIdentifier = "wwan"; + ExecStart = pkgs.writeDash "tv.wwan.start.sh" '' + set -efu + + interface=$(get-interface) + + pin1_status=$( + uqmi --uim-get-sim-state | + jq -r '"\(.pin1_status)/\(.pin1_verify_tries)"' + ) + case $pin1_status in + verified/*) + : + ;; + not_verified/3) + pin1=$(jq .pin1 "$SECRETS") + echo "verifying PIN1" >&2 + if ! uqmi --uim-verify-pin1 "$pin1"; then + echo "error: failed to verify PIN1" >&2 + exit 1 + fi + ;; + not_verified/*) + echo "error: not trying to verify PIN1: not enough tries left" >&2 + echo \ + "please check your configuration in ${cfg.secrets}" \ + " and verify if manually using:" \ + " ${pkgs.uqmi}/bin/uqmi -d $device --uim-veriy-pin1 XXXX" \ + >&2 + exit 1 + esac + + raw_ip_path=/sys/class/net/$interface/qmi/raw_ip + raw_ip=$(cat "$raw_ip_path") + if [ "$raw_ip" != Y ]; then + echo "enabling raw-ip" >&2 + if ! echo Y > "$raw_ip_path"; then + echo "error: failed to enable raw-ip" >&2 + exit 1 + fi + fi + + operating_mode=$(uqmi --get-device-operating-mode | tr -d \") + case $operating_mode in + online) + : + ;; + persistent_low_power|low_power) + echo "settings device operating mode to online" >&2 + uqmi --set-device-operating-mode online + operating_mode=$(uqmi --get-device-operating-mode | tr -d \") + if test "$operating_mode" != online; then + echo "error: failed to set device operating mode to online" >&2 + exit 1 + fi + ;; + *) + echo "error: don't know how to change device operating mode to online: $operating_mode" >&2 + exit 1 + esac + + ip link set dev "$interface" up + + data_status=$(uqmi --get-data-status | tr -d \") + case $data_status in + connected) + : + ;; + disconnected) + echo "starting network (APN=${cfg.apn})" >&2 + sleep 1 + uqmi \ + --start-network \ + --autoconnect \ + --apn ${cfg.apn} \ + --ip-family ipv4 + sleep 1 + ;; + *) + echo "error: unsupported data status: $data_status" >&2 + exit 1 + esac + + udhcpc -q -f -n -i "$interface" + ''; + Restart = "on-failure"; + ExecStop = pkgs.writeDash "tv.wwan.stop.sh" '' + set -efu + + interface=$(get-interface) + + ip link set dev "$interface" down + uqmi --stop-network 0xFFFFFFFF --autoconnect + uqmi --sync + uqmi --set-device-operating-mode persistent_low_power + ''; + }; + }; + tv.systemd.services.wwan.operators = cfg.operators; + }; +} -- cgit v1.2.3 From ad56590a707b3c7b4738fdd1a53546e9e30aca52 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 17:29:27 +0100 Subject: tv configs: remove unused urxvt module --- tv/2configs/urxvt.nix | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 tv/2configs/urxvt.nix diff --git a/tv/2configs/urxvt.nix b/tv/2configs/urxvt.nix deleted file mode 100644 index 89bb421aa..000000000 --- a/tv/2configs/urxvt.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ pkgs, ... }: - -with builtins; - -let - users = [ "tv" ]; - urxvt = pkgs.rxvt_unicode; - mkService = user: { - description = "urxvt terminal daemon"; - wantedBy = [ "multi-user.target" ]; - restartIfChanged = false; - serviceConfig = { - Restart = "always"; - User = user; - ExecStart = "${urxvt}/bin/urxvtd"; - }; - }; - -in - -{ - environment.systemPackages = [ urxvt ]; - systemd.services = listToAttrs (map (u: { name = "${u}-urxvtd"; value = mkService u; }) users); -} -- cgit v1.2.3 From 9a7e3bf96250d9f9090d4eebac18240f54167a84 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 20:23:18 +0100 Subject: tv.systemd.services: add default value --- tv/3modules/systemd.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/tv/3modules/systemd.nix b/tv/3modules/systemd.nix index bbbab0632..db8a51994 100644 --- a/tv/3modules/systemd.nix +++ b/tv/3modules/systemd.nix @@ -12,6 +12,7 @@ in { }; }; })); + default = {}; }; }; config = { -- cgit v1.2.3 From a8cb1328737926cf948d1a7dfbdfd6eff35428d9 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Jan 2023 21:20:08 +0100 Subject: tv xmonad: add ewmh --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 6ac6b6b10..2061ae4b9 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -4,6 +4,7 @@ module Main (main) where import System.Exit (exitFailure) +import XMonad.Hooks.EwmhDesktops (ewmh) import Control.Exception import Control.Monad.Extra (whenJustM)