diff options
39 files changed, 317 insertions, 128 deletions
diff --git a/configs/alacritty.nix b/configs/alacritty.nix index 25fb2c3..1a8eb92 100644 --- a/configs/alacritty.nix +++ b/configs/alacritty.nix @@ -24,7 +24,7 @@ let colors.bright.magenta = "#fb53fb"; colors.bright.cyan = "#72fbfb"; colors.bright.white = "#fbfbfb"; - draw_bold_text_with_bright_colors = false; + colors.draw_bold_text_with_bright_colors = false; hints.enabled = [ { regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+"; @@ -33,6 +33,7 @@ let action = "Select"; } ]; + mouse.hide_when_typing = true; scrolling.multiplier = 8; }; configs.root = lib.recursiveUpdate configs.default { @@ -51,18 +52,18 @@ let font.bold.family = "iosevka tv 2 Medium"; font.bold_italic.family = "iosevka tv 2 Medium"; font.size = 5; - key_bindings = [ + keyboard.bindings = [ { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; } { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; } { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; } ]; }; - variants.x220 = { + variants.lodpi = { font.normal.family = "Clean"; font.bold.family = "Clean"; font.bold.style = "Regular"; font.size = 10; - key_bindings = let + keyboard.bindings = let font-size = arg: { program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; args = [arg]; @@ -79,14 +80,17 @@ let fu = "hidpi"; leg = "hidpi"; ru = "hidpi"; - }.${config.krebs.build.host.name} or "x220"; + zoppo = "hidpi"; + }.${config.krebs.build.host.name} or "lodpi"; + + format = pkgs.formats.toml {}; in { environment.etc = lib.mapAttrs' - (name: config: lib.nameValuePair "alacritty/${name}.json" { - source = pkgs.writeJSON "alacritty-${name}.json" config; + (name: config: lib.nameValuePair "alacritty/${name}.toml" { + source = format.generate "alacritty-${name}.toml" config; }) configs; diff --git a/configs/bluetooth.nix b/configs/bluetooth.nix new file mode 100644 index 0000000..899dd2f --- /dev/null +++ b/configs/bluetooth.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: { + hardware.bluetooth.enable = true; + systemd.user.services.obex.enable = false; + environment.systemPackages = [ + pkgs.bluetuith + ]; +} diff --git a/configs/default.nix b/configs/default.nix index 5d74d96..06fd83a 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -11,7 +11,6 @@ imports = [ ./backup.nix ./bash - ./htop.nix ./nets/hkw.nix ./networkd.nix ./nginx @@ -19,6 +18,7 @@ ./pki ./ssh.nix ./sshd.nix + ./tmux.nix ./vim.nix ./xdg.nix { @@ -53,7 +53,7 @@ environment.profileRelativeEnvVars.PATH = lib.mkForce [ "/bin" ]; environment.systemPackages = with pkgs; [ - rxvt_unicode.terminfo + rxvt-unicode-unwrapped.terminfo ]; environment.shellAliases = lib.mkForce { diff --git a/configs/gitrepos.nix b/configs/gitrepos.nix index 0e61989..174e303 100644 --- a/configs/gitrepos.nix +++ b/configs/gitrepos.nix @@ -126,7 +126,7 @@ hc = {}; mime = {}; quipper = {}; - scanner = {}; + terminal-scanner = {}; wai-middleware-time = {}; web-routes-wai-custom = {}; xintmap = {}; diff --git a/configs/htop.nix b/configs/htop.nix deleted file mode 100644 index e60cc51..0000000 --- a/configs/htop.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ pkgs, ... }: { - nixpkgs.config.packageOverrides = super: { - htop = pkgs.symlinkJoin { - name = "htop"; - paths = [ - (pkgs.writeDashBin "htop" '' - export HTOPRC=${pkgs.writeText "htoprc" '' - fields=0 48 17 18 38 39 40 2 46 47 49 1 - sort_key=46 - sort_direction=1 - hide_threads=0 - hide_kernel_threads=1 - hide_userland_threads=0 - shadow_other_users=1 - show_thread_names=1 - show_program_path=1 - highlight_base_name=1 - highlight_megabytes=1 - highlight_threads=1 - tree_view=1 - header_margin=0 - detailed_cpu_time=0 - cpu_count_from_zero=0 - update_process_names=0 - account_guest_in_cpu_meter=1 - color_scheme=0 - delay=15 - left_meters=LeftCPUs2 RightCPUs2 Memory Swap - left_meter_modes=1 1 1 1 - right_meters=Uptime Tasks LoadAverage Battery - right_meter_modes=2 2 2 2 - ''} - exec ${super.htop}/bin/htop "$@" - '') - super.htop - ]; - }; - }; -} diff --git a/configs/hw/winmax2.nix b/configs/hw/winmax2.nix index 7b28466..4bcd6f1 100644 --- a/configs/hw/winmax2.nix +++ b/configs/hw/winmax2.nix @@ -20,11 +20,10 @@ hardware.cpu.amd.updateMicrocode = true; hardware.enableRedistributableFirmware = true; - hardware.opengl.enable = true; - hardware.opengl.extraPackages = [ + hardware.graphics.enable = true; + hardware.graphics.extraPackages = [ pkgs.amdvlk - pkgs.rocm-opencl-icd - pkgs.rocm-opencl-runtime + pkgs.rocmPackages.clr ]; networking.wireless.enable = true; diff --git a/configs/hw/x220.nix b/configs/hw/x220.nix index 6993413..6ae6cec 100644 --- a/configs/hw/x220.nix +++ b/configs/hw/x220.nix @@ -49,7 +49,7 @@ # Required for Centrino. hardware.enableRedistributableFirmware = true; - hardware.opengl.extraPackages = [ pkgs.vaapiIntel pkgs.vaapiVdpau ]; + hardware.graphics.extraPackages = [ pkgs.vaapiIntel pkgs.vaapiVdpau ]; hardware.trackpoint = { enable = true; diff --git a/configs/man.nix b/configs/man.nix index c723138..8839476 100644 --- a/configs/man.nix +++ b/configs/man.nix @@ -7,7 +7,7 @@ #''; environment.systemPackages = [ pkgs.man-pages - pkgs.posix_man_pages + pkgs.man-pages-posix pkgs.xorg.xorgdocs ]; } diff --git a/configs/pulse.nix b/configs/pulse.nix index 17c203c..9c317ae 100644 --- a/configs/pulse.nix +++ b/configs/pulse.nix @@ -6,19 +6,19 @@ support32Bit = pkgs.stdenv.isx86_64 && - pkgs_i686.alsaLib != null && + pkgs_i686.alsa-lib != null && pkgs_i686.libpulseaudio != null; alsaConf = pkgs.writeText "asound.conf" '' ctl_type.pulse { - libs.native = ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so; + libs.native = ${pkgs.alsa-plugins}/lib/alsa-lib/libasound_module_ctl_pulse.so; ${lib.optionalString support32Bit - "libs.32Bit = ${pkgs_i686.alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so;"} + "libs.32Bit = ${pkgs_i686.alsa-plugins}/lib/alsa-lib/libasound_module_ctl_pulse.so;"} } pcm_type.pulse { - libs.native = ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so; + libs.native = ${pkgs.alsa-plugins}/lib/alsa-lib/libasound_module_pcm_pulse.so; ${lib.optionalString support32Bit - "libs.32Bit = ${pkgs_i686.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so;"} + "libs.32Bit = ${pkgs_i686.alsa-plugins}/lib/alsa-lib/libasound_module_pcm_pulse.so;"} } ctl.!default { type pulse diff --git a/configs/sshd.nix b/configs/sshd.nix index 281d498..d99ceb5 100644 --- a/configs/sshd.nix +++ b/configs/sshd.nix @@ -1,6 +1,7 @@ { config, lib, ... }: let cfg.host = config.krebs.build.host; nets = + lib.optional (cfg.host.nets?mycelium) cfg.host.nets.mycelium ++ lib.optional (cfg.host.nets?retiolum) cfg.host.nets.retiolum ++ lib.optional (cfg.host.nets?wiregrill) cfg.host.nets.wiregrill; in { diff --git a/configs/tmux.nix b/configs/tmux.nix new file mode 100644 index 0000000..a61b8c3 --- /dev/null +++ b/configs/tmux.nix @@ -0,0 +1,11 @@ +{ + programs.tmux.enable = true; + programs.tmux.baseIndex = 1; + programs.tmux.clock24 = true; + programs.tmux.escapeTime = 0; + programs.tmux.historyLimit = 10000; + programs.tmux.terminal = "tmux-direct"; + programs.tmux.extraConfig = '' + setw -g mouse on + ''; +} diff --git a/configs/vim.nix b/configs/vim.nix index cfe30eb..8f06084 100644 --- a/configs/vim.nix +++ b/configs/vim.nix @@ -130,6 +130,8 @@ au BufRead,BufNewFile /dev/shm/* set nobackup nowritebackup noswapfile + au TabClosed * tabp + cnoremap <C-A> <Home> noremap <C-c> :q<cr> diff --git a/configs/xserver/default.nix b/configs/xserver/default.nix index e0b8d77..884a982 100644 --- a/configs/xserver/default.nix +++ b/configs/xserver/default.nix @@ -115,7 +115,7 @@ in { config.tv.slock.package pkgs.flameshot-once-tv pkgs.pulseaudio.out - pkgs.rxvt_unicode + pkgs.rxvt-unicode-unwrapped pkgs.xcalib "/run/wrappers" # for su ]; diff --git a/configs/xserver/urxvt.nix b/configs/xserver/urxvt.nix index c4e619d..d3c90fd 100644 --- a/configs/xserver/urxvt.nix +++ b/configs/xserver/urxvt.nix @@ -6,7 +6,7 @@ in { restartIfChanged = false; serviceConfig = { SyslogIdentifier = "urxvtd"; - ExecStart = "${pkgs.rxvt_unicode}/bin/urxvtd"; + ExecStart = "${pkgs.rxvt-unicode-unwrapped}/bin/urxvtd"; Restart = "always"; RestartSec = "2s"; StartLimitBurst = 0; diff --git a/configs/xsessions/urxvtd.nix b/configs/xsessions/urxvtd.nix index de16a63..80d4b3d 100644 --- a/configs/xsessions/urxvtd.nix +++ b/configs/xsessions/urxvtd.nix @@ -9,7 +9,7 @@ RXVT_SOCKET = "%t/urxvtd"; }; serviceConfig = { - ExecStart = "${pkgs.rxvt_unicode}/bin/urxvtd"; + ExecStart = "${pkgs.rxvt-unicode-unwrapped}/bin/urxvtd"; }; }; } diff --git a/lib/pure.nix b/lib/pure.nix index edf7292..ab4be9a 100644 --- a/lib/pure.nix +++ b/lib/pure.nix @@ -9,6 +9,14 @@ let }; in filterAttrsRecursive (name: _: !hasPrefix "_" name) eval.config; + evalOption = option: config: + (lib.evalModules { + modules = lib.singleton { + options.x = option; + config.x = config; + }; + }).config.x; + evalSource = import ./eval-source.nix; evalSubmodule = submodule: modules: let diff --git a/modules/lidControl.nix b/modules/lidControl.nix index 6beb032..a35e178 100644 --- a/modules/lidControl.nix +++ b/modules/lidControl.nix @@ -11,7 +11,7 @@ # usage: vt_is_xserver NUMBER vt_is_xserver() { - ${pkgs.iproute}/bin/ss -lp src unix:/tmp/.X11-unix/X* | + ${pkgs.iproute2}/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" } diff --git a/pkgs/haskell/blessings.nix b/pkgs/haskell/blessings.nix new file mode 100644 index 0000000..65661aa --- /dev/null +++ b/pkgs/haskell/blessings.nix @@ -0,0 +1,16 @@ +{ mkDerivation, base, bytestring, fetchgit, hspec, QuickCheck, lib, mylib, text }: + +mkDerivation { + pname = "blessings"; + version = "2.3.0"; + src = fetchgit { + url = http://cgit.ni.krebsco.de/blessings; + rev = "refs/tags/v2.3.0"; + hash = "sha256-fS79UOHBMfJHyz7E0Rx4lKZSZOD2G99h2zuDT+SOUJQ="; + }; + libraryHaskellDepends = [ base bytestring text ]; + testHaskellDepends = [ base hspec QuickCheck ]; + doHaddock = false; + # WTFPL is the true license, which is unknown to cabal. + license = lib.licenses.wtfpl; +} diff --git a/pkgs/haskell/desktop-pager.nix b/pkgs/haskell/desktop-pager.nix index 3b96159..8301235 100644 --- a/pkgs/haskell/desktop-pager.nix +++ b/pkgs/haskell/desktop-pager.nix @@ -1,15 +1,15 @@ { mkDerivation, aeson, base, blessings, bytestring, containers , data-default, extra, fetchgit, hack, lib, optparse-applicative -, probability, scanner, speculate, split, terminal-size, text, unix -, utf8-string, X11 +, probability, speculate, split, terminal-scanner, terminal-size +, text, unix, utf8-string, X11 }: mkDerivation { pname = "desktop-pager"; version = "1.0.0"; src = fetchgit { url = "https://cgit.krebsco.de/desktop-pager"; - sha256 = "11v4f2sz6p69fx2804w0akb8xqv56g89chjyx77jhwqcng2bn6pw"; - rev = "0894fbe50ee2f63b510d32ab8c524134e450f20d"; + sha256 = "1hb8an31szwx9zixzb1m7219jrz3cdz57phf45r4b3n6qrzcn35l"; + rev = "3919fb8adc06134a304d4fcbcd192c8707c06cbd"; fetchSubmodules = true; }; isLibrary = true; @@ -17,7 +17,7 @@ mkDerivation { libraryHaskellDepends = [ base extra utf8-string X11 ]; executableHaskellDepends = [ aeson base blessings bytestring containers data-default hack - optparse-applicative probability scanner speculate split + optparse-applicative probability speculate split terminal-scanner terminal-size text unix X11 ]; license = lib.licenses.mit; diff --git a/pkgs/haskell/hack.nix b/pkgs/haskell/hack.nix index f1b22b5..0eb0232 100644 --- a/pkgs/haskell/hack.nix +++ b/pkgs/haskell/hack.nix @@ -1,13 +1,14 @@ { mkDerivation, base, blessings, containers, data-default, fetchgit -, lens, lib, mtl, old-locale, process, input-scanner, time, unix, zippers +, lens, lib, mtl, old-locale, process, terminal-scanner, time, unix +, zippers }: mkDerivation { pname = "hack"; - version = "1.0.2"; + version = "1.0.3"; src = fetchgit { url = "https://cgit.krebsco.de/hack"; - hash = "sha256-QHSGF4wFwLyn8W8jYbN1QajMnmQqUI+7VWk7yVvJgIg="; - rev = "refs/tags/1.0.2"; + sha256 = "04vxcfm204sxn3v48ch27srgqgpiqbm9i82lrmgp1yyx84wchq32"; + rev = "a6fc1e51f1f87a7cc485a47000f23f1f054beb95"; fetchSubmodules = true; }; isLibrary = true; @@ -15,7 +16,8 @@ mkDerivation { libraryHaskellDepends = [ base ]; executableHaskellDepends = [ base blessings containers data-default lens mtl old-locale process - input-scanner time unix zippers + terminal-scanner time unix zippers ]; license = lib.licenses.mit; + mainProgram = "hack"; } diff --git a/pkgs/haskell/much.nix b/pkgs/haskell/much.nix index 865294d..9744a25 100644 --- a/pkgs/haskell/much.nix +++ b/pkgs/haskell/much.nix @@ -3,17 +3,17 @@ , containers, data-default, deepseq, directory, either , email-header, fetchgit, filepath, friendly-time, http-types , hyphenation, lib, linebreak, network, old-locale -, optparse-applicative, process, random, rosezipper, safe, scanner -, servant-server, split, terminal-size, text, time, transformers -, transformers-compat, unix, vector, wai, warp +, optparse-applicative, process, random, rosezipper, safe +, servant-server, split, terminal-scanner, terminal-size, text +, time, transformers, transformers-compat, unix, vector, wai, warp }: mkDerivation rec { pname = "much"; version = "1.3.2"; src = fetchgit { url = "https://cgit.krebsco.de/much"; - hash = "sha256-q65EYO1d3NYVv2NECkGWPb1TyHGdARNi/GX4pgQmljc="; - rev = "refs/tags/${version}"; + sha256 = "001lvn4f3pgxwq0fgxvk0jl33r54gvh908r6wx02fw4s6b3sysc0"; + rev = "3a0fe1da7c33b024128079f5810c6a99b25aebe7"; fetchSubmodules = true; }; isLibrary = true; @@ -23,14 +23,15 @@ mkDerivation rec { bytestring case-insensitive containers data-default deepseq directory either email-header filepath friendly-time http-types hyphenation linebreak network old-locale optparse-applicative - process random rosezipper safe scanner servant-server split - terminal-size text time transformers transformers-compat unix - vector wai warp + process random rosezipper safe servant-server split + terminal-scanner terminal-size text time transformers + transformers-compat unix vector wai warp ]; executableHaskellDepends = [ aeson base blessings bytestring case-insensitive containers data-default deepseq directory filepath hyphenation linebreak - process rosezipper safe scanner text time transformers unix + process rosezipper safe terminal-scanner text time transformers + unix ]; license = lib.licenses.mit; } diff --git a/pkgs/haskell/terminal-scanner.nix b/pkgs/haskell/terminal-scanner.nix new file mode 100644 index 0000000..4801df7 --- /dev/null +++ b/pkgs/haskell/terminal-scanner.nix @@ -0,0 +1,13 @@ +{ mkDerivation, base, fetchgit, lib }: +mkDerivation { + pname = "terminal-scanner"; + version = "1.0.1"; + src = fetchgit { + url = "https://cgit.krebsco.de/terminal-scanner"; + sha256 = "1ic8j2nlhmy76fnqji277wsl1cikd9y4lwqqcxzldjx1vi61r13r"; + rev = "3c5301303230f563214c5ff003f9fc8e2e0a7199"; + fetchSubmodules = true; + }; + libraryHaskellDepends = [ base ]; + license = lib.licenses.mit; +} diff --git a/pkgs/haskell/xmonad-tv/src/main.hs b/pkgs/haskell/xmonad-tv/src/main.hs index 1878d8e..e3090a3 100644 --- a/pkgs/haskell/xmonad-tv/src/main.hs +++ b/pkgs/haskell/xmonad-tv/src/main.hs @@ -20,15 +20,13 @@ import XMonad.Extra (isFloatingX) import System.IO (hPutStrLn, stderr) import System.Environment (getArgs, getEnv, getEnvironment, lookupEnv) import System.Posix.Process (executeFile) -import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace - , removeEmptyWorkspace) +import XMonad.Actions.DynamicWorkspaces (removeEmptyWorkspace) import XMonad.Actions.CycleWS (toggleWS) import XMonad.Layout.Gaps (Direction2D(U,R,D,L), gaps) 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) import qualified Data.Map as Map @@ -72,11 +70,10 @@ readEnv' defaultValue name = mainNoArgs :: IO () mainNoArgs = do + myMasterDelta <- readEnv' (1 / 20) "XMONAD_MASTER_DELTA" :: IO Rational + myMasterWidth <- readEnv' (1 / 2) "XMONAD_MASTER_WIDTH" :: IO Rational myScreenGaps <- readEnv' [] "XMONAD_SCREEN_GAPS" :: IO [Int] 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 handleShutdownEvent <- newShutdownEventHandler config <- ewmhExtra @@ -93,15 +90,15 @@ mainNoArgs = do { terminal = {-pkg:alacritty-tv-}"alacritty" , clientMask = clientMask def .|. focusChangeMask , modMask = mod4Mask - , keys = myKeys myTermFont + , keys = myKeys , layoutHook = refocusLastLayoutHook $ gaps (zip [U,R,D,L] myScreenGaps) $ smartBorders $ ResizableTall 1 - (fromIntegral (10 * myTermFontWidth) / fromIntegral myScreenWidth) - (fromIntegral (80 * myTermFontWidth + 2 * (myTermPadding + borderWidth def)) / fromIntegral myScreenWidth) + myMasterDelta + (myMasterWidth + 2 * fromIntegral (borderWidth def) / fromIntegral myScreenWidth) [] ||| StateFull @@ -148,8 +145,8 @@ spawnRootTerm = Nothing -myKeys :: String -> XConfig Layout -> Map (KeyMask, KeySym) (X ()) -myKeys font conf = Map.fromList $ +myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ()) +myKeys conf = Map.fromList $ [ ((_4 , xK_Escape ), forkFile {-pkg-}"slock" [] Nothing) , ((_4S , xK_c ), kill) @@ -185,8 +182,6 @@ myKeys font conf = Map.fromList $ , ((_4 , xK_comma ), sendMessage $ IncMasterN 1) , ((_4 , xK_period ), sendMessage $ IncMasterN (-1)) - , ((_4 , xK_a ), addWorkspacePrompt promptXPConfig) - , ((_4 , xK_r ), renameWorkspace promptXPConfig) , ((_4 , xK_Delete ), removeEmptyWorkspace) , ((_4 , xK_Return ), toggleWS) @@ -215,7 +210,7 @@ myKeys font conf = Map.fromList $ _4CM = _4 .|. _C .|. _M _4SM = _4 .|. _S .|. _M - amixer args = forkFile {-pkg:alsaUtils-}"amixer" args Nothing + amixer args = forkFile {-pkg:alsa-utils-}"amixer" args Nothing pavucontrol args = forkFile {-pkg-}"pavucontrol" args Nothing audioLowerVolume = amixer ["-q", "sset", "Master", "5%-"] @@ -225,14 +220,10 @@ myKeys font conf = Map.fromList $ resetLayout = setLayout $ XMonad.layoutHook conf - promptXPConfig = - def { XMonad.Prompt.font = font } - xdeny = forkFile {-pkg-}"xterm" - [ "-fn", font - , "-geometry", "300x100" + [ "-geometry", "300x100" , "-name", "AlertFloat" , "-bg", "#E4002B" , "-e", "sleep", "0.05" diff --git a/pkgs/override/htop.nix b/pkgs/override/htop.nix new file mode 100644 index 0000000..38a19e0 --- /dev/null +++ b/pkgs/override/htop.nix @@ -0,0 +1,36 @@ +self: super: +self.symlinkJoin { + name = "htop"; + paths = [ + (self.writeDashBin "htop" '' + export HTOPRC=${self.writeText "htoprc" '' + fields=0 48 17 18 38 39 40 2 46 47 49 1 + sort_key=46 + sort_direction=1 + hide_threads=0 + hide_kernel_threads=1 + hide_userland_threads=0 + shadow_other_users=1 + show_thread_names=1 + show_program_path=1 + highlight_base_name=1 + highlight_megabytes=1 + highlight_threads=1 + tree_view=1 + header_margin=0 + detailed_cpu_time=0 + cpu_count_from_zero=0 + update_process_names=0 + account_guest_in_cpu_meter=1 + color_scheme=0 + delay=15 + left_meters=LeftCPUs2 RightCPUs2 Memory Swap + left_meter_modes=1 1 1 1 + right_meters=Uptime Tasks LoadAverage Battery + right_meter_modes=2 2 2 2 + ''} + exec ${super.htop}/bin/htop "$@" + '') + super.htop + ]; +} diff --git a/pkgs/shell/default.nix b/pkgs/shell/default.nix index 119b23e..ce6123d 100644 --- a/pkgs/shell/default.nix +++ b/pkgs/shell/default.nix @@ -15,7 +15,11 @@ let assert mylib.types.filename.check name; assert isShellScript path; self.callPackage - ({ pkgs }: pkgs.runCommand "${name}" {} /* sh */ '' + ({ pkgs }: pkgs.runCommand "${name}" { + meta = { + mainProgram = name; + }; + } /* sh */ '' mkdir -p $out/bin touch $out/bin/${name} chmod +x $out/bin/${name} diff --git a/pkgs/shell/genpasswd b/pkgs/shell/genpasswd new file mode 100755 index 0000000..a6d96aa --- /dev/null +++ b/pkgs/shell/genpasswd @@ -0,0 +1,56 @@ +#! /bin/sh +#!buildShellBin path=coreutils +# +# NAME +# genpasswd - generate a password +# +# SYNOPSIS +# genpasswd [OPTION]... +# +# DESCRIPTION +# Produce a random string of a given length and alphabet to standard +# output. +# +# --length=number (default: 71) +# Specify the number of bytes to produce. +# +# --alphabet=string (default: -+.,=/A-Za-z0-9_) +# Specify the list of characters that can be produced. +# The string gets interpreted by tr and may contain single-character +# collating elements. See tr(1) for details. +# +# --newline=bool (default: true) +# Specify whether a newline should be appended to the output. +# + +set -efu + +alphabet=-+.,=/A-Za-z0-9_ +length=71 +newline=true + +while test $# -gt 0; do + case $1 in + --alphabet=*) + alphabet=${1//--alphabet=} + shift + ;; + --length=*) + length=${1//--length=} + shift + ;; + --newline=true|--newline=false) + newline=${1//--newline=} + shift + ;; + *) + echo "$0: bad argument: $1" >&2 + exit 1 + esac +done + +tr -dc -- "$alphabet" < /dev/urandom | dd status=none bs="$length" count=1 + +case $newline in true) + echo +esac diff --git a/pkgs/shell/with-ssh b/pkgs/shell/with-ssh new file mode 100755 index 0000000..65459e2 --- /dev/null +++ b/pkgs/shell/with-ssh @@ -0,0 +1,37 @@ +#! /bin/sh +#!buildShellBin prepend-path=openssh +# +# usage: with-ssh [--add[=KEY] ...] [COMMAND [ARGS ...]] +# + +set -efu + +case ${WITH_SSH_STAGE-1} in + 1) + export WITH_SSH_STAGE=2 + exec ssh-agent "$0" "$@" + ;; + 2) + if test $# = 0; then + set -- "$SHELL" + fi + case "$1" in + --add) + shift + ssh-add + exec "$0" + ;; + --add=*) + key=$1; shift + key=${key#--add=} + ssh-add "$key" + exec "$0" "$@" + ;; + *) + exec "$@" + esac + ;; + *) + echo "with-ssh: error: bad stage: $WITH_SSH_STAGE" >&2 + exit 1 +esac diff --git a/pkgs/simple/alacritty-tv.nix b/pkgs/simple/alacritty-tv.nix index 0e65434..bea5776 100644 --- a/pkgs/simple/alacritty-tv.nix +++ b/pkgs/simple/alacritty-tv.nix @@ -7,7 +7,7 @@ pkgs.symlinkJoin { # usage: # alacritty [--profile=PROFILE] [--singleton] [ARGS...] # where - # PROFILE must have a corresponding file /etc/alacritty/PROFILE.json + # PROFILE must have a corresponding file /etc/alacritty/PROFILE.toml set -efu @@ -18,12 +18,12 @@ pkgs.symlinkJoin { shift esac - config=/etc/alacritty/$profile.json + config=/etc/alacritty/$profile.toml if ! test -e "$config"; then echo "$0: warning: bad profile: $profile; using default instead" >&2 profile=default - config=/etc/alacritty/default.json + config=/etc/alacritty/default.toml fi case ''${1-} in diff --git a/pkgs/simple/editor-input.nix b/pkgs/simple/editor-input.nix index 931179a..536084d |