From aa122cbae78ce97d60c0c98ba14df753d97e40b1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 30 Jan 2022 19:06:58 +0300 Subject: style: format entire depot with nixpkgs-fmt This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni Reviewed-by: lukegb Reviewed-by: wpcarro Reviewed-by: Profpatsch Reviewed-by: kanepyork Reviewed-by: tazjin Reviewed-by: cynthia Reviewed-by: edef Reviewed-by: eta Reviewed-by: grfn --- users/grfn/system/home/common/solarized.nix | 30 +- users/grfn/system/home/machines/roswell.nix | 3 +- users/grfn/system/home/machines/yeren.nix | 8 +- users/grfn/system/home/modules/alsi.nix | 46 +-- users/grfn/system/home/modules/common.nix | 3 +- users/grfn/system/home/modules/development.nix | 18 +- .../grfn/system/home/modules/development/kube.nix | 2 +- users/grfn/system/home/modules/emacs.nix | 21 +- users/grfn/system/home/modules/email.nix | 64 ++-- users/grfn/system/home/modules/games.nix | 9 +- users/grfn/system/home/modules/i3.nix | 324 +++++++++++---------- users/grfn/system/home/modules/lib/cloneRepo.nix | 96 +++--- .../grfn/system/home/modules/lib/zshFunctions.nix | 14 +- users/grfn/system/home/modules/obs.nix | 4 +- users/grfn/system/home/modules/rtlsdr.nix | 14 +- users/grfn/system/home/modules/shell.nix | 5 +- users/grfn/system/home/modules/tarsnap.nix | 80 ++--- users/grfn/system/home/platforms/darwin.nix | 2 +- users/grfn/system/system/iso.nix | 3 +- users/grfn/system/system/machines/mugwump.nix | 156 +++++----- users/grfn/system/system/modules/common.nix | 2 +- users/grfn/system/system/modules/fonts.nix | 2 +- .../system/system/modules/reusable/battery.nix | 14 +- users/grfn/system/system/modules/tvl.nix | 4 +- users/grfn/system/system/modules/work/kolide.nix | 10 +- 25 files changed, 491 insertions(+), 443 deletions(-) (limited to 'users/grfn/system') diff --git a/users/grfn/system/home/common/solarized.nix b/users/grfn/system/home/common/solarized.nix index e94693edc566..554ee0523e46 100644 --- a/users/grfn/system/home/common/solarized.nix +++ b/users/grfn/system/home/common/solarized.nix @@ -1,18 +1,18 @@ rec { - base03 = "#002B36"; - base02 = "#073642"; - base01 = "#586e75"; - base00 = "#657b83"; - base0 = "#839496"; - base1 = "#93a1a1"; - base2 = "#eee8d5"; - base3 = "#fdf6e3"; - yellow = "#b58900"; - orange = "#cb4b16"; - red = "#dc322f"; + base03 = "#002B36"; + base02 = "#073642"; + base01 = "#586e75"; + base00 = "#657b83"; + base0 = "#839496"; + base1 = "#93a1a1"; + base2 = "#eee8d5"; + base3 = "#fdf6e3"; + yellow = "#b58900"; + orange = "#cb4b16"; + red = "#dc322f"; magenta = "#d33682"; - violet = "#6c71c4"; - blue = "#268bd2"; - cyan = "#2aa198"; - green = "#859900"; + violet = "#6c71c4"; + blue = "#268bd2"; + cyan = "#2aa198"; + green = "#859900"; } diff --git a/users/grfn/system/home/machines/roswell.nix b/users/grfn/system/home/machines/roswell.nix index f68f3a7be36f..2e86eda4992d 100644 --- a/users/grfn/system/home/machines/roswell.nix +++ b/users/grfn/system/home/machines/roswell.nix @@ -19,7 +19,8 @@ in htop killall bind - zip unzip + zip + unzip tree ncat bc diff --git a/users/grfn/system/home/machines/yeren.nix b/users/grfn/system/home/machines/yeren.nix index 0c89e9d12393..343ebf2c9a09 100644 --- a/users/grfn/system/home/machines/yeren.nix +++ b/users/grfn/system/home/machines/yeren.nix @@ -58,10 +58,10 @@ in RemainAfterExit = true; ExecStart = ( "${pkgs.xorg.setxkbmap}/bin/setxkbmap " - + "-device ${laptopKeyboardId} " - + "-option caps:swapescape " - + "-option compose:ralt " - + "-option altwin:swap_alt_win" + + "-device ${laptopKeyboardId} " + + "-option caps:swapescape " + + "-option compose:ralt " + + "-option altwin:swap_alt_win" ); }; }; diff --git a/users/grfn/system/home/modules/alsi.nix b/users/grfn/system/home/modules/alsi.nix index c4a14e683c39..204f9c8e1428 100644 --- a/users/grfn/system/home/modules/alsi.nix +++ b/users/grfn/system/home/modules/alsi.nix @@ -10,30 +10,30 @@ xdg.configFile."alsi/alsi.conf" = { force = true; text = '' - #!${pkgs.perl}/bin/perl + #!${pkgs.perl}/bin/perl - scalar { - ALSI_VERSION => "0.4.8", - COLORS_FILE => "/home/grfn/.config/alsi/alsi.colors", - DE_FILE => "/home/grfn/.config/alsi/alsi.de", - DEFAULT_COLOR_BOLD => "blue", - DEFAULT_COLOR_NORMAL => "blue", - DF_COMMAND => "df -Th -x sys -x tmpfs -x devtmpfs &>/dev/stdout", - GTK2_RC_FILE => "/home/grfn/.gtkrc-2.0", - GTK3_RC_FILE => "/home/grfn/.config/gtk-3.0/settings.ini", - LOGO_FILE => "/home/grfn/.config/alsi/alsi.logo", - OUTPUT_FILE => "/home/grfn/.config/alsi/alsi.output", - # PACKAGES_PATH => "/var/lib/pacman/local/", - PS_COMMAND => "ps -A", - USAGE_COLORS => 0, - USAGE_COLORS_BOLD => 0, - USAGE_PRECENT_GREEN => 50, - USAGE_PRECENT_RED => 100, - USAGE_PRECENT_YELLOW => 85, - USE_LOGO_FROM_FILE => 1, - USE_VALUES_COLOR => 0, - WM_FILE => "/home/grfn/.config/alsi/alsi.wm", - } + scalar { + ALSI_VERSION => "0.4.8", + COLORS_FILE => "/home/grfn/.config/alsi/alsi.colors", + DE_FILE => "/home/grfn/.config/alsi/alsi.de", + DEFAULT_COLOR_BOLD => "blue", + DEFAULT_COLOR_NORMAL => "blue", + DF_COMMAND => "df -Th -x sys -x tmpfs -x devtmpfs &>/dev/stdout", + GTK2_RC_FILE => "/home/grfn/.gtkrc-2.0", + GTK3_RC_FILE => "/home/grfn/.config/gtk-3.0/settings.ini", + LOGO_FILE => "/home/grfn/.config/alsi/alsi.logo", + OUTPUT_FILE => "/home/grfn/.config/alsi/alsi.output", + # PACKAGES_PATH => "/var/lib/pacman/local/", + PS_COMMAND => "ps -A", + USAGE_COLORS => 0, + USAGE_COLORS_BOLD => 0, + USAGE_PRECENT_GREEN => 50, + USAGE_PRECENT_RED => 100, + USAGE_PRECENT_YELLOW => 85, + USE_LOGO_FROM_FILE => 1, + USE_VALUES_COLOR => 0, + WM_FILE => "/home/grfn/.config/alsi/alsi.wm", + } ''; }; diff --git a/users/grfn/system/home/modules/common.nix b/users/grfn/system/home/modules/common.nix index 6871cadda1cf..a31e1718192e 100644 --- a/users/grfn/system/home/modules/common.nix +++ b/users/grfn/system/home/modules/common.nix @@ -28,7 +28,8 @@ htop killall bind - zip unzip + zip + unzip tree ncat bc diff --git a/users/grfn/system/home/modules/development.nix b/users/grfn/system/home/modules/development.nix index 653ce5d83ae1..d60e6ba60759 100644 --- a/users/grfn/system/home/modules/development.nix +++ b/users/grfn/system/home/modules/development.nix @@ -2,12 +2,14 @@ let - clj2nix = pkgs.callPackage (pkgs.fetchFromGitHub { - owner = "hlolli"; - repo = "clj2nix"; - rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; - sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; - }) {}; + clj2nix = pkgs.callPackage + (pkgs.fetchFromGitHub { + owner = "hlolli"; + repo = "clj2nix"; + rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; + sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; + }) + { }; pg-dump-upsert = pkgs.buildGoModule rec { pname = "pg-dump-upsert"; @@ -87,7 +89,7 @@ with lib; enable = true; package = pkgs.gitFull; userEmail = "root@gws.fyi"; - userName = "Griffin Smith"; + userName = "Griffin Smith"; ignores = [ "*.sw*" ".classpath" @@ -206,7 +208,7 @@ with lib; functions = { gdelmerged = '' - git branch --merged | egrep -v 'master' | tr -d '+ ' | xargs git branch -d + git branch --merged | egrep -v 'master' | tr -d '+ ' | xargs git branch -d ''; }; }; diff --git a/users/grfn/system/home/modules/development/kube.nix b/users/grfn/system/home/modules/development/kube.nix index 97ae4760d43b..876b0c08df1d 100644 --- a/users/grfn/system/home/modules/development/kube.nix +++ b/users/grfn/system/home/modules/development/kube.nix @@ -16,7 +16,7 @@ "kpa" = "kubectl get pods --all-namespaces"; "klf" = "kubectl logs -f"; "kdep" = "kubectl get deployments"; - "ked" = "kubectl edit deployment"; + "ked" = "kubectl edit deployment"; "kpw" = "kubectl get pods -w"; "kew" = "kubectl get events -w"; "kdel" = "kubectl delete"; diff --git a/users/grfn/system/home/modules/emacs.nix b/users/grfn/system/home/modules/emacs.nix index 6cc38bc7ab05..c65d88aacf6f 100644 --- a/users/grfn/system/home/modules/emacs.nix +++ b/users/grfn/system/home/modules/emacs.nix @@ -3,16 +3,17 @@ with lib; let - # doom-emacs = pkgs.callPackage (builtins.fetchTarball { - # url = https://github.com/vlaci/nix-doom-emacs/archive/master.tar.gz; - # }) { - # doomPrivateDir = ./doom.d; # Directory containing your config.el init.el - # # and packages.el files - # }; + # doom-emacs = pkgs.callPackage (builtins.fetchTarball { + # url = https://github.com/vlaci/nix-doom-emacs/archive/master.tar.gz; + # }) { + # doomPrivateDir = ./doom.d; # Directory containing your config.el init.el + # # and packages.el files + # }; depot = config.lib.depot; -in { +in +{ imports = [ ./lib/cloneRepo.nix ]; @@ -47,7 +48,7 @@ in { upquote varwidth wrapfig - ; + ; }) ispell @@ -82,14 +83,14 @@ in { doomEmacs = { github = "hlissner/doom-emacs"; path = ".emacs.d"; - after = ["emacs.d"]; + after = [ "emacs.d" ]; onClone = "bin/doom install"; }; "emacs.d" = { github = "glittershark/emacs.d"; path = ".doom.d"; - after = ["orgClubhouse"]; + after = [ "orgClubhouse" ]; }; }; diff --git a/users/grfn/system/home/modules/email.nix b/users/grfn/system/home/modules/email.nix index 0a3e58205ba6..63dfeeb6f480 100644 --- a/users/grfn/system/home/modules/email.nix +++ b/users/grfn/system/home/modules/email.nix @@ -9,7 +9,8 @@ let let good = upperChars ++ lowerChars ++ stringToCharacters "0123456789-_"; subst = c: if any (x: x == c) good then c else "-"; - in stringAsChars subst name; + in + stringAsChars subst name; accounts = { personal = { @@ -26,7 +27,8 @@ let }; -in { +in +{ programs.lieer.enable = true; programs.notmuch.enable = true; services.lieer.enable = true; @@ -37,16 +39,18 @@ in { msmtp ]; - systemd.user.services = mapAttrs' (name: account: { - name = escapeUnitName "lieer-${name}"; - value.Service = { - ExecStart = mkForce "${pkgs.writeShellScript "sync-${name}" '' + systemd.user.services = mapAttrs' + (name: account: { + name = escapeUnitName "lieer-${name}"; + value.Service = { + ExecStart = mkForce "${pkgs.writeShellScript "sync-${name}" '' ${pkgs.gmailieer}/bin/gmi sync --path ~/mail/${name} ''}"; - Environment = "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"; - }; + Environment = "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"; + }; - }) accounts; + }) + accounts; # xdg.configFile."notifymuch/notifymuch.cfg".text = generators.toINI {} { # notifymuch = { @@ -58,30 +62,32 @@ in { # }; accounts.email.maildirBasePath = "mail"; - accounts.email.accounts = mapAttrs (_: params@{ passEntry, ... }: { - realName = "Griffin Smith"; - passwordCommand = "pass ${passEntry}"; + accounts.email.accounts = mapAttrs + (_: params@{ passEntry, ... }: { + realName = "Griffin Smith"; + passwordCommand = "pass ${passEntry}"; - flavor = "gmail.com"; + flavor = "gmail.com"; - imapnotify = { - enable = true; - boxes = [ "Inbox" ]; - }; + imapnotify = { + enable = true; + boxes = [ "Inbox" ]; + }; - gpg = { - key = "0F11A989879E8BBBFDC1E23644EF5B5E861C09A7"; - signByDefault = true; - }; + gpg = { + key = "0F11A989879E8BBBFDC1E23644EF5B5E861C09A7"; + signByDefault = true; + }; - notmuch.enable = true; - lieer = { - enable = true; - sync = { + notmuch.enable = true; + lieer = { enable = true; - frequency = "*:*"; + sync = { + enable = true; + frequency = "*:*"; + }; }; - }; - msmtp.enable = true; - } // builtins.removeAttrs params ["passEntry"]) accounts; + msmtp.enable = true; + } // builtins.removeAttrs params [ "passEntry" ]) + accounts; } diff --git a/users/grfn/system/home/modules/games.nix b/users/grfn/system/home/modules/games.nix index 26dc9d31f37a..8067caf65fb1 100644 --- a/users/grfn/system/home/modules/games.nix +++ b/users/grfn/system/home/modules/games.nix @@ -13,14 +13,14 @@ let enableFPS = true; }); - init = runCommand "init.txt" {} '' + init = runCommand "init.txt" { } '' substitute "${df-orig}/data/init/init.txt" $out \ --replace "[INTRO:YES]" "[INTRO:NO]" \ --replace "[VOLUME:255]" "[VOLUME:0]" \ --replace "[FPS:NO]" "[FPS:YES]" ''; - d_init = runCommand "d_init.txt" {} '' + d_init = runCommand "d_init.txt" { } '' substitute "${df-orig}/data/init/d_init.txt" $out \ --replace "[AUTOSAVE:NONE]" "[AUTOSAVE:SEASONAL]" \ --replace "[AUTOSAVE_PAUSE:NO]" "[AUTOSAVE_PAUSE:YES]" \ @@ -30,7 +30,7 @@ let --replace "[SHOW_FLOW_AMOUNTS:NO]" "[SHOW_FLOW_AMOUNTS:YES]" ''; - df = runCommand "dwarf-fortress" {} '' + df = runCommand "dwarf-fortress" { } '' mkdir -p $out/bin sed \ -e '4icp -f ${init} "$DF_DIR/data/init/init.txt"' \ @@ -43,7 +43,8 @@ let chmod +x $out/bin/dwarf-fortress ''; -in mkMerge [ +in +mkMerge [ { home.packages = [ crawl diff --git a/users/grfn/system/home/modules/i3.nix b/users/grfn/system/home/modules/i3.nix index 111f2a08c225..7bd371e117d1 100644 --- a/users/grfn/system/home/modules/i3.nix +++ b/users/grfn/system/home/modules/i3.nix @@ -20,7 +20,8 @@ let inherit (builtins) map; inherit (lib) mkMerge range; -in { +in +{ options = with lib; { system.machine.wirelessInterface = mkOption { description = '' @@ -77,50 +78,51 @@ in { "move container to workspace ${toString n}"; }) (range 0 9)) - ++ [(rec { - "${mod}+h" = "focus left"; - "${mod}+j" = "focus down"; - "${mod}+k" = "focus up"; - "${mod}+l" = "focus right"; - "${mod}+semicolon" = "focus parent"; + ++ [ + (rec { + "${mod}+h" = "focus left"; + "${mod}+j" = "focus down"; + "${mod}+k" = "focus up"; + "${mod}+l" = "focus right"; + "${mod}+semicolon" = "focus parent"; - "${mod}+Shift+h" = "move left"; - "${mod}+Shift+j" = "move down"; - "${mod}+Shift+k" = "move up"; - "${mod}+Shift+l" = "move right"; + "${mod}+Shift+h" = "move left"; + "${mod}+Shift+j" = "move down"; + "${mod}+Shift+k" = "move up"; + "${mod}+Shift+l" = "move right"; - "${mod}+Shift+x" = "kill"; + "${mod}+Shift+x" = "kill"; - "${mod}+Return" = "exec alacritty"; + "${mod}+Return" = "exec alacritty"; - "${mod}+Shift+s" = "split h"; - "${mod}+Shift+v" = "split v"; - "${mod}+e" = "layout toggle split"; - "${mod}+w" = "layout tabbed"; - "${mod}+s" = "layout stacking"; + "${mod}+Shift+s" = "split h"; + "${mod}+Shift+v" = "split v"; + "${mod}+e" = "layout toggle split"; + "${mod}+w" = "layout tabbed"; + "${mod}+s" = "layout stacking"; - "${mod}+f" = "fullscreen"; + "${mod}+f" = "fullscreen"; - "${mod}+Shift+r" = "restart"; + "${mod}+Shift+r" = "restart"; - "${mod}+r" = "mode resize"; + "${mod}+r" = "mode resize"; - # Marks - "${mod}+Shift+m" = ''exec i3-input -F "mark %s" -l 1 -P 'Mark: ' ''; - "${mod}+m" = ''exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Go to: ' ''; + # Marks + "${mod}+Shift+m" = ''exec i3-input -F "mark %s" -l 1 -P 'Mark: ' ''; + "${mod}+m" = ''exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Go to: ' ''; - # Screenshots - "${mod}+q" = "exec \"maim | xclip -selection clipboard -t image/png\""; - "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; - "${mod}+Ctrl+q" = "exec ${pkgs.writeShellScript "peek.sh" '' + # Screenshots + "${mod}+q" = "exec \"maim | xclip -selection clipboard -t image/png\""; + "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; + "${mod}+Ctrl+q" = "exec ${pkgs.writeShellScript "peek.sh" '' ${pkgs.picom}/bin/picom & picom_pid=$! ${pkgs.peek}/bin/peek || true kill -SIGINT $picom_pid ''}"; - # Launching applications - "${mod}+u" = "exec ${pkgs.writeShellScript "rofi" '' + # Launching applications + "${mod}+u" = "exec ${pkgs.writeShellScript "rofi" '' rofi \ -modi 'combi' \ -combi-modi "window,drun,ssh,run" \ @@ -128,49 +130,51 @@ in { -show combi ''}"; - # Passwords - "${mod}+p" = "exec rofi-pass -font '${decorationFont}'"; - - # Media - "XF86AudioPlay" = "exec playerctl play-pause"; - "XF86AudioNext" = "exec playerctl next"; - "XF86AudioPrev" = "exec playerctl previous"; - "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; - "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; - "XF86AudioMute" = "exec pulseaudio-ctl mute"; - - # Lock - Pause = "exec lock"; - - # Brightness - "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q s 5%-"; - "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q s 5%+"; - - # Sleep/hibernate - # "${mod}+Escape" = "exec systemctl suspend"; - # "${mod}+Shift+Escape" = "exec systemctl hibernate"; - - # Scratch buffer - "${mod}+minus" = "scratchpad show"; - "${mod}+Shift+minus" = "move scratchpad"; - "${mod}+space" = "focus mode_toggle"; - "${mod}+Shift+space" = "floating toggle"; - - # Screen Layout - "${mod}+Shift+t" = "exec xrandr --auto"; - "${mod}+t" = "exec ${screenlayout.home}"; - "${mod}+Ctrl+t" = "exec ${pkgs.writeShellScript "fix_term.sh" '' + # Passwords + "${mod}+p" = "exec rofi-pass -font '${decorationFont}'"; + + # Media + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; + "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; + "XF86AudioMute" = "exec pulseaudio-ctl mute"; + + # Lock + Pause = "exec lock"; + + # Brightness + "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q s 5%-"; + "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q s 5%+"; + + # Sleep/hibernate + # "${mod}+Escape" = "exec systemctl suspend"; + # "${mod}+Shift+Escape" = "exec systemctl hibernate"; + + # Scratch buffer + "${mod}+minus" = "scratchpad show"; + "${mod}+Shift+minus" = "move scratchpad"; + "${mod}+space" = "focus mode_toggle"; + "${mod}+Shift+space" = "floating toggle"; + + # Screen Layout + "${mod}+Shift+t" = "exec xrandr --auto"; + "${mod}+t" = "exec ${screenlayout.home}"; + "${mod}+Ctrl+t" = "exec ${pkgs.writeShellScript "fix_term.sh" '' xrandr --output eDP-1 --off && ${screenlayout.home} ''}"; - # Notifications - "${mod}+Shift+n" = "exec killall -SIGUSR1 .dunst-wrapped"; - "${mod}+n" = "exec killall -SIGUSR2 .dunst-wrapped"; - "Control+space" = "exec ${pkgs.dunst}/bin/dunstctl close"; - "Control+Shift+space" = "exec ${pkgs.dunst}/bin/dunstctl close-all"; - "Control+grave" = "exec ${pkgs.dunst}/bin/dunstctl history-pop"; - "Control+Shift+period" = "exec ${pkgs.dunst}/bin/dunstctl action"; - })]); + # Notifications + "${mod}+Shift+n" = "exec killall -SIGUSR1 .dunst-wrapped"; + "${mod}+n" = "exec killall -SIGUSR2 .dunst-wrapped"; + "Control+space" = "exec ${pkgs.dunst}/bin/dunstctl close"; + "Control+Shift+space" = "exec ${pkgs.dunst}/bin/dunstctl close-all"; + "Control+grave" = "exec ${pkgs.dunst}/bin/dunstctl history-pop"; + "Control+Shift+period" = "exec ${pkgs.dunst}/bin/dunstctl action"; + }) + ] + ); fonts = [ decorationFont ]; @@ -202,94 +206,96 @@ in { bars = [{ statusCommand = - let i3status-conf = pkgs.writeText "i3status.conf" '' - general { - output_format = i3bar - colors = true - color_good = "#859900" - - interval = 1 - } - - order += "external_script current_task" - order += "external_script inbox" - order += "spotify" - order += "volume_status" - order += "wireless ${config.system.machine.wirelessInterface}" - # order += "ethernet enp3s0f0" - order += "cpu_usage" - order += "battery 0" - # order += "volume master" - order += "time" - order += "tztime utc" - - mpd { - format = "%artist - %album - %title" - } - - wireless ${config.system.machine.wirelessInterface} { - format_up = "W: (%quality - %essid - %bitrate) %ip" - format_down = "W: -" - } - - ethernet enp3s0f0 { - format_up = "E: %ip" - format_down = "E: -" - } - - battery 0 { - format = "%status %percentage" - path = "/sys/class/power_supply/BAT%d/uevent" - low_threshold = 10 - } - - cpu_usage { - format = "CPU: %usage" - } - - load { - format = "%5min" - } - - time { - format = " %a %h %d ⌚ %I:%M " - } - - spotify { - color_playing = "#fdf6e3" - color_paused = "#93a1a1" - format_stopped = "" - format_down = "" - format = "{title} - {artist} ({album})" - } - - external_script inbox { - script_path = '${emacsclient "(grfn/num-inbox-items-message)"}' - format = 'Inbox: {output}' - cache_timeout = 120 - color = "#93a1a1" - } - - external_script current_task { - script_path = '${emacsclient "(grfn/org-current-clocked-in-task-message)"}' - # format = '{output}' - cache_timeout = 60 - color = "#93a1a1" - } - - tztime utc { - timezone = "UTC" - format = " %H·%M " - } - - volume_status { - format = "☊ {percentage}" - format_muted = "☊ X" - # device = "default" - # mixer_idx = 0 - } - ''; - in "py3status -c ${i3status-conf}"; + let + i3status-conf = pkgs.writeText "i3status.conf" '' + general { + output_format = i3bar + colors = true + color_good = "#859900" + + interval = 1 + } + + order += "external_script current_task" + order += "external_script inbox" + order += "spotify" + order += "volume_status" + order += "wireless ${config.system.machine.wirelessInterface}" + # order += "ethernet enp3s0f0" + order += "cpu_usage" + order += "battery 0" + # order += "volume master" + order += "time" + order += "tztime utc" + + mpd { + format = "%artist - %album - %title" + } + + wireless ${config.system.machine.wirelessInterface} { + format_up = "W: (%quality - %essid - %bitrate) %ip" + format_down = "W: -" + } + + ethernet enp3s0f0 { + format_up = "E: %ip" + format_down = "E: -" + } + + battery 0 { + format = "%status %percentage" + path = "/sys/class/power_supply/BAT%d/uevent" + low_threshold = 10 + } + + cpu_usage { + format = "CPU: %usage" + } + + load { + format = "%5min" + } + + time { + format = " %a %h %d ⌚ %I:%M " + } + + spotify { + color_playing = "#fdf6e3" + color_paused = "#93a1a1" + format_stopped = "" + format_down = "" + format = "{title} - {artist} ({album})" + } + + external_script inbox { + script_path = '${emacsclient "(grfn/num-inbox-items-message)"}' + format = 'Inbox: {output}' + cache_timeout = 120 + color = "#93a1a1" + } + + external_script current_task { + script_path = '${emacsclient "(grfn/org-current-clocked-in-task-message)"}' + # format = '{output}' + cache_timeout = 60 + color = "#93a1a1" + } + + tztime utc { + timezone = "UTC" + format = " %H·%M " + } + + volume_status { + format = "☊ {percentage}" + format_muted = "☊ X" + # device = "default" + # mixer_idx = 0 + } + ''; + in + "py3status -c ${i3status-conf}"; fonts = [ decorationFont ]; position = "top"; colors = with solarized; rec { @@ -362,5 +368,5 @@ in { iconTheme.name = "Adwaita"; theme.name = "Adwaita"; }; - }; + }; } diff --git a/users/grfn/system/home/modules/lib/cloneRepo.nix b/users/grfn/system/home/modules/lib/cloneRepo.nix index dc487dc6bd05..54992bd69bae 100644 --- a/users/grfn/system/home/modules/lib/cloneRepo.nix +++ b/users/grfn/system/home/modules/lib/cloneRepo.nix @@ -4,44 +4,46 @@ with lib; options = { grfn.impure.clonedRepos = mkOption { description = "Repositories to clone"; - default = {}; + default = { }; type = with types; loaOf ( - let sm = submodule { - options = { - url = mkOption { - type = nullOr str; - description = "URL of repository to clone"; - default = null; - }; + let + sm = submodule { + options = { + url = mkOption { + type = nullOr str; + description = "URL of repository to clone"; + default = null; + }; - github = mkOption { - type = nullOr str; - description = "Github owner/repo of repository to clone"; - default = null; - }; + github = mkOption { + type = nullOr str; + description = "Github owner/repo of repository to clone"; + default = null; + }; - path = mkOption { - type = str; - description = "Path to clone to"; - }; + path = mkOption { + type = str; + description = "Path to clone to"; + }; - onClone = mkOption { - type = str; - description = '' - Shell command to run after cloning the repo for the first time. - Runs inside the repo itself. - ''; - default = ""; - }; + onClone = mkOption { + type = str; + description = '' + Shell command to run after cloning the repo for the first time. + Runs inside the repo itself. + ''; + default = ""; + }; - after = mkOption { - type = listOf str; - description = "Activation hooks that this repository must be cloned after"; - default = []; + after = mkOption { + type = listOf str; + description = "Activation hooks that this repository must be cloned after"; + default = [ ]; + }; }; }; - }; - in addCheck sm (cr: (! isNull cr.url || ! isNull cr.github)) + in + addCheck sm (cr: (! isNull cr.url || ! isNull cr.github)) ); }; }; @@ -49,19 +51,23 @@ with lib; config = { home.activation = mapAttrs - (_: { - url, path, github, onClone, after, ... - }: - let repoURL = if isNull url then "git@github.com:${github}" else url; - in hm.dag.entryAfter (["writeBoundary"] ++ after) '' - $DRY_RUN_CMD mkdir -p $(dirname "${path}") - if [[ ! -d ${path} ]]; then - $DRY_RUN_CMD git clone "${repoURL}" "${path}" - pushd ${path} - $DRY_RUN_CMD ${onClone} - popd - fi - '') - config.grfn.impure.clonedRepos; + (_: { url + , path + , github + , onClone + , after + , ... + }: + let repoURL = if isNull url then "git@github.com:${github}" else url; + in hm.dag.entryAfter ([ "writeBoundary" ] ++ after) '' + $DRY_RUN_CMD mkdir -p $(dirname "${path}") + if [[ ! -d ${path} ]]; then + $DRY_RUN_CMD git clone "${repoURL}" "${path}" + pushd ${path} + $DRY_RUN_CMD ${onClone} + popd + fi + '') + config.grfn.impure.clonedRepos; }; } diff --git a/users/grfn/system/home/modules/lib/zshFunctions.nix b/users/grfn/system/home/modules/lib/zshFunctions.nix index 7c39b3478cfd..228dc6379fd6 100644 --- a/users/grfn/system/home/modules/lib/zshFunctions.nix +++ b/users/grfn/system/home/modules/lib/zshFunctions.nix @@ -6,16 +6,18 @@ with lib; options = { programs.zsh.functions = mkOption { description = "An attribute set that maps function names to their source"; - default = {}; + default = { }; type = with types; attrsOf (either str path); }; }; config.programs.zsh.initExtra = concatStringsSep "\n" ( - mapAttrsToList (name: funSrc: '' - function ${name}() { - ${funSrc} - } - '') config.programs.zsh.functions + mapAttrsToList + (name: funSrc: '' + function ${name}() { + ${funSrc} + } + '') + config.programs.zsh.functions ); } diff --git a/users/grfn/system/home/modules/obs.nix b/users/grfn/system/home/modules/obs.nix index d1dade477ccc..39d57d712a46 100644 --- a/users/grfn/system/home/modules/obs.nix +++ b/users/grfn/system/home/modules/obs.nix @@ -19,7 +19,9 @@ let nativeBuildInputs = [ pkg-config ]; buildInputs = [ - libtool autoconf automake + libtool + autoconf + automake x11 xorg.libXtst xorg.libXinerama diff --git a/users/grfn/system/home/modules/rtlsdr.nix b/users/grfn/system/home/modules/rtlsdr.nix index a1c717617a62..c8a404a1f49e 100644 --- a/users/grfn/system/home/modules/rtlsdr.nix +++ b/users/grfn/system/home/modules/rtlsdr.nix @@ -2,12 +2,14 @@ let - nixpkgs-gnuradio = import (pkgs.fetchFromGitHub { - owner = "doronbehar"; - repo = "nixpkgs"; - rev = "712561aa5f10bfe6112a1726a912585612a70d1f"; - sha256 = "04yqflbwjcfl9vlplphpj82csqqz9k6m3nj1ybhwgmsc4by7vivl"; - }) {}; + nixpkgs-gnuradio = import + (pkgs.fetchFromGitHub { + owner = "doronbehar"; + repo = "nixpkgs"; + rev = "712561aa5f10bfe6112a1726a912585612a70d1f"; + sha256 = "04yqflbwjcfl9vlplphpj82csqqz9k6m3nj1ybhwgmsc4by7vivl"; + }) + { }; in diff --git a/users/grfn/system/home/modules/shell.nix b/users/grfn/system/home/modules/shell.nix index 088fe9238c69..ed82292b0aab 100644 --- a/users/grfn/system/home/modules/shell.nix +++ b/users/grfn/system/home/modules/shell.nix @@ -30,7 +30,7 @@ let # Directories stck = "dirs -v"; - b= "cd ~1"; + b = "cd ~1"; ".." = "cd .."; "..." = "cd ../.."; "...." = "cd ../../.."; @@ -63,7 +63,8 @@ let "ll" = "ls -al"; "la" = "ls -a"; }; -in { +in +{ home.packages = with pkgs; [ zsh autojump diff --git a/users/grfn/system/home/modules/tarsnap.nix b/users/grfn/system/home/modules/tarsnap.nix index 4bff19910f05..87002610cbcf 100644 --- a/users/grfn/system/home/modules/tarsnap.nix +++ b/users/grfn/system/home/modules/tarsnap.nix @@ -6,59 +6,59 @@ ]; home.file.".tarsnaprc".text = '' - ### Recommended options + ### Recommended options - # Tarsnap cache directory - cachedir /home/grfn/.cache/tarsnap + # Tarsnap cache directory + cachedir /home/grfn/.cache/tarsnap - # Tarsnap key file - keyfile /home/grfn/.private/tarsnap.key + # Tarsnap key file + keyfile /home/grfn/.private/tarsnap.key - # Don't archive files which have the nodump flag set. - nodump + # Don't archive files which have the nodump flag set. + nodump - # Print statistics when creating or deleting archives. - print-stats + # Print statistics when creating or deleting archives. + print-stats - # Create a checkpoint once per GB of uploaded data. - checkpoint-bytes 1G + # Create a checkpoint once per GB of uploaded data. + checkpoint-bytes 1G - ### Commonly useful options + ### Commonly useful options - # Use SI prefixes to make numbers printed by --print-stats more readable. - humanize-numbers + # Use SI prefixes to make numbers printed by --print-stats more readable. + humanize-numbers - ### Other options, not applicable to most systems + ### Other options, not applicable to most systems - # Aggressive network behaviour: Use multiple TCP connections when - # writing archives. Use of this option is recommended only in - # cases where TCP congestion control is known to be the limiting - # factor in upload performance. - #aggressive-networking + # Aggressive network behaviour: Use multiple TCP connections when + # writing archives. Use of this option is recommended only in + # cases where TCP congestion control is known to be the limiting + # factor in upload performance. + #aggressive-networking - # Exclude files and directories matching specified patterns. - # Only one file or directory per command; multiple "exclude" - # commands may be given. - #exclude + # Exclude files and directories matching specified patterns. + # Only one file or directory per command; multiple "exclude" + # commands may be given. + #exclude - # Include only files and directories matching specified patterns. - # Only one file or directory per command; multiple "include" - # commands may be given. - #include + # Include only files and directories matching specified patterns. + # Only one file or directory per command; multiple "include" + # commands may be given. + #include - # Attempt to reduce tarsnap memory consumption. This option - # will slow down the process of creating archives, but may help - # on systems where the average size of files being backed up is - # less than 1 MB. - #lowmem + # Attempt to reduce tarsnap memory consumption. This option + # will slow down the process of creating archives, but may help + # on systems where the average size of files being backed up is + # less than 1 MB. + #lowmem - # Try even harder to reduce tarsnap memory consumption. This can - # significantly slow down tarsnap, but reduces its memory usage - # by an additional factor of 2 beyond what the lowmem option does. - #verylowmem + # Try even harder to reduce tarsnap memory consumption. This can + # significantly slow down tarsnap, but reduces its memory usage + # by an additional factor of 2 beyond what the lowmem option does. + #verylowmem - # Snapshot time. Use this option if you are backing up files - # from a filesystem snapshot rather than from a "live" filesystem. - #snaptime + # Snapshot time. Use this option if you are backing up files + # from a filesystem snapshot rather than from a "live" filesystem. + #snaptime ''; } diff --git a/users/grfn/system/home/platforms/darwin.nix b/users/grfn/system/home/platforms/darwin.nix index cf0375e94162..f98b80f26915 100644 --- a/users/grfn/system/home/platforms/darwin.nix +++ b/users/grfn/system/home/platforms/darwin.nix @@ -10,7 +10,7 @@ with lib; pinentry_mac ]; - home.activation.linkApplications = lib.hm.dag.entryAfter ["writeBoundary"] '' + home.activation.linkApplications = lib.hm.dag.entryAfter [ "writeBoundary" ] '' $DRY_RUN_CMD ln -sf $VERBOSE_ARG \ ~/.nix-profile/Applications/* ~/Applications/ ''; diff --git a/users/grfn/system/system/iso.nix b/users/grfn/system/system/iso.nix index 4adccebfb8a2..92a13f655214 100644 --- a/users/grfn/system/system/iso.nix +++ b/users/grfn/system/system/iso.nix @@ -12,6 +12,7 @@ let networking.firewall.enable = false; networking.wireless.enable = lib.mkForce false; }; -in (depot.third_party.nixos { +in +(depot.third_party.nixos { inherit configuration; }).config.system.build.isoImage diff --git a/users/grfn/system/system/machines/mugwump.nix b/users/grfn/system/system/machines/mugwump.nix index 7de6555878d9..a8bf91caacc0 100644 --- a/users/grfn/system/system/machines/mugwump.nix +++ b/users/grfn/system/system/machines/mugwump.nix @@ -23,7 +23,12 @@ with lib; initrd = { availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; kernelModules = [ - "uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1" + "uas" + "usbcore" + "usb_storage" + "vfat" + "nls_cp437" + "nls_iso8859_1" ]; postDeviceCommands = pkgs.lib.mkBefore '' @@ -60,31 +65,33 @@ with lib; networking.firewall.allowedTCPPorts = [ 22 80 443 ]; security.sudo.extraRules = [{ - groups = ["wheel"]; - commands = [{ command = "ALL"; options = ["NOPASSWD"]; }]; + groups = [ "wheel" ]; + commands = [{ command = "ALL"; options = [ "NOPASSWD" ]; }]; }]; nix.gc.dates = "monthly"; - age.secrets = let - secret = name: depot.users.grfn.secrets."${name}.age"; - in { - bbbg.file = secret "bbbg"; - cloudflare.file = secret "cloudflare"; - ddclient-password.file = secret "ddclient-password"; - - buildkite-ssh-key = { - file = secret "buildkite-ssh-key"; - group = "keys"; - mode = "0440"; - }; + age.secrets = + let + secret = name: depot.users.grfn.secrets."${name}.age"; + in + { + bbbg.file = secret "bbbg"; + cloudflare.file = secret "cloudflare"; + ddclient-password.file = secret "ddclient-password"; + + buildkite-ssh-key = { + file = secret "buildkite-ssh-key"; + group = "keys"; + mode = "0440"; + }; - buildkite-token = { - file = secret "buildkite-token"; - group = "keys"; - mode = "0440"; + buildkite-token = { + file = secret "buildkite-token"; + group = "keys"; + mode = "0440"; + }; }; - }; services.depot.auto-deploy = { enable = true; @@ -207,44 +214,49 @@ with lib; job_name = "node"; scrape_interval = "5s"; static_configs = [{ - targets = ["localhost:${toString config.services.prometheus.exporters.node.port}"]; - }]; - } { - job_name = "nginx"; - scrape_interval = "5s"; - static_configs = [{ - targets = ["localhost:${toString config.services.prometheus.exporters.nginx.port}"]; + targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; }]; - } { - job_name = "xanthous_server"; - scrape_interval = "1s"; - static_configs = [{ - targets = ["localhost:${toString config.services.xanthous-server.metricsPort}"]; + } + { + job_name = "nginx"; + scrape_interval = "5s"; + static_configs = [{ + targets = [ "localhost:${toString config.services.prometheus.exporters.nginx.port}" ]; + }]; + } + { + job_name = "xanthous_server"; + scrape_interval = "1s"; + static_configs = [{ + targets = [ "localhost:${toString config.services.xanthous-server.metricsPort}" ]; + }]; + } + { + job_name = "blackbox"; + metrics_path = "/probe"; + params.module = [ "https_2xx" ]; + scrape_interval = "5s"; + static_configs = [{ + targets = [ + "https://gws.fyi" + "https://windtunnel.ci" + "https://app.windtunnel.ci" + "https://metrics.gws.fyi" + ]; + }]; + relabel_configs = [{ + source_labels = [ "__address__" ]; + target_label = "__param_target"; + } + { + source_labels = [ "__param_target" ]; + target_label = "instance"; + } + { + target_label = "__address__"; + replacement = "localhost:${toString config.services.prometheus.exporters.blackbox.port}"; + }]; }]; - } { - job_name = "blackbox"; - metrics_path = "/probe"; - params.module = ["https_2xx"]; - scrape_interval = "5s"; - static_configs = [{ - targets = [ - "https://gws.fyi" - "https://windtunnel.ci" - "https://app.windtunnel.ci" - "https://metrics.gws.fyi" - ]; - }]; - relabel_configs = [{ - source_labels = ["__address__"]; - target_label = "__param_target"; - } { - source_labels = ["__param_target"]; - target_label = "instance"; - } { - target_label = "__address__"; - replacement = "localhost:${toString config.services.prometheus.exporters.blackbox.port}"; - }]; - }]; }; services.xanthous-server.enable = true; @@ -256,21 +268,23 @@ with lib; virtualisation.docker.enable = true; - services.buildkite-agents = listToAttrs (map (n: rec { - name = "mugwump-${toString n}"; - value = { - inherit name; - enable = true; - tokenPath = "/run/agenix/buildkite-agent-token"; - privateSshKeyPath = "/run/agenix/buildkite-ssh-key"; - runtimePackages = with pkgs; [ - docker - nix - gnutar - gzip - ]; - }; - }) (range 1 1)); + services.buildkite-agents = listToAttrs (map + (n: rec { + name = "mugwump-${toString n}"; + value = { + inherit name; + enable = true; + tokenPath = "/run/agenix/buildkite-agent-token"; + privateSshKeyPath = "/run/agenix/buildkite-ssh-key"; + runtimePackages = with pkgs; [ + docker + nix + gnutar + gzip + ]; + }; + }) + (range 1 1)); users.users."buildkite-agent-mugwump-1" = { isSystemUser = true; diff --git a/users/grfn/system/system/modules/common.nix b/users/grfn/system/system/modules/common.nix index 91723973f5cd..635747d118ff 100644 --- a/users/grfn/system/system/modules/common.nix +++ b/users/grfn/system/system/modules/common.nix @@ -2,7 +2,7 @@ let - depot = import ../../../../.. {}; + depot = import ../../../../.. { }; in diff --git a/users/grfn/system/system/modules/fonts.nix b/users/grfn/system/system/modules/fonts.nix index babe30d4271f..f30600b28b39 100644 --- a/users/grfn/system/system/modules/fonts.nix +++ b/users/grfn/system/system/modules/fonts.nix @@ -7,6 +7,6 @@ twitter-color-emoji ]; - fontconfig.defaultFonts.emoji = ["Twitter Color Emoji"]; + fontconfig.defaultFonts.emoji = [ "Twitter Color Emoji" ]; }; } diff --git a/users/grfn/system/system/modules/reusable/battery.nix b/users/grfn/system/system/modules/reusable/battery.nix index ca92e0c3f61c..151c2a246f32 100644 --- a/users/grfn/system/system/modules/reusable/battery.nix +++ b/users/grfn/system/system/modules/reusable/battery.nix @@ -22,11 +22,11 @@ with lib; config = let cfg = config.laptop.onLowBattery; in mkIf cfg.enable { - services.udev.extraRules = concatStrings [ - ''SUBSYSTEM=="power_supply", '' - ''ATTR{status}=="Discharging", '' - ''ATTR{capacity}=="[0-${toString cfg.thresholdPercentage}]", '' - ''RUN+="${pkgs.systemd}/bin/systemctl ${cfg.action}"'' - ]; - }; + services.udev.extraRules = concatStrings [ + ''SUBSYSTEM=="power_supply", '' + ''ATTR{status}=="Discharging", '' + ''ATTR{capacity}=="[0-${toString cfg.thresholdPercentage}]", '' + ''RUN+="${pkgs.systemd}/bin/systemctl ${cfg.action}"'' + ]; + }; } diff --git a/users/grfn/system/system/modules/tvl.nix b/users/grfn/system/system/modules/tvl.nix index 905ec8ced537..959f8449f659 100644 --- a/users/grfn/system/system/modules/tvl.nix +++ b/users/grfn/system/system/modules/tvl.nix @@ -8,7 +8,7 @@ sshKey = "/root/.ssh/id_rsa"; system = "x86_64-linux"; maxJobs = 64; - supportedFeatures = ["big-parallel" "kvm" "nixos-test" "benchmark"]; + supportedFeatures = [ "big-parallel" "kvm" "nixos-test" "benchmark" ]; }]; extraOptions = '' @@ -29,7 +29,7 @@ }; programs.ssh.knownHosts.whitby = { - hostNames = [ "whitby" "whitby.tvl.fyi" "49.12.129.211"]; + hostNames = [ "whitby" "whitby.tvl.fyi" "49.12.129.211" ]; publicKeyFile = pkgs.writeText "whitby.pub" '' ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNh/w4BSKov0jdz3gKBc98tpoLta5bb87fQXWBhAl2I ''; diff --git a/users/grfn/system/system/modules/work/kolide.nix b/users/grfn/system/system/modules/work/kolide.nix index 29ee0a0d7ce4..e4ee786f0cbe 100644 --- a/users/grfn/system/system/modules/work/kolide.nix +++ b/users/grfn/system/system/modules/work/kolide.nix @@ -3,9 +3,10 @@ let deb = ./kolide.deb; - kolide = pkgs.runCommand "kolide-data" { - buildInputs = [ pkgs.binutils-unwrapped ]; - } '' + kolide = pkgs.runCommand "kolide-data" + { + buildInputs = [ pkgs.binutils-unwrapped ]; + } '' cp ${deb} ./kolide.deb ar x kolide.deb mkdir result @@ -19,7 +20,8 @@ let mv result $out ''; -in { +in +{ systemd.services."launcher.kolide-k2" = { wantedBy = [ "multi-user.target" ]; after = [ "network.target" "syslog.service" ]; -- cgit 1.4.1