From e203311de813949dec992b76b04410068768eaf5 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 10 Mar 2021 21:21:55 +0100 Subject: =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- accounts/gkleen@sif/default.nix | 59 +++++++++++++++++++++++++++++----- accounts/gkleen@sif/dunst-settings.nix | 3 ++ accounts/gkleen@sif/emacs.el | 7 ++++ accounts/gkleen@sif/scripts/mute.zsh | 18 +++++++++++ accounts/gkleen@sif/ssh-hosts.nix | 22 +++++++++---- accounts/gkleen@sif/xmobar/xmobar.hs | 2 +- accounts/gkleen@sif/xmonad/xmonad.hs | 7 ++-- flake.lock | 18 +++++------ hosts/sif/default.nix | 3 ++ user-profiles/mpv/default.nix | 4 +-- users/gkleen/default.nix | 2 +- 11 files changed, 115 insertions(+), 30 deletions(-) create mode 100755 accounts/gkleen@sif/scripts/mute.zsh diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 9dbe4634..991d7f7f 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -10,6 +10,43 @@ let mimeType = "text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;"; exec = "${config.home-manager.users.${userName}.programs.emacs.package}/bin/emacsclient -a \"\" %F"; }; + emacsScratch = pkgs.stdenv.mkDerivation rec { + pname = "scratch"; + version = "0077334cc299aa7885f804d88f52cdb1b35caf71"; + + src = pkgs.fetchFromGitHub { + owner = "ffevotte"; + repo = "scratch.el"; + rev = version; + sha256 = "sha256-FUkKJ+1COGzgllzzv51yUIjMZI6slOFVExdwWl2ZEBA="; + }; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/share/emacs/site-lisp + cp $src/scratch.el $out/share/emacs/site-lisp/default.el + ''; + }; + muteScript = pkgs.stdenv.mkDerivation { + name = "mute"; + src = ./scripts/mute.zsh; + + buildInputs = with pkgs; [ makeWrapper ]; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/bin + install -m 0755 $src $out/bin/mute + wrapProgram $out/bin/mute \ + --prefix PATH : ${pkgs.zsh}/bin \ + --prefix PATH : ${pkgs.findutils}/bin \ + --prefix PATH : ${pkgs.util-linux}/bin \ + --prefix PATH : ${pkgs.coreutils}/bin \ + --prefix PATH : ${pkgs.pulseaudio}/bin + ''; + }; in { imports = with flake.nixosModules.userProfiles.${userName}; [ mpv @@ -20,8 +57,8 @@ in { ssh = { matchBlocks = import ./ssh-hosts.nix; # customUtils.recImport { dir = ./ssh-hosts; }; extraConfig = '' - Match host uniworx3.ifi.lmu.de,uniworx4.ifi.lmu.de,uni2workgw.ifi.lmu.de,blackbeard.tcs.ifi.lmu.de,gitlab2.rz.ifi.lmu.de,oregon.tcs.ifi.lmu.de !exec "nc -z -w 1 %h %p &>/dev/null" - ProxyJump gate + Match host uniworx3.ifi.lmu.de,uniworx4.ifi.lmu.de,uniworx5.ifi.lmu.de,uni2workgw.ifi.lmu.de,blackbeard.tcs.ifi.lmu.de,gitlab2.rz.ifi.lmu.de,oregon.tcs.ifi.lmu.de !exec "nc -z -w 1 %h %p &>/dev/null" + ProxyJump gate2 Host * ''; @@ -33,8 +70,8 @@ in { evil evil-dvorak evil-magit undo-tree magit haskell-mode nix-mode yaml-mode json-mode shakespeare-mode smart-mode-line highlight-parentheses highlight-symbol - notmuch ag sass-mode lua-mode fira-code-mode - use-package use-package-ensure-system-package git-gutter + notmuch ag sass-mode lua-mode fira-code-mode use-package + use-package-ensure-system-package git-gutter emacsScratch ]; }; firefox = { @@ -97,12 +134,18 @@ in { docs = "$HOME/documents"; dl = "$HOME/Downloads"; flk = "$HOME/config/nixos-flakes"; + fsk-timi = "$HOME/projects/21s/fsk-timi"; + }; + + obs-studio = { + enable = true; + plugins = with pkgs; [obs-v4l2sink]; }; }; services = { dunst = { - settings = import ./dunst-settings.nix; + settings = import ./dunst-settings.nix inputs; iconTheme = cfg.gtk.iconTheme; enable = true; }; @@ -130,8 +173,8 @@ in { sxhkd = { enable = true; keybindings = { - "button8" = "${pkgs.pulseaudio}/bin/pacmd set-source-mute @DEFAULT_SOURCE@ 0"; - "@button8" = "${pkgs.pulseaudio}/bin/pacmd set-source-mute @DEFAULT_SOURCE@ 1"; + "button8" = "${muteScript}/bin/mute unmute"; + "@button8" = "${muteScript}/bin/mute mute"; "button9" = "${pkgs.pulseaudio}/bin/pacmd set-sink-mute @DEFAULT_SINK@ 1"; "@button9" = "${pkgs.pulseaudio}/bin/pacmd set-sink-mute @DEFAULT_SINK@ 0"; }; @@ -179,7 +222,7 @@ in { google-play-music-desktop-player qt5ct playerctl evince thunderbird zulip zoom-us steam steam-run wireshark skype virt-manager rclone cached-nix-shell xournal discord xmonad - worktime fira-code-symbols emacsclientDesktopItem + worktime fira-code-symbols emacsclientDesktopItem libreoffice ]; file = { diff --git a/accounts/gkleen@sif/dunst-settings.nix b/accounts/gkleen@sif/dunst-settings.nix index 8319da03..8abdfc5a 100644 --- a/accounts/gkleen@sif/dunst-settings.nix +++ b/accounts/gkleen@sif/dunst-settings.nix @@ -1,3 +1,4 @@ +{ pkgs, ... }: { global = { font = "Monospace 6"; @@ -25,6 +26,8 @@ icon_position = "right"; sort = false; sticky_history = false; + + dmenu = "${pkgs.dmenu}/bin/dmenu"; }; shortcuts = { close = "ctrl+space"; diff --git a/accounts/gkleen@sif/emacs.el b/accounts/gkleen@sif/emacs.el index d7080e36..c8356bf2 100644 --- a/accounts/gkleen@sif/emacs.el +++ b/accounts/gkleen@sif/emacs.el @@ -31,6 +31,13 @@ (custom-set-variables '(git-gutter:update-interval 2)) (custom-set-variables '(git-gutter:hide-gutter t)) +;; (require 'scratch) +(global-set-key (kbd "C-x B") 'scratch-create) +(setq initial-major-mode 'scratch-mode) +(setq initial-scratch-message "") + +(global-set-key (kbd "C-x K") 'kill-current-buffer) + (setq backup-directory-alist `(("." . "~/.saves"))) (setq undo-tree-history-directory-alist `(("." . "~/.undo"))) (setq delete-old-versions t diff --git a/accounts/gkleen@sif/scripts/mute.zsh b/accounts/gkleen@sif/scripts/mute.zsh new file mode 100755 index 00000000..1b30ad67 --- /dev/null +++ b/accounts/gkleen@sif/scripts/mute.zsh @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh + +lockFile=~/.mute.flock + +case $1 in + mute) + ( + flock -n 9 || exit 1 + sleep 0.2 + pacmd set-source-mute @DEFAULT_SOURCE@ 1 + ) 9<>${lockFile} & + ;; + unmute) + set -o pipefail + while fuser ${lockFile} 2>/dev/null | cut -d ':' -f 2- | xargs -r -- kill; do sleep 0.001; done + pacmd set-source-mute @DEFAULT_SOURCE@ 0 + ;; +esac diff --git a/accounts/gkleen@sif/ssh-hosts.nix b/accounts/gkleen@sif/ssh-hosts.nix index 8937e743..0db4e342 100644 --- a/accounts/gkleen@sif/ssh-hosts.nix +++ b/accounts/gkleen@sif/ssh-hosts.nix @@ -77,7 +77,10 @@ port = 30363; identityFile = "~/.ssh/testworx"; }; - "remote.cip.ifi.lmu.de".user = "kleen"; + "remote.cip.ifi.lmu.de" = + { user = "kleen"; + identityFile = "~/.ssh/gkleen@sif.midgard.yggdrasil"; + }; "uniworx3" = { hostname = "uniworx3.ifi.lmu.de"; user = "root"; @@ -93,15 +96,14 @@ user = "root"; identityFile = "~/.ssh/uni2work"; }; - "uniworxdb" = - { hostname = "uniworxdb"; + "uniworxdb2" = + { hostname = "uniworxdb2"; proxyJump = "uniworx4"; user = "root"; identityFile = "~/.ssh/uni2work"; }; - "uniworxdb2" = - { hostname = "uniworxdb2"; - proxyJump = "uniworx4"; + "uniworx5" = + { hostname = "uniworx5.ifi.lmu.de"; user = "root"; identityFile = "~/.ssh/uni2work"; }; @@ -109,12 +111,14 @@ { hostname = "gate2.tcs.ifi.lmu.de"; user = "gkleen"; identityFile = "~/.ssh/tcs"; + serverAliveInterval = 0; }; "proxy.gate2" = { hostname = "gate2.tcs.ifi.lmu.de"; user = "gkleen"; identityFile = "~/.ssh/proxy.gkleen@tcs.ifi.lmu.de"; dynamicForwards = [ { port = 8118; } ]; + serverAliveInterval = 0; extraOptions = { ExitOnForwardFailure = "yes"; }; @@ -123,6 +127,7 @@ { hostname = "gate2.tcs.ifi.lmu.de"; user = "gkleen"; identityFile = "~/.ssh/proxy.gkleen@tcs.ifi.lmu.de"; + serverAliveInterval = 0; extraOptions = { ExitOnForwardFailure = "yes"; }; @@ -196,4 +201,9 @@ { hostname = "gitlab.haskell.org"; identityFile = "~/.ssh/gkleen@gitlab.haskell.org"; }; + "gitlab.lrz.de" = + { hostname = "gitlab.lrz.de"; + user = "git"; + identityFile = "~/.ssh/gkleen@gitlab.lrz.de"; + }; } diff --git a/accounts/gkleen@sif/xmobar/xmobar.hs b/accounts/gkleen@sif/xmobar/xmobar.hs index ed1f6e55..74ce7347 100644 --- a/accounts/gkleen@sif/xmobar/xmobar.hs +++ b/accounts/gkleen@sif/xmobar/xmobar.hs @@ -10,7 +10,7 @@ main = xmobar config { font = "xft:FiraCode Nerd Font Mono:style=Regular:pixelsize=21" , position = OnScreen 0 $ TopP 0 307 , bgColor = "black" - , fgColor = "grey" + , fgColor = "#808080" , overrideRedirect = False , template = let left = intercalate " | " diff --git a/accounts/gkleen@sif/xmonad/xmonad.hs b/accounts/gkleen@sif/xmonad/xmonad.hs index 7113b4e3..425beaf4 100644 --- a/accounts/gkleen@sif/xmonad/xmonad.hs +++ b/accounts/gkleen@sif/xmonad/xmonad.hs @@ -234,6 +234,7 @@ hostFromName h -- , (xK_p, [mkPassPrompt "Type password" pwType xPConfig, mkPassPrompt "Show password" pwShow xPConfig, mkPassPrompt "Copy password" pwClip xPConfig]) , (xK_w, ["sudo rewacom"]) , (xK_y, [ "tmux new-window -dt media /var/media/link.hs $(xclip -o)" + , "tmux new-window -dt media /var/media/download.hs $(xclip -o)" , "urxvtc -name media -e tmuxp load /var/media" ]) , (xK_l, [ "tmux new-window -dt media mpv $(xclip -o)" @@ -548,10 +549,10 @@ main = do sqrtTwo = approxRational (sqrt 2) (1 / 2560) xmobarPP' = xmobarPP { ppTitle = shorten 80 , ppSort = (liftM2 (.)) getSortByIndex $ return scratchpadFilterOutWorkspace - , ppUrgent = wrap "(" ")" . xmobarColor "red" "" + , ppUrgent = wrap "(" ")" . xmobarColor "#800000" "" , ppHiddenNoWindows = xmobarColor "#202020" "" . wrap "(" ")" - , ppVisible = wrap "(" ")" . xmobarColor "yellow" "" - , ppCurrent = wrap "(" ")" . xmobarColor "green" "" + , ppVisible = wrap "(" ")" . xmobarColor "#808000" "" + , ppCurrent = wrap "(" ")" . xmobarColor "#008000" "" , ppHidden = wrap "(" ")" , ppWsSep = " " , ppSep = "\n" diff --git a/flake.lock b/flake.lock index 82320451..12841dec 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1611422785, - "narHash": "sha256-6XylW5uQ/Hr2BkmOFzLdBxE8qSQNtoWL60LcpCl3Qcw=", + "lastModified": 1612737197, + "narHash": "sha256-Cb855GCEB64+n20rAquhQ5uvpqIWQYuk8zq91l7pY/Q=", "owner": "nix-community", "repo": "home-manager", - "rev": "c137866bd7d2a9c2010b618252694f395453cf59", + "rev": "d8dd2a09b0a9c2c12d733f5d1eb3fa39bbe215b8", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1611569187, - "narHash": "sha256-KWCcN3EnlA5XbleXkF3PXnQzlEXFN+p2TESShkfpNnQ=", + "lastModified": 1612775710, + "narHash": "sha256-9YYTMzA3tkjyXJrTY/zj6/e9rHPXMV9Sq1Q73c38OS0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bacfa2d9200e08bf8f4b77607e9d90222638cff3", + "rev": "93498b15264bb796d4ff3a08971b96847cdd9391", "type": "github" }, "original": { @@ -51,11 +51,11 @@ ] }, "locked": { - "lastModified": 1611531427, - "narHash": "sha256-k+TKUS8a+2o8jxwjhPI3kN8JG+rHCDemkoi3nZEuYzo=", + "lastModified": 1612773815, + "narHash": "sha256-yD0vXLZIYRwseiKt3Qgfw8WIJIYDe6vVKXmRy5iQzrs=", "owner": "Mic92", "repo": "sops-nix", - "rev": "261094cc01a40a366e09117229391cba33f9ea53", + "rev": "c3d43f833be0b24a117ba5fe555135efc5748ee1", "type": "github" }, "original": { diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix index 29a91445..2c3c9e3d 100644 --- a/hosts/sif/default.nix +++ b/hosts/sif/default.nix @@ -37,6 +37,7 @@ kernelPackages = pkgs.linuxPackages_latest; kernelParams = [ "i915.fastboot=1" "intel_pstate=no_hwp" "acpi_backlight=vendor" "thinkpad-acpi.brightness_enable=1" "quiet" ]; + extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; tmpOnTmpfs = true; }; @@ -315,6 +316,8 @@ zramSwap.enable = true; + services.pcscd.enable = true; + system.stateVersion = "20.03"; }; } diff --git a/user-profiles/mpv/default.nix b/user-profiles/mpv/default.nix index ae791668..045094db 100644 --- a/user-profiles/mpv/default.nix +++ b/user-profiles/mpv/default.nix @@ -1,4 +1,4 @@ -{ userName, pkgs, ... }: +{ config, userName, pkgs, ... }: { home-manager.users.${userName}.programs.mpv = { enable = true; @@ -8,7 +8,7 @@ config = { ytdl = true; ytdl-format = "bestvideo[width<=2560][height<=1440][fps<=60][protocol!=http_dash_segments]+bestaudio[protocol!=http_dash_segments]/best[width<=2560][height<=1440][fps<=60][protocol!=http_dash_segments]/best[protocol!=http_dash_segments]"; - ytdl-raw-options = "netrc=,mark-watched="; + ytdl-raw-options = "netrc=,mark-watched=,cookies=${config.home-manager.users.${userName}.home.homeDirectory}/Downloads/cookies.txt"; sub = false; osd-font = "DejaVu Sans"; vo = "gpu"; diff --git a/users/gkleen/default.nix b/users/gkleen/default.nix index adb839a6..582bac46 100644 --- a/users/gkleen/default.nix +++ b/users/gkleen/default.nix @@ -35,10 +35,10 @@ controlMaster = "auto"; controlPersist = "30m"; serverAliveInterval = 6; + serverAliveCountMax = 10; hashKnownHosts = true; extraConfig = '' IdentitiesOnly true - ServerAliveCountMax 10 ''; }; -- cgit v1.2.3