From 28ccec970435f9acfdecfae95848947c8b751e09 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 27 Mar 2020 23:32:13 -0400 Subject: Initial commit It begins... --- home/common/legacy-dotfiles.nix | 8 + home/common/solarized.nix | 18 + home/home.nix | 70 +++ home/modules/alacritty.nix | 46 ++ home/modules/alsi.nix | 41 ++ home/modules/emacs.nix | 45 ++ home/modules/i3.nix | 233 ++++++++ home/modules/lib/cloneRepo.nix | 67 +++ home/modules/nixos-logo.txt | 26 + home/modules/pure.zsh-theme | 151 +++++ home/modules/shell.nix | 189 ++++++ home/modules/vim.nix | 47 ++ home/modules/vimrc | 1121 +++++++++++++++++++++++++++++++++++ home/modules/zshrc | 371 ++++++++++++ install | 38 ++ pkgs/alsi/default.nix | 22 + system/configuration.nix | 11 + system/machines/bumblebee.nix | 21 + system/modules/common.nix | 106 ++++ system/modules/emacs.nix | 23 + system/modules/reusable/README.org | 2 + system/modules/reusable/battery.nix | 32 + system/modules/sound.nix | 14 + system/modules/xserver.nix | 19 + 24 files changed, 2721 insertions(+) create mode 100644 home/common/legacy-dotfiles.nix create mode 100644 home/common/solarized.nix create mode 100644 home/home.nix create mode 100644 home/modules/alacritty.nix create mode 100644 home/modules/alsi.nix create mode 100644 home/modules/emacs.nix create mode 100644 home/modules/i3.nix create mode 100644 home/modules/lib/cloneRepo.nix create mode 100644 home/modules/nixos-logo.txt create mode 100755 home/modules/pure.zsh-theme create mode 100644 home/modules/shell.nix create mode 100644 home/modules/vim.nix create mode 100644 home/modules/vimrc create mode 100644 home/modules/zshrc create mode 100755 install create mode 100644 pkgs/alsi/default.nix create mode 100644 system/configuration.nix create mode 100644 system/machines/bumblebee.nix create mode 100644 system/modules/common.nix create mode 100644 system/modules/emacs.nix create mode 100644 system/modules/reusable/README.org create mode 100644 system/modules/reusable/battery.nix create mode 100644 system/modules/sound.nix create mode 100644 system/modules/xserver.nix diff --git a/home/common/legacy-dotfiles.nix b/home/common/legacy-dotfiles.nix new file mode 100644 index 000000000000..33d9581e6a61 --- /dev/null +++ b/home/common/legacy-dotfiles.nix @@ -0,0 +1,8 @@ +with import {}; +fetchgit { + url = "https://github.com/glittershark/dotfiles.git"; + rev = "e0c7f2592fbc2f9942763d2146d362a1314630e9"; + # date = "2020-03-25T20:38:51-04:00"; + sha256 = "126zy4ff6nl2vma2s74waksim7j5h3n6qpaxnnn17vkc1cq0fcd9"; + fetchSubmodules = false; +} diff --git a/home/common/solarized.nix b/home/common/solarized.nix new file mode 100644 index 000000000000..e94693edc566 --- /dev/null +++ b/home/common/solarized.nix @@ -0,0 +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"; + magenta = "#d33682"; + violet = "#6c71c4"; + blue = "#268bd2"; + cyan = "#2aa198"; + green = "#859900"; +} diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 000000000000..e0ecda410b9f --- /dev/null +++ b/home/home.nix @@ -0,0 +1,70 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./modules/alacritty.nix + ./modules/emacs.nix + ./modules/i3.nix + ./modules/shell.nix + ./modules/vim.nix + ./modules/alsi.nix + ./modules/lib/cloneRepo.nix + + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + xsession.enable = true; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "19.09"; + + home.packages = with pkgs; [ + nix-prefetch-github + htop + powertop + pass + gitAndTools.hub + shellcheck + gnupg + + # Spotify...etc + spotify + playerctl + + # games + crawl + dwarf-fortress + ]; + + nixpkgs.config.allowUnfree = true; + + programs.git = { + enable = true; + userEmail = "root@gws.fyi"; + userName = "Griffin Smith"; + }; + + services.redshift = { + enable = true; + provider = "geoclue2"; + }; + + services.pasystray.enable = true; + + impure.clonedRepos.passwordStore = { + github = "glittershark/pass"; + path = ".password-store"; + }; + + services.gpg-agent = { + enable = true; + }; +} diff --git a/home/modules/alacritty.nix b/home/modules/alacritty.nix new file mode 100644 index 000000000000..ba26360fe924 --- /dev/null +++ b/home/modules/alacritty.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: +{ + home.packages = with pkgs; [ + alacritty + ]; + + programs.alacritty = { + enable = true; + settings = { + font.size = 6; + + colors = with import ../common/solarized.nix; rec { + # Default colors + primary = { + background = base3; + foreground = base00; + }; + + cursor = { + text = base3; + cursor = base00; + }; + + # Normal colors + normal = { + inherit red green yellow blue magenta cyan; + black = base02; + white = base2; + }; + + # Bright colors + bright = normal; + # bright = { + # black = base03; + # red = orange; + # green = base01; + # yellow = base00; + # blue = base0; + # magenta = violet; + # cyan = base1; + # white = base3; + # }; + }; + }; + }; +} diff --git a/home/modules/alsi.nix b/home/modules/alsi.nix new file mode 100644 index 000000000000..cb9802e2ceea --- /dev/null +++ b/home/modules/alsi.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: +let alsi = pkgs.callPackage ../../pkgs/alsi {}; +in +{ + home.packages = [ alsi ]; + + home.file.".config/alsi/alsi.logo" = { + source = ./nixos-logo.txt; + force = true; + }; + + home.file.".config/alsi/alsi.conf" = { + text = '' + #!${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", + } + ''; + force = true; + }; +} diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix new file mode 100644 index 000000000000..05b09ec2c5d8 --- /dev/null +++ b/home/modules/emacs.nix @@ -0,0 +1,45 @@ +{ pkgs, 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 + # }; +in { + imports = [ ./lib/cloneRepo.nix ]; + + # home.packages = [ doom-emacs ]; + # home.file.".emacs.d/init.el".text = '' + # (load "default.el") + # ''; + # + + home.packages = [ + # haskellPackages.Agda BROKEN + ]; + + programs.emacs.enable = true; + home.file.".doom.d".source = ./doom.d; + + impure.clonedRepos = { + orgClubhouse = { + github = "glittershark/org-clubhouse"; + path = "code/org-clubhouse"; + }; + + doomEmacs = { + github = "hlissner/org-clubhouse"; + path = ".emacs.d"; + after = ["orgClubhouse"]; + onClone = "bin/doom install"; + }; + }; + + # Notes + services.syncthing = { + enable = true; + tray = true; + }; +} diff --git a/home/modules/i3.nix b/home/modules/i3.nix new file mode 100644 index 000000000000..e4820b5280b4 --- /dev/null +++ b/home/modules/i3.nix @@ -0,0 +1,233 @@ +{ config, lib, pkgs, ... }: +let + mod = "Mod4"; + solarized = import ../common/solarized.nix; + decorationFont = "MesloLGSDZ 6"; +in { + home.packages = with pkgs; [ + maim + rofi + i3status + python38Packages.py3status + ]; + + xsession.scriptPath = ".hm-xsession"; + xsession.windowManager.i3 = { + enable = true; + config = { + modifier = mod; + keybindings = lib.mkOptionDefault { + "${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+x" = "kill"; + + "${mod}+Return" = "exec alacritty"; + + "${mod}+Shift+s" = "split h"; + "${mod}+Shift+v" = "split v"; + + "${mod}+f" = "fullscreen"; + + "${mod}+Shift+r" = "exec home-manager switch"; + + "${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: ' ''; + + # Screenshots + "${mod}+q" = "exec maim"; + "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; + + # Launching applications + "${mod}+u" = + let rofi = pkgs.writeShellScript "rofi" '' + rofi \ + -modi 'combi' \ + -combi-modi "window,drun,ssh,run" \ + -font 'MesloLGSDZ 10' \ + -show combi + ''; + in "exec ${rofi}"; + + # Media + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrevious" = "exec playerctl previous"; + "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; + "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; + "XF86AudioMute" = "exec pulseaudio-ctl mute"; + + # Screen Layout + "${mod}+Shift+t" = "exec xrandr --auto"; + # TODO + # $mod+t exec /home/griffin/.screenlayout/work.sh + # $mod+Ctrl+t exec /home/griffin/bin/fix_screen.sh + }; + + fonts = [ decorationFont ]; + + colors = with solarized; rec { + focused = { + border = base01; + background = base01; + text = base3; + indicator = red; + childBorder = base02; + }; + focusedInactive = focused // { + border = base03; + background = base03; + # text = base1; + }; + unfocused = focusedInactive; + background = base03; + }; + + modes.resize = { + l = "resize shrink width 5 px or 5 ppt"; + k = "resize grow height 5 px or 5 ppt"; + j = "resize shrink height 5 px or 5 ppt"; + h = "resize grow width 5 px or 5 ppt"; + + Return = "mode \"default\""; + }; + + bars = [{ + statusCommand = + let i3status-conf = pkgs.writeText "i3status.conf" '' + general { + output_format = i3bar + colors = true + color_good = "#859900" + + interval = 1 + } + + order += "mpd" + order += "wireless wlp3s0" + order += "ethernet enp3s0f0" + order += "cpu_usage" + order += "battery 0" + # order += "volume master" + order += "time" + + mpd { + format = "%artist - %album - %title" + } + + wireless wlp3s0 { + 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 " + } + + # volume master { + # format = "☊ %volume" + # format_muted = "☊ X" + # device = "default" + # mixer_idx = 0 + # } + ''; + in "py3status -c ${i3status-conf}"; + fonts = [ decorationFont ]; + position = "top"; + colors = with solarized; rec { + background = base03; + statusline = base3; + separator = base1; + activeWorkspace = { + border = base03; + background = base1; + text = base3; + }; + focusedWorkspace = activeWorkspace; + inactiveWorkspace = activeWorkspace // { + background = base01; + }; + urgentWorkspace = activeWorkspace // { + background = red; + }; + }; + }]; + }; + }; + + services.dunst = { + enable = true; + settings = with solarized; { + global = { + font = "Meslo 6"; + allow_markup = true; + format = "%s\n%b"; + sort = true; + alignment = "left"; + geometry = "600x5-30+20"; + idle_threshold = 120; + separator_color = "frame"; + }; + + frame = { + width = 0; + color = "#aaaaaa"; + }; + + shortcuts = { + close = "ctrl+space"; + close_all = "ctrl+shift+space"; + history = "ctrl+grave"; + context = "ctrl+shift+period"; + }; + + urgency_low = { + background = base03; + foreground = base3; + timeout = 5; + }; + + urgency_normal = { + background = base02; + foreground = base3; + timeout = 7; + }; + + urgency_critical = { + background = red; + foreground = base3; + timeout = 0; + }; + }; + }; +} diff --git a/home/modules/lib/cloneRepo.nix b/home/modules/lib/cloneRepo.nix new file mode 100644 index 000000000000..50f6ca2d3d01 --- /dev/null +++ b/home/modules/lib/cloneRepo.nix @@ -0,0 +1,67 @@ +{ lib, config, ... }: +with lib; +{ + options = { + impure.clonedRepos = mkOption { + description = "Repositories to clone"; + default = {}; + type = with types; loaOf ( + 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; + }; + + 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 = ""; + }; + + 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)) + ); + }; + }; + + 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.impure.clonedRepos; + }; +} diff --git a/home/modules/nixos-logo.txt b/home/modules/nixos-logo.txt new file mode 100644 index 000000000000..d4b16b44f0bf --- /dev/null +++ b/home/modules/nixos-logo.txt @@ -0,0 +1,26 @@ + (((((( ###%###### ##%###/ + ,(((((((/( #%#%#%#%# .#%#%#%#%# + ((((((/// %#######%. #####%###/ + (((((/(//, /##%###%###%###### + (((////// #####%########( + .(((((((((((((((///////////////#%%%######## (( + (((((((((((((((///////////////////######### .(((( + ((((((((((((((((/(//////////////////########## (((((((( + (######### ######### ((((((((( + ######### #########/(((((((((( + *######### .#######((((((((( + ###%################### ####(//(((((((((((((((( +####%################## .#////////(((((((((((((( +%%%%%%%%%%%%%%#######(( ////////////(((((((((((( + ###%#######%#######////. ///////////////////(((( + ###%###%#///////( ///////// + .####%#### ///////// /////////, + %#%#%#%#%* /////////( ///////// + .#####%# ////////(######################%#######%#####, + %#### (////////#####################%###%###%###% + .# (//////(//((###################%#######%##% + (//((((((((((( #####%%%%( + //(/(((((((((((((( ######%## + ((((((((( ((((((((( #####%###/ + ((((((((( /((((((((( .###%####% + (((((( ((((((((( %#%#%#/ diff --git a/home/modules/pure.zsh-theme b/home/modules/pure.zsh-theme new file mode 100755 index 000000000000..b4776e81596d --- /dev/null +++ b/home/modules/pure.zsh-theme @@ -0,0 +1,151 @@ +#!/bin/zsh -f +# vim: ft=zsh: +# MIT License +# For my own and others sanity +# git: +# %b => current branch +# %a => current action (rebase/merge) +# prompt: +# %F => color dict +# %f => reset color +# %~ => current path +# %* => time +# %n => username +# %m => shortname host +# %(?..) => prompt conditional - %(condition.true.false) + +# turns seconds into human readable time +# 165392 => 1d 21h 56m 32s +prompt_pure_human_time() { + local tmp=$1 + local days=$(( tmp / 60 / 60 / 24 )) + local hours=$(( tmp / 60 / 60 % 24 )) + local minutes=$(( tmp / 60 % 60 )) + local seconds=$(( tmp % 60 )) + (( $days > 0 )) && echo -n "${days}d " + (( $hours > 0 )) && echo -n "${hours}h " + (( $minutes > 0 )) && echo -n "${minutes}m " + echo "${seconds}s" +} + +is_git_repo() { + command git rev-parse --is-inside-work-tree &>/dev/null + return $? +} + +# fastest possible way to check if repo is dirty +prompt_pure_git_dirty() { + # check if we're in a git repo + is_git_repo || return + # check if it's dirty + [[ "$PURE_GIT_UNTRACKED_DIRTY" == 0 ]] && local umode="-uno" || local umode="-unormal" + command test -n "$(git status --porcelain --ignore-submodules ${umode})" + + (($? == 0)) && echo '*' +} + +prompt_pure_git_wip() { + is_git_repo || return + local subject="$(command git show --pretty=%s --quiet HEAD 2>/dev/null)" + [ "$subject" == 'wip' ] && echo '[WIP]' +} + +# displays the exec time of the last command if set threshold was exceeded +prompt_pure_cmd_exec_time() { + local stop=$EPOCHSECONDS + local start=${cmd_timestamp:-$stop} + integer elapsed=$stop-$start + (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed +} + +prompt_pure_preexec() { + cmd_timestamp=$EPOCHSECONDS + + # shows the current dir and executed command in the title when a process is active + print -Pn "\e]0;" + echo -nE "$PWD:t: $2" + print -Pn "\a" +} + +# string length ignoring ansi escapes +prompt_pure_string_length() { + echo ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} +} + +prompt_pure_nix_info() { + local packages_info='' + if [[ -z $NIX_SHELL_PACKAGES ]]; then + packages_info='[nix-shell]' + else + packages_info="{ $NIX_SHELL_PACKAGES }" + fi + + case $IN_NIX_SHELL in + 'pure') + echo "$fg_bold[green][nix-shell] " + ;; + 'impure') + echo "$fg_bold[magenta][nix-shell] " + ;; + *) ;; + esac +} + +prompt_pure_precmd() { + # shows the full path in the title + print -Pn '\e]0;%~\a' + + # git info + vcs_info + + local prompt_pure_preprompt="\n$(prompt_pure_nix_info)$fg_bold[green]$prompt_pure_username%F{blue}%~%F{yellow}$vcs_info_msg_0_`prompt_pure_git_dirty` $fg_no_bold[red]`prompt_pure_git_wip`%f %F{yellow}`prompt_pure_cmd_exec_time`%f " + print -P $prompt_pure_preprompt + + # check async if there is anything to pull + # (( ${PURE_GIT_PULL:-1} )) && { + # # check if we're in a git repo + # command git rev-parse --is-inside-work-tree &>/dev/null && + # # make sure working tree is not $HOME + # [[ "$(command git rev-parse --show-toplevel)" != "$HOME" ]] && + # # check check if there is anything to pull + # command git fetch &>/dev/null && + # # check if there is an upstream configured for this branch + # command git rev-parse --abbrev-ref @'{u}' &>/dev/null && { + # local arrows='' + # (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows='⇣' + # (( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+='⇡' + # print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}${arrows}%f\e8" + # } + # } &! + + # reset value since `preexec` isn't always triggered + unset cmd_timestamp +} + + +prompt_pure_setup() { + # prevent percentage showing up + # if output doesn't end with a newline + export PROMPT_EOL_MARK='' + + prompt_opts=(cr subst percent) + + zmodload zsh/datetime + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + add-zsh-hook precmd prompt_pure_precmd + add-zsh-hook preexec prompt_pure_preexec + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:git*' formats ' %b' + zstyle ':vcs_info:git*' actionformats ' %b|%a' + + # show username@host if logged in through SSH + [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' + + # prompt turns red if the previous command didn't exit with 0 + PROMPT='%(?.%F{green}.%F{red})❯%f ' +} + +prompt_pure_setup "$@" diff --git a/home/modules/shell.nix b/home/modules/shell.nix new file mode 100644 index 000000000000..51dc0e3670e3 --- /dev/null +++ b/home/modules/shell.nix @@ -0,0 +1,189 @@ +{ config, lib, pkgs, ... }: +{ + home.packages = with pkgs; [ + zsh + autojump + ]; + + programs.zsh = { + enable = true; + enableAutosuggestions = true; + autocd = true; + + shellAliases = rec { + # NixOS stuff + hms = "home-manager switch"; + nor = "sudo nixos-rebuild switch"; + nrs = nor; + vihome = "vim ~/.config/nixpkgs/home.nix && home-manager switch"; + virc = "vim ~/.config/nixpkgs/home/shell.nix && home-manager switch && source ~/.zshrc"; + + # Nix + ns = "nix-shell"; + + # Aliases from old config + stck = "dirs -v"; + b= "cd ~1"; + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../.."; + "....." = "cd ../../../.."; + "http" = "http --style solarized"; + "grep" = "grep $GREP_OPTIONS"; + "bak" = "~/bin/backup.sh"; + "xmm" = "xmodmap ~/.Xmodmap"; + "asdflkj" = "asdf"; + "asdf" = "asdfghjkl"; + "asdfghjkl" = "echo \"Having some trouble?\""; + "ift" = "sudo iftop -i wlp3s0"; + "rvpn" = "sudo systemctl restart openvpn@bldr-dev openvpn@lsvl-dev"; + "gne" = "gn edit"; + "gnf" = "gn find"; + "gnt" = "gn tag-list"; + "gnn" = "gn notebook-list"; + "mytl" = "t tl $TWITTER_WHOAMI"; + "first" = "awk '{print \$$1}'"; + "dcu" = "docker-compose up"; + "dc" = "docker-compose"; + "dck" = "docker"; + "dockerclean" = "dockercleancontainers && dockercleanimages"; + "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; + "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; + "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; + "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; + "vi" = "vim"; + "awa" = "ssh aw2-admin.nomi.host"; + "dtf" = "cd ~/.dotfiles"; + "adbdev" = "adb devices"; + "adbcon" = "adb connect $GNEX_IP"; + "gwip" = "git add . && git commit -am wip"; + "gpr" = "g pull-request"; + "gcl" = "git clone"; + "grs" = "gr --soft"; + "grhh" = "grh HEAD"; + "grh" = "gr --hard"; + "gr" = "git reset"; + "gcb" = "gc -b"; + "gco" = "gc"; + "gcd" = "gc development"; + "gcm" = "gc master"; + "gc" = "git checkout"; + "gbg" = "git branch | grep"; + "gba" = "git branch -a"; + "gb" = "git branch"; + "gcv" = "git commit --verbose"; + "gci" = "git commit"; + "gm" = "git merge"; + "gdc" = "gd --cached"; + "gd" = "git diff"; + "gsl" = "git stash list"; + "gss" = "git show stash"; + "gsad" = "git stash drop"; + "gsa" = "git stash"; + "gst" = "gs"; + "gs" = "git status"; + "gg" = "gl --decorate --oneline --graph --date-order --all"; + "gl" = "git log"; + "gf" = "git fetch"; + "gur" = "gu --rebase"; + "gu" = "git pull"; + "gpf" = "gp -f"; + "gpa" = "gp --all"; + "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; + "gp" = "git push"; + "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; + "ga" = "git add"; + "gnp" = "git --no-pager"; + "g" = "git"; + "git" = "hub"; + "mpalb" = "mpc search album"; + "mpart" = "mpc search artist"; + "mps" = "mpc search"; + "mpa" = "mpc add"; + "mpt" = "mpc toggle"; + "mpl" = "mpc playlist"; + "dsstore" = "find . -name '*.DS_Store' -type f -ls -delete"; + "df" = "df -h"; + "fs" = "stat -f '%z bytes'"; + "ll" = "ls -al"; + "la" = "ls -a"; + }; + + oh-my-zsh = { + enable = true; + + plugins = [ + "battery" + "colorize" + "command-not-found" + "github" + "gitignore" + "postgres" + "systemd" + "themes" + "vi-mode" + ]; + + custom = "${pkgs.stdenv.mkDerivation { + name = "oh-my-zsh-custom"; + unpackPhase = ":"; + installPhase = '' + mkdir -p $out/themes + mkdir -p $out/custom/plugins + ln -s ${./pure.zsh-theme} $out/themes/pure.zsh-theme + ''; + }}"; + + theme = "pure"; + }; + + plugins = [{ + name = "pure-theme"; + src = pkgs.fetchFromGitHub { + owner = "sindresorhus"; + repo = "pure"; + rev = "0a92b02dd4172f6c64fdc9b81fe6cd4bddb0a23b"; + sha256 = "0l8jqhmmjn7p32hdjnv121xsjnqd2c0plhzgydv2yzrmqgyvx7cc"; + }; + }]; + + initExtraBeforeCompInit = '' + zstyle ':completion:*' completer _complete _ignored _correct _approximate + zstyle ':completion:*' matcher-list \'\' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._- :]=** r:|=**' 'l:|=* r:|=*' + zstyle ':completion:*' max-errors 5 + zstyle ':completion:*' use-cache yes + zstyle ':completion::complete:grunt::options:' expire 1 + zstyle ':completion:*' prompt '%e errors' + # zstyle :compinstall filename '~/.zshrc' + autoload -Uz compinit + ''; + + initExtra = '' + source ${./zshrc} + source ${pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = "7678a8a22780141617f809002eeccf054bf8f448"; + sha256 = "0xh4fbd54kvwwpqvabk8lpw7m80phxdzrd75q3y874jw0xx1a9q6"; + }}/zsh-syntax-highlighting.zsh + source ${pkgs.autojump}/share/autojump/autojump.zsh + source ${pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "a65382a353eaee5a98f068c330947c032a1263bb"; + sha256 = "0l41ac5b7p8yyjvpfp438kw7zl9dblrpd7icjg1v3ig3xy87zv0n"; + }}/nix-shell.plugin.zsh + + autoload -U promptinit; promptinit + prompt pure + + [[ ! $IN_NIX_SHELL ]] && alsi -l + ''; + }; + + programs.fzf = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/home/modules/vim.nix b/home/modules/vim.nix new file mode 100644 index 000000000000..87d4309333dd --- /dev/null +++ b/home/modules/vim.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: +{ + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + plugins = with pkgs.vimPlugins; [ + ctrlp + deoplete-nvim + syntastic + vim-abolish + vim-airline + vim-airline-themes + vim-bufferline + vim-closetag + # vim-colors-solarized + # solarized + (pkgs.vimUtils.buildVimPlugin { + name = "vim-colors-solarized"; + src = pkgs.fetchFromGitHub { + owner = "glittershark"; + repo = "vim-colors-solarized"; + rev = "4857c3221ec3f2693a45855154cb61a2cefb514d"; + sha256 = "0kqp5w14g7adaiinmixm7z3x4w74lv1lcgbqjbirx760f0wivf9y"; + }; + }) + vim-commentary + vim-dispatch + vim-endwise + vim-repeat + vim-fugitive + vim-markdown + vim-nix + vim-rhubarb + vim-sexp + vim-sexp-mappings-for-regular-people + vim-sleuth + vim-startify + vim-surround + vim-unimpaired + vinegar + ]; + extraConfig = '' + source ${./vimrc} + ''; + }; +} diff --git a/home/modules/vimrc b/home/modules/vimrc new file mode 100644 index 000000000000..16bc8d9184c6 --- /dev/null +++ b/home/modules/vimrc @@ -0,0 +1,1121 @@ +" vim:set fdm=marker fmr={{{,}}} ts=2 sts=2 sw=2 expandtab: + + +" Basic Options {{{ +set nocompatible +set modeline +set modelines=10 +syntax enable +filetype plugin indent on +set ruler +set showcmd +set number +set incsearch +set smartcase +set ignorecase +set scrolloff=10 +set tabstop=4 +set shiftwidth=4 +set softtabstop=4 +set nosmartindent +set expandtab +set noerrorbells visualbell t_vb= +set laststatus=2 +set hidden +let mapleader = ',' +let maplocalleader = '\' +set undofile +" set undodir=~/.vim/undo +set wildignore=*.pyc,*.o,.git +set clipboard=unnamed +" set backupdir=$HOME/.vim/backup +" set directory=$HOME/.vim/tmp +set foldmarker={{{,}}} +set colorcolumn=+1 +set concealcursor= +set formatoptions+=j +set wildmenu +set wildmode=longest,list:full +set noincsearch +" }}} + +" GUI options {{{ +set go-=m +set go-=T +set go-=r +set go-=L +set go-=e +set guifont=Meslo\ LG\ S\ DZ\ 9 +" }}} + +" Colors {{{ +" set t_Co=256 + +fu! ReverseBackground() + if &bg=="light" + se bg=dark + else + se bg=light + endif +endf +com! BgToggle call ReverseBackground() +nm :BgToggle + +set background=light +colorscheme solarized +" }}} + +" --------------------------------------------------------------------------- + +" CtrlP {{{ +let g:ctrlp_custom_ignore = { + \ 'dir': '(node_modules|target)' + \ } +let g:ctrlp_max_files = 0 +let g:ctrlp_max_depth = 100 +" }}} + +" YouCompleteMe {{{ +let g:ycm_semantic_triggers = { + \ 'c' : ['->', '.'], + \ 'objc' : ['->', '.'], + \ 'ocaml' : ['.', '#'], + \ 'cpp,objcpp' : ['->', '.', '::'], + \ 'perl' : ['->'], + \ 'php' : ['->', '::'], + \ 'cs,java,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'], + \ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'], + \ 'lua' : ['.', ':'], + \ 'erlang' : [':'], + \ 'clojure' : [], + \ 'haskell' : ['re!.*', '.', ' ', '('] + \ } + " \ 'haskell' : ['.', '(', ' '] + " \ 'ruby' : ['.', '::'], + " \ 'clojure' : ['(', '.', '/', '['] +" }}} + +" Neocomplete {{{ +if !has('nvim') + " Use neocomplete. + let g:neocomplete#enable_at_startup = 1 + " Use smartcase. + let g:neocomplete#enable_smart_case = 1 + " Set minimum syntax keyword length. + let g:neocomplete#sources#syntax#min_keyword_length = 3 + let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' + + " Define dictionary. + " let g:neocomplete#sources#dictionary#dictionaries = { + " \ 'default' : '', + " \ 'vimshell' : $HOME.'/.vimshell_hist', + " \ 'scheme' : $HOME.'/.gosh_completions' + " \ } + + " Define keyword. + if !exists('g:neocomplete#keyword_patterns') + let g:neocomplete#keyword_patterns = {} + endif + let g:neocomplete#keyword_patterns['default'] = '\h\w*' + + " Plugin key-mappings. + inoremap neocomplete#undo_completion() + inoremap neocomplete#complete_common_string() + + " Recommended key-mappings. + " : close popup and save indent. + inoremap =my_cr_function() + function! s:my_cr_function() + return (pumvisible() ? "\" : "" ) . "\" + " For no inserting key. + "return pumvisible() ? "\" : "\" + endfunction + " : completion. + inoremap pumvisible() ? "\" : "\" + " , : close popup and delete backword char. + inoremap neocomplete#smart_close_popup()."\" + inoremap neocomplete#smart_close_popup()."\" + " Close popup by . + "inoremap pumvisible() ? "\" : "\" + + " AutoComplPop like behavior. + "let g:neocomplete#enable_auto_select = 1 + + " Shell like behavior(not recommended). + "set completeopt+=longest + "let g:neocomplete#enable_auto_select = 1 + "let g:neocomplete#disable_auto_complete = 1 + "inoremap pumvisible() ? "\" : "\\" + + " Enable omni completion. + " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS + " autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags + " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS + " autocmd FileType python setlocal omnifunc=pythoncomplete#Complete + " autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags + + " Enable heavy omni completion. + if !exists('g:neocomplete#sources#omni#input_patterns') + let g:neocomplete#sources#omni#input_patterns = {} + endif +endif +" }}} + +" Deoplete {{{ +if has('nvim') + let g:deoplete#enable_at_startup = 1 + + inoremap =my_cr_function() + function! s:my_cr_function() + return (pumvisible() ? "\" : "" ) . "\" + " For no inserting key. + "return pumvisible() ? "\" : "\" + endfunction + " : completion. + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "\" +endif +" }}} + +" Neovim Terminal mode {{{ +if has('nvim') + tnoremap + nnoremap \\ :tabedit term://zsh + nnoremap q\ :call OpenRepl() + + if !exists('g:repl_size') + let g:repl_size=9 + endif + + function! s:OpenRepl() " {{{ + " Check if buffer exists and is open + if exists('s:repl_bufname') && bufexists(s:repl_bufname) && bufwinnr(s:repl_bufname) >=? 0 + " If so, just switch to it + execute bufwinnr(s:repl_bufname) . 'wincmd' 'w' + norm i + return + endif + + if !exists('b:console') + let b:console=$SHELL + endif + + let l:console_cmd = b:console + + execute 'bot' g:repl_size . 'new' + set winfixheight nobuflisted + call termopen(l:console_cmd) + let s:repl_bufname = bufname('%') + norm i + endfunction " }}} +endif +" }}} + +" Tagbar options {{{ +let g:tagbar_autoclose = 1 +let g:tagbar_autofocus = 1 +let g:tagbar_compact = 1 +" }}} + +" delimitMate options {{{ +let g:delimitMate_expand_cr = 1 +" }}} + +" UltiSnips options {{{ +let g:UltiSnipsExpandTrigger = '' + "g:UltiSnipsJumpForwardTrigger + "g:UltiSnipsJumpBackwardTrigger +" }}} + +" VDebug Options {{{ +let g:vdebug_options = {'server': '192.168.56.1'} +" }}} + +" Statusline {{{ +let g:airline_powerline_fonts=1 + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif +let g:airline_symbols.space = "\ua0" + +let g:airline#extensions#tagbar#flags = 'f' +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tabline#show_buffers = 0 +let g:airline#extensions#tabline#show_tabs = 1 +let g:airline#extensions#tabline#tab_min_count = 2 +let g:airline#extensions#tmuxline#enabled = 0 + +let g:tmuxline_theme = 'airline' +let g:tmuxline_preset = 'full' + +"set statusline= +"set statusline+=%2*[%n%H%M%R%W]%*\ " flags and buf no +"set statusline+=%-40f%<\ " path +"set statusline+=%=%40{fugitive#statusline()}\ " Vim status +"set statusline+=%1*%y%*%*\ " file type +"set statusline+=%10((%l,%c)%)\ " line and column +"set statusline+=%P " percentage of file +" }}} + +" Code review mode {{{ +fun! GetFontName() + return substitute(&guifont, '^\(.\{-}\)[0-9]*$', '\1', '') +endfun + +fun! CodeReviewMode() + let &guifont = GetFontName() . ' 15' +endfun +com! CodeReviewMode call CodeReviewMode() +" }}} + +" Syntastic {{{ +let g:syntastic_enable_signs = 0 + +" Python {{{ +let g:syntastic_python_checkers = ['flake8'] +let g:syntastic_python_flake8_post_args = "--ignore=E101,E223,E224,E301,E302,E303,E501,E701,W,F401,E111,E261" + +" }}} +" Javascript {{{ +let g:syntastic_javascript_checkers = ['eslint'] +let g:flow#autoclose = 1 +let g:flow#enable = 1 + +" augroup syntastic_javascript_jsx +" autocmd! +" autocmd BufReadPre,BufNewFile *.js +" autocmd BufReadPre,BufNewFile *.jsx +" \ let g:syntastic_javascript_checkers = ['jsxhint'] +" augroup END + +" }}} +" Haml {{{ +let g:syntastic_haml_checkers = ['haml_lint'] + +" }}} +" Html {{{ +let g:syntastic_html_checkers = [] + +" }}} +" Ruby {{{ +let g:syntastic_ruby_checkers = ['rubocop'] +" }}} +" SASS/SCSS {{{ +let g:syntastic_scss_checkers = ['scss_lint'] +" }}} +" Haskell {{{ +" let g:syntastic_haskell_checkers = ['ghc-mod'] +" }}} +" Elixir {{{ +let g:syntastic_elixir_checkers = ['elixir'] +let g:syntastic_enable_elixir_checker = 1 +" }}} +" }}} + +" Bufferline {{{ +let g:bufferline_echo=0 +" }}} + +" Eclim {{{ +let g:EclimCompletionMethod = 'omnifunc' +augroup eclim + au! + au FileType java call JavaSetup() + au FileType java set textwidth=120 +augroup END + +function! s:JavaSetup() abort + noremap :JavaImport + nnoremap K :JavaDocPreview + nnoremap ]d :JavaSearchContext + nnoremap [d :JavaSearchContext + nnoremap g :JUnit + nnoremap g\ :Mvn test +endfunction +" }}} + +" Signify options {{{ +let g:signify_mapping_next_hunk = ']h' +let g:signify_mapping_prev_hunk = '[h' +let g:signify_vcs_list = ['git'] +let g:signify_sign_change = '~' +let g:signify_sign_delete = '-' +" }}} + +" Simplenote {{{ +let g:SimplenoteFiletype = 'markdown' +let g:SimplenoteSortOrder = 'pinned,modifydate,tagged,createdate' +let g:SimplenoteVertical = 1 + +nnoremap nn :Simplenote -n +nnoremap nl :Simplenote -l +nnoremap nw :Simplenote -l work +nnoremap nt :Simplenote -t +" }}} + +" Emmet {{{ +" Expand abbreviation +let g:user_emmet_leader_key = '' +" }}} + +" Startify {{{ +let g:startify_bookmarks=[ '~/.vimrc', '~/.zshrc' ] +" }}} + +" Abolish {{{ +let g:abolish_save_file = expand('~/.vim/after/plugin/abolish.vim') +" }}} + +" Rails projections {{{ + +if !exists('g:rails_projections') + let g:rails_projections = {} +endif + +call extend(g:rails_projections, { + \ "config/routes.rb": { "command": "routes" }, + \ "config/structure.sql": { "command": "structure" } + \ }, 'keep') + +if !exists('g:rails_gem_projections') + let g:rails_gem_projections = {} +endif + +call extend(g:rails_gem_projections, { + \ "active_model_serializers": { + \ "app/serializers/*_serializer.rb": { + \ "command": "serializer", + \ "template": "class %SSerializer < ActiveModel::Serializer\nend", + \ "affinity": "model"}}, + \ "react-rails": { + \ "app/assets/javascripts/components/*.jsx": { + \ "command": "component", + \ "template": "var %S = window.%S = React.createClass({\n render: function() {\n }\n});", + \ "alternate": "spec/javascripts/components/%s_spec.jsx" }, + \ "spec/javascripts/components/*_spec.jsx": { + \ "alternate": "app/assets/javascripts/components/{}.jsx" }}, + \ "rspec": { + \ "spec/**/support/*.rb": { + \ "command": "support"}}, + \ "cucumber": { + \ "features/*.feature": { + \ "command": "feature", + \ "template": "Feature: %h"}, + \ "features/support/*.rb": { + \ "command": "support"}, + \ "features/support/env.rb": { + \ "command": "support"}, + \ "features/step_definitions/*_steps.rb": { + \ "command": "steps"}}, + \ "carrierwave": { + \ "app/uploaders/*_uploader.rb": { + \ "command": "uploader", + \ "template": "class %SUploader < CarrierWave::Uploader::Base\nend"}}, + \ "draper": { + \ "app/decorators/*_decorator.rb": { + \ "command": "decorator", + \ "affinity": "model", + \ "template": "class %SDecorator < Draper::Decorator\nend"}}, + \ "fabrication": { + \ "spec/fabricators/*_fabricator.rb": { + \ "command": ["fabricator", "factory"], + \ "alternate": "app/models/%s.rb", + \ "related": "db/schema.rb#%p", + \ "test": "spec/models/%s_spec.rb", + \ "template": "Fabricator :%s do\nend", + \ "affinity": "model"}}, + \ "factory_girl": { + \ "spec/factories/*.rb": { + \ "command": "factory", + \ "alternate": "app/models/%i.rb", + \ "related": "db/structure.sql#%s", + \ "test": "spec/models/%s_spec.rb", + \ "template": "FactoryGirl.define do\n factory :%i do\n end\nend", + \ "affinity": "model"}, + \ "spec/factories.rb": { + \ "command": "factory"}, + \ "test/factories.rb": { + \ "command": "factory"}} + \ }, 'keep') +" }}} + +" Other projections {{{ +let g:projectionist_heuristics = { + \ "config.ru&docker-compose.yml&app/&config/&OWNERS": { + \ "app/jobs/*.rb": { + \ "type": "job", + \ "alternate": "spec/jobs/{}_spec.rb" + \ }, + \ "app/models/*.rb": { + \ "type": "model", + \ "alternate": "spec/models/{}_spec.rb" + \ }, + \ "app/resources/*_resource.rb": { + \ "type": "resource", + \ "alternate": "spec/resources/{}_resource_spec.rb" + \ }, + \ "config/*.yml": { + \ "type": "config" + \ }, + \ "spec/*_spec.rb": { + \ "type": "spec", + \ "alternate": "app/{}.rb" + \ }, + \ "spec/factories/*.rb": { + \ "type": "factory", + \ } + \ }, + \ "svc-gateway.cabal": { + \ "src/*.hs": { + \ "type": "src", + \ "alternate": "test/{}Spec.hs" + \ }, + \ "test/*Spec.hs": { + \ "type": "spec", + \ "alternate": "src/{}.hs", + \ "template": [ + \ "module Gateway.Resource.HierarchySpec (main, spec) where", + \ "", + \ "import Prelude", + \ "import Test.Hspec", + \ "import Data.Aeson", + \ "", + \ "import Gateway.Resource.Hierarchy", + \ "", + \ "main :: IO ()", + \ "main = hspec spec", + \ "", + \ "spec :: Spec", + \ "spec = do", + \ " describe \"something\" $ undefined" + \ ] + \ }, + \ "svc-gateway.cabal": { + \ "type": "cabal" + \ } + \ }, + \ "package.json&.flowconfig": { + \ "src/*.*": { + \ "type": "src", + \ "alternate": "test/{}_spec.js" + \ } + \ }, + \ "pom.xml&src/main/clj/|src/main/cljs": { + \ "*": { + \ "start": "USE_NREPL=1 bin/run -m elephant.dev-system" , + \ "connect": "nrepl://localhost:5554", + \ "piggieback": "(figwheel-sidecar.repl-api/repl-env)" + \ }, + \ "pom.xml": { "type": "pom" }, + \ "src/main/clj/*.clj": { + \ "alternate": "src/test/clj/{}_test.clj", + \ "template": ["(ns {dot|hyphenate})"] + \ }, + \ "src/test/clj/*_test.clj": { + \ "alternate": "src/main/clj/{}.clj", + \ "dispatch": ":RunTests {dot|hyphenate}-test", + \ "template": ["(ns {dot|hyphenate}-test", + \ " (:require [clojure.test :refer :all]))"] + \ }, + \ "src/main/cljs/*.cljs": { + \ "alternate": "src/test/cljs/{}_test.cljs" + \ }, + \ "src/main/cljs/*_test.cljs": { + \ "alternate": "src/main/cljs/{}.cljs", + \ "dispatch": ":RunTests {dot|hyphenate}-test" + \ }, + \ "src/main/clj/*.cljc": { + \ "alternate": "src/test/clj/{}_test.cljc" + \ }, + \ "src/main/clj/*_test.cljc": { + \ "alternate": "src/test/clj/{}.cljc", + \ "dispatch": ":RunTests {dot|hyphenate}-test" + \ } + \ }} +" }}} + +" AutoPairs {{{ +let g:AutoPairsCenterLine = 0 +" }}} + +" Filetypes {{{ + +" Python {{{ +aug Python + au! + au FileType python set tabstop=4 shiftwidth=4 softtabstop=4 expandtab +aug END +let g:python_highlight_all=1 +" }}} + +" PHP {{{ +aug PHP + au! + "au FileType php setlocal fdm=marker fmr={{{,}}} +aug END " }}} + +" Mail {{{ +aug Mail + au FileType mail setlocal spell +aug END " }}} + +" Haskell {{{ +let g:haskell_conceal_wide = 1 +let g:haskellmode_completion_ghc = 0 +let g:necoghc_enable_detailed_browse = 1 + +augroup Haskell + autocmd! + autocmd FileType haskell setlocal textwidth=110 shiftwidth=2 + autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc + autocmd FileType haskell call HaskellSetup() + autocmd FileType haskell setlocal keywordprg=hoogle\ -cie +augroup END + +function! s:HaskellSetup() + set sw=4 + " compiler cabal + " let b:start='cabal run' + " let b:console='cabal repl' + " let b:dispatch='cabal test' + compiler stack + let b:start='stack run' + let b:console='stack ghci' + let b:dispatch='stack test' + nnoremap gy :HdevtoolsType + nnoremap yu :HdevtoolsClear +endfunction +" }}} + +" Ruby {{{ + +function! s:RSpecSyntax() + syn keyword rspecMethod describe context it its specify shared_context + \ shared_examples shared_examples_for shared_context include_examples + \ include_context it_should_behave_like it_behaves_like before after + \ around fixtures controller_name helper_name scenario feature + \ background given described_class + syn match rspecMethod '\!\=' + syn match rspecMethod '\!\=' + syn keyword rspecMethod violated pending expect expect_any_instance_of allow + \ allow_any_instance_of double instance_double mock mock_model + \ stub_model xit + syn match rspecMethod '\.\@!\@!' + + call s:RSpecHiDefaults() +endfunction + +function! s:RSpecHiDefaults() + hi def link rspecMethod rubyFunction +endfunction + +augroup Ruby + au! + " au FileType ruby let b:surround_114 = "\\(module|class,def,if,unless,case,while,until,begin,do) \r end" + " au FileType ruby set fdm=syntax + au FileType ruby set tw=110 + au FileType ruby set omnifunc= + au FileType ruby nnoremap gy orequire 'pry'; binding.pry^ + au FileType ruby nnoremap gY Orequire 'pry'; binding.pry^ + au FileType ruby nnoremap yu :g/require 'pry'; binding.pry/d + au BufNewFile,BufRead *_spec.rb call RSpecSyntax() +augroup END + +let ruby_operators = 1 +let ruby_space_errors = 1 + +let g:rubycomplete_rails = 1 +command! -range ConvertHashSyntax ,s/:(\S{-})(\s{-})=> /\1:\2/ +" }}} + +" Clojure {{{ + +aug Clojure + au! + autocmd FileType clojure nnoremap :Slamhound + autocmd FileType clojure nnoremap gr :w Require e + let g:clojure_align_multiline_strings = 1 + let g:clojure_fuzzy_indent_patterns = + \ ['^with', '^def', '^let', '^fact'] + let g:clojure_special_indent_words = + \ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn,html' + + autocmd FileType clojure setlocal textwidth=80 + autocmd FileType clojure setlocal lispwords+=GET,POST,PATCH,PUT,DELETE | + \ setlocal lispwords+=context,select + autocmd BufNewFile,BufReadPost *.cljx setfiletype clojure + autocmd BufNewFile,BufReadPost *.cljx setlocal omnifunc= + autocmd BufNewFile,BufReadPost *.cljs setlocal omnifunc= + autocmd FileType clojure call TangentInit() + autocmd FileType clojure call sexp_mappings() + autocmd BufRead *.cljc ClojureHighlightReferences + autocmd FileType clojure let b:AutoPairs = { + \ '"': '"', + \ '{': '}', + \ '(': ')', + \ '[': ']'} + " Don't auto-pair quote reader macros + " \'`': '`', + " \ '''': '''', + + autocmd User ProjectionistActivate call s:projectionist_connect() + + function! s:projectionist_connect() abort + let connected = !empty(fireplace#path()) + if !connected + for [root, value] in projectionist#query('connect') + try + silent execute "FireplaceConnect" value root + let connected = 1 + break + catch /.*Connection refused.*/ + endtry + endfor + endif + + " if connected && exists(':Piggieback') + " for [root, value] in projectionist#query('piggieback') + " silent execute "Piggieback" value + " break + " endfor + " endif + endfunction + + " autocmd BufNewFile,BufReadPost *.cljx setlocal omnifunc= + " autocmd BufNewFile,BufReadPost *.cljs setlocal omnifunc= + + autocmd FileType clojure let b:console='lein repl' + autocmd FileType clojure call ClojureMaps() + + function! s:ClojureMaps() abort + nnoremap [m :call search('^(def', 'Wzb') + nnoremap ]m :call search('^(def', 'Wz') + endfunction + + command! Scratch call OpenScratch() + autocmd FileType clojure nnoremap \s :Scratch + + let g:scratch_buffer_name = 'SCRATCH' + + function! s:OpenScratch() + if bufwinnr(g:scratch_buffer_name) > 0 + execute bufwinnr(g:scratch_buffer_name) . 'wincmd' 'w' + return + endif + + vsplit SCRATCH + set buftype=nofile + set filetype=clojure + let b:scratch = 1 + endfunction +aug END + +function! s:sexp_mappings() abort + if !exists('g:sexp_loaded') + return + endif + + nmap cfo (sexp_raise_list) + nmap cfO (sexp_raise_element) + nmap cfe (sexp_raise_element) +endfunction + +function! s:TangentInit() abort + set textwidth=80 + command! TReset call fireplace#session_eval('(user/reset)') + command! TGo call fireplace#session_eval('(user/go)') + command! TMigrate call fireplace#session_eval('(user/migrate)') + command! TRollback call fireplace#session_eval('(user/rollback)') + nnoremap g\ :TReset +endfunction + +" }}} + +" Go {{{ + +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_structs = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_build_constraints = 1 + +augroup Go + autocmd! + autocmd FileType go setlocal omnifunc=go#complete#Complete + autocmd FileType go setlocal foldmethod=syntax + autocmd FileType go setlocal foldlevel=100 + autocmd FileType go nnoremap :GoTest + autocmd FileType go inoremap :GoTesti +augroup END + +" }}} + +" RAML {{{ + +function! s:buffer_syntax() " {{{ + syn keyword ramlRAML RAML contained + syn match ramlVersionString '^#%RAML \d\.\d' contains=ramlRAML +endfunction " }}} + +augroup RAML + autocmd! + autocmd BufRead,BufNewFile *.raml set filetype=yaml + autocmd BufRead,BufNewFile *.raml call s:buffer_syntax() +augroup END + +hi def link ramlVersionString Special +hi def link ramlRAML Error +" }}} + +" Mustache/Handlebars {{{ +let g:mustache_abbreviations = 1 +" }}} + +" Netrw {{{ +augroup netrw + autocmd! + autocmd FileType netrw nnoremap Q :Rexplore + + " Hee hee, oil and vinegar + function! s:setup_oil() abort + nnoremap q + xnoremap q + endfunction +augroup END +" }}} +" }}} + +" Remove trailing whitespace {{{ +fun! StripTrailingWhitespaces() + let l = line(".") + let c = col(".") + %s/\s\+$//e + call cursor(l, c) +endfun + +augroup striptrailingwhitespaces " {{{ +autocmd FileType c,cpp,java,php,ruby,python,sql,javascript,sh,jst,less,haskell,haml,coffee,scss,clojure,objc,elixir,yaml,json,eruby + \ autocmd BufWritePre :call StripTrailingWhitespaces() +augroup END " }}} + +" }}} + +" Goyo {{{ +let g:limelight_conceal_ctermfg = "10" +let g:limelight_conceal_guifg = "#586e75" +autocmd! User GoyoEnter Limelight +autocmd! User GoyoLeave Limelight! +" }}} + +"----------------------------------------------------------------------------- + +" Commands {{{ + +" Edit temporary SQL files {{{ +let s:curr_sql = 0 +fun! EditSqlTempFile() + let l:fname = '/tmp/q' . s:curr_sql . '.sql' + execute 'edit' l:fname + let s:curr_sql = s:curr_sql + 1 +endfun +com! EditSqlTempFile call EditSqlTempFile() +" }}} + +" Double Indentation +command! -range DoubleIndentation ,s/^\(\s.\{-}\)\(\S\)/\1\1\2/ + +" Quick-and-dirty fix capitalization of sql files +command! -range FixSqlCapitalization ,v/\v(^\s*--.*$)|(TG_)/norm guu + +" VimPipe Commands {{{ +" let g:sql_type_default = 'pgsql' +command! SqlLive let b:vimpipe_command="vagrant ssh -c '~/mysql'" +command! SqlRails let b:vimpipe_command="bin/rails dbconsole" +command! SqlHeroku let b:vimpipe_command="heroku pg:psql" +command! SqlEntities let b:vimpipe_command="psql -h 127.1 entities nomi" +command! SqlUsers let b:vimpipe_command="psql -h 127.1 users nomi" +command! SqlTangent let b:vimpipe_command="psql -h local.docker tangent super" +" }}} + +" Git commands {{{ +command! -nargs=* Gpf Gpush -f +command! -nargs=* Gcv Gcommit --verbose +" }}} + +" Focus dispatch to only the last failures +command! -nargs=* FocusFailures FocusDispatch rspec --only-failures + +" }}} + +" Autocommands {{{ + +augroup fugitive " {{{ + au! + autocmd BufNewFile,BufRead fugitive://* set bufhidden=delete +augroup END " }}} + +augroup omni " {{{ + au! + " autocmd FileType javascript setlocal omnifunc=tern#Complete + "autocmd FileType python setlocal omnifunc=pythoncomplete#Complete + autocmd FileType php setlocal omnifunc= +augroup END " }}} + +augroup sql " {{{ + au! + autocmd FileType sql let b:vimpipe_command="psql -h 127.0.0.1 landlordsny_development landlordsny" + autocmd FileType sql let b:vimpipe_filetype="postgresql" + autocmd FileType sql set syntax=postgresql + autocmd FileType postgresql set nowrap + autocmd BufNewFile,BufReadPost *.sql set syntax=pgsql +augroup END " }}} + +augroup markdown " {{{ + au! + autocmd FileType markdown let b:vimpipe_command='markdown' + autocmd FileType markdown let b:vimpipe_filetype='html' + autocmd FileType markdown set tw=80 +augroup END " }}} + +augroup typescript " {{{ + au! + autocmd FileType typescript let b:vimpipe_command='tsc' + autocmd FileType typescript let b:vimpipe_filetype='javascript' + autocmd FileType typescript TSSstarthere + autocmd FileType typescript nnoremap gd :TSSdef +augroup END " }}} + +augroup jsx " {{{ + au! + " autocmd FileType jsx set syntax=javascript + autocmd FileType javascript set filetype=javascript.jsx +augroup END " }}} + +augroup nicefoldmethod " {{{ + au! + " Don't screw up folds when inserting text that might affect them, until + " leaving insert mode. Foldmethod is local to the window. Protect against + " screwing up folding when switching between windows. + autocmd InsertEnter * + \ if !exists('w:last_fdm') | + \ let w:last_fdm=&foldmethod | + \ setlocal foldmethod=manual | + \ endif + autocmd InsertLeave,WinLeave * + \ if exists('w:last_fdm') | + \ let &l:foldmethod=w:last_fdm | + \ unlet w:last_fdm | + \ endif +augroup END " }}} + +augroup visualbell " {{{ + au! + autocmd GUIEnter * set visualbell t_vb= +augroup END +" }}} + +augroup quickfix " {{{ + au! + autocmd QuickFixCmdPost grep cwindow +augroup END " }}} + +augroup php " {{{ + au! +augroup END "}}} + +augroup rubylang " {{{ + au! + autocmd FileType ruby compiler rake +augroup END " }}} + +augroup javascript "{{{ + au! + autocmd FileType javascript let &errorformat = + \ '%E%.%#%n) %s:,' . + \ '%C%.%#Error: %m,' . + \ '%C%.%#at %s (%f:%l:%c),' . + \ '%Z%.%#at %s (%f:%l:%c),' . + \ '%-G%.%#,' +augroup END " }}} + +augroup git " {{{ + autocmd! + autocmd FileType gitcommit set textwidth=72 +augroup END +" }}} +" }}} + +" Leader commands {{{ + +" Edit specific files {{{ +nnoremap ev :split $MYVIMRC +nnoremap eb :split ~/.vim_bundles +nnoremap es :UltiSnipsEdit +nnoremap ea :split ~/.vim/after/plugin/abolish.vim + +nnoremap sv :so $MYVIMRC +nnoremap sb :so ~/.vim_bundles +nnoremap sa :so ~/.vim/after/plugin/abolish.vim + +nnoremap el :EditSqlTempFile +" }}} + +" Toggle navigation panels {{{ +nnoremap l :TagbarToggle +nnoremap mb :MBEToggle +nnoremap u :GundoToggle + +nnoremap t :CtrlP +nnoremap z :FZF +nnoremap b :CtrlPBuffer +nnoremap a :CtrlPTag +nnoremap r :CtrlPGitBranch +" }}} + +" CtrlP {{{ +let g:ctrlp_custom_ignore = { + \ 'dir': 'node_modules', + \ } +" }}} + +" Git leader commands {{{ +noremap g :Git +noremap gu :Gpull +noremap gp :Gpush +noremap s :Gstatus +noremap cv :Gcommit --verbose +noremap ca :Gcommit --verbose --amend + +nnoremap dl :diffg LOCAL +nnoremap dr :diffg REMOTE +nnoremap db :diffg BASE +nnoremap du :diffu +nnoremap dg :diffg + +nnoremap d2 :diffg //2:diffu +nnoremap d3 :diffg //3:diffu + +nnoremap yt :SignifyToggle +" }}} + +" Breakpoint Leader Commands {{{ +nnoremap x :Breakpoint +nnoremap dx :BreakpointRemove * +" }}} + +" Tabularize {{{ + " Leader Commands {{{ + nnoremap t= :Tabularize /= + vmap t= :Tabularize /= + + nnoremap t> :Tabularize /=> + vmap t> :Tabularize /=> + " }}} + + " => Aligning {{{ + function! s:rocketalign() + let l:p = '^.*=>\s.*$' + echo l:p + if exists(':Tabularize') && getline('.') =~# '^.*=' && + \ (getline(line('.')-1) =~# l:p || getline(line('.')+1) =~# l:p) + let column = strlen(substitute(getline('.')[0:col('.')],'[^=>]','','g')) + let position = strlen(matchstr(getline('.')[0:col('.')],'.*=>\s*\zs.*')) + Tabularize/=>/l1 + normal! $ + call search(repeat('[^=>]*=>',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) + endif + endfunction + "inoremap => =>:call rocketalign()a + " }}} + + " = Aligning {{{ + function! s:eqalign() + let l:p = '^.*=\s.*$' + if exists(':Tabularize') && getline('.') =~# '^.*=' && + \ (getline(line('.')-1) =~# l:p || getline(line('.')+1) =~# l:p) + let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g')) + let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*')) + Tabularize/=/l1 + normal! $ + call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) + endif + endfunction + "inoremap = =:call eqalign()a + " }}} + + " : Aligning {{{ + function! s:colonalign() + let l:p : '^.*:\s.*$' + if exists(':Tabularize') && getline('.') :~# '^.*:' && + \ (getline(line('.')-1) :~# l:p || getline(line('.')+1) :~# l:p) + let column : strlen(substitute(getline('.')[0:col('.')],'[^:]','','g')) + let position : strlen(matchstr(getline('.')[0:col('.')],'.*:\s*\zs.*')) + Tabularize/:/l1 + normal! $ + call search(repeat('[^:]*:',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) + endif + endfunction + "inoremap : ::call colonalign()a + " }}} +" }}} + +" }}} + +" Mappings {{{ +" 'delete current' +nnoremap dc 0d$ +nnoremap com :silent !tmux set status +nnoremap :Make +nnoremap g :Dispatch +nnoremap g\ :Start +inoremap :Makei + +" Navigate buffers {{{ +nnoremap gb :bn +nnoremap gB :bp +" }}} + +" Window Navigation {{{ +nnoremap w +nnoremap h h +nnoremap j j +nnoremap k k +nnoremap l l +nnoremap z z +" }}} + + +" Sort with motion {{{ +if !exists("g:sort_motion_flags") + let g:sort_motion_flags = "" +endif +function! s:sort_motion(mode) abort + if a:mode == 'line' + execute "'[,']sort " . g:sort_motion_flags + elseif a:mode == 'char' + execute "normal! `[v`]y" + let sorted = join(sort(split(@@, ', ')), ', ') + execute "normal! v`]c" . sorted + elseif a:mode == 'V' || a:mode == '' + execute "'<,'>sort " . g:sort_motion_flags + endif +endfunction + +function! s:sort_lines() + let beginning = line('.') + let end = v:count + beginning - 1 + execute beginning . ',' . end . 'sort' +endfunction + +xnoremap SortMotionVisual :call sort_motion(visualmode()) +nnoremap SortMotion :set opfunc=sort_motiong@ +nnoremap SortLines :call sort_lines() + +map go SortMotion +vmap go SortMotionVisual +map goo SortLines +" }}} +" }}} + +let g:hare_executable = 'cabal exec -- ghc-hare' diff --git a/home/modules/zshrc b/home/modules/zshrc new file mode 100644 index 000000000000..95c1733e13a5 --- /dev/null +++ b/home/modules/zshrc @@ -0,0 +1,371 @@ +#!/usr/bin/zsh +# vim: set fdm=marker fmr={{{,}}}: + +stty -ixon + +# Compinstall {{{ +zstyle ':completion:*' completer _complete _ignored _correct _approximate +zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._- :]=** r:|=**' 'l:|=* r:|=*' +zstyle ':completion:*' max-errors 5 +zstyle ':completion:*' use-cache yes +zstyle ':completion::complete:grunt::options:' expire 1 +zstyle ':completion:*' prompt '%e errors' +zstyle :compinstall filename '~/.zshrc' +autoload -Uz compinit +compinit +# }}} + +# Zsh-newuser-install {{{ +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt appendhistory autocd extendedglob notify autopushd +unsetopt beep nomatch +bindkey -v +# }}} + +# Basic options {{{ +set -o vi +umask 022 +export VIRTUAL_ENV_DISABLE_PROMPT=1 +# export PATH=~/.local/bin:~/.cabal/bin:$PATH:~/code/go/bin:~/bin:~/npm/bin:~/.gem/ruby/2.1.0/bin:~/.gem/ruby/2.0.0/bin:/home/smith/bin +# }}} + +# Zsh highlight highlighters {{{ +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern root) +# }}} + +# More basic options {{{ +setopt no_hist_verify +setopt histignorespace +# }}} + +# Utility Functions {{{ + +# Set the terminal's title bar. +function titlebar() { +echo -ne "\033]0;$*\007" +} + +function quiet() { +"$@" >/dev/null +} + +function quieter() { +"$@" >/dev/null 2>&1 +} + +# From http://stackoverflow.com/questions/370047/#370255 +function path_remove() { +IFS=: +# convert it to an array +t=($PATH) +unset IFS +# perform any array operations to remove elements from the array +t=(${t[@]%%$1}) +IFS=: +# output the new array +echo "${t[*]}" +} + +# }}} + +# Force screen to use zsh {{{ +# }}} + +# Environment {{{ +export EDITOR="/usr/bin/vim" +# }}} + +# Directory Stuff {{{ + +# Always use color output for `ls` +if [[ "$OSTYPE" =~ ^darwin ]]; then +else + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' +fi + +# Directory listing + +# Easier navigation: .., ..., - + +# File size + +# Recursively delete `.DS_Store` files + +# Create a new directory and enter it +function md() { + mkdir -p "$@" && cd "$@" +} + +# }}} + +# MPD/MPC stuff {{{ +function mp() { +# Test if drive is already mounted +if ! lsblk | grep /media/external >/dev/null; then + if ! sudo mount /media/external; then + echo "External drive not plugged in, or could not mount" + return 1 + fi +fi +if (mpc >/dev/null 2>&1); then + ncmpcpp +else + mpd && + (pgrep mpdscribble || mpdscribble) && + ncmpcpp +fi +} + +# kill mp +function kmp() { +killall ncmpcpp +mpd --kill + +local files + +if (files=$(lsof 2>&1 | grep -v docker | grep external)); then + echo + echo "==> Still processes using external drive:" + echo + echo $files +else + sudo umount /media/external +fi +} + + +function mppal() { +mpc search album "$1" | mpc add && + mpc play; +} +# }}} + +# Git stuff {{{ +# function ga() { git add "${@:-.}"; } # Add all files by default +# Add non-whitespace changes +# function gc() { git checkout "${@:-master}"; } # Checkout master by default + +# open all changed files (that still actually exist) in the editor +function ged() { +local files=() +for f in $(git diff --name-only "$@"); do + [[ -e "$f" ]] && files=("${files[@]}" "$f") +done +local n=${#files[@]} +echo "Opening $n $([[ "$@" ]] || echo "modified ")file$([[ $n != 1 ]] && \ + echo s)${@:+ modified in }$@" +q "${files[@]}" +} + +# git find-replace +function gfr() { +if [[ "$#" == "0" ]]; then + echo 'Usage:' + echo ' gg_replace term replacement file_mask' + echo + echo 'Example:' + echo ' gg_replace cappuchino cappuccino *.html' + echo +else + find=$1; shift + replace=$1; shift + + ORIG_GLOBIGNORE=$GLOBIGNORE + GLOBIGNORE=*.* + if [[ "$#" = "0" ]]; then + set -- ' ' $@ + fi + + while [[ "$#" -gt "0" ]]; do + for file in `git grep -l $find -- $1`; do + sed -e "s/$find/$replace/g" -i'' $file + done + shift + done + + GLOBIGNORE=$ORIG_GLOBIGNORE +fi +} + +function vconflicts() { +$EDITOR $(git status --porcelain | awk '/^UU/ { print $2 }') +} + +function fetchall() { +for repo in ~/code/nomi/gems/* ~/code/nomi/services/svc-users ~/code/nomi/services/svc-entities ~/code/go/src/github.com/getnomi/svc-gateway; do + echo -e "\x1b[34;1m=======> \x1b[37;1m$repo\x1b[0m" + git -C $repo fetch +done +} +# }}} + +# Wifi {{{ +# }}} + +# adb {{{ +export GNEX_IP='192.168.3.30' +# }}} + +# Golang {{{ +export GOPATH="/home/griffin/code/go" +# }}} + +# Tail logs {{{ +# }}} + +# Running stuff {{{ +# }}} + +# Directories {{{ + + + +export NODE_ENV='development' +# }}} + +# SSH shortcuts {{{ +# }}} + +# Editing config files {{{ +# }}} + +# XRandR {{{ +# }}} + +# fzf {{{ +v() { + local file + file=$(fzf-tmux --query="$1" --select-1 --exit-0) + [ -n "$file" ] && ${EDITOR:-vim} "$file" +} + +c() { + local dir + dir=$(find ${1:-*} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) && cd "$dir" +} + +co() { + local branch + branch=$(git branch -a | sed -s "s/\s*\**//g" | fzf --query="$1" --select-1 --exit-0) && git checkout "$branch" +} + + +# fh - repeat history +# h() { +# eval $(([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s | sed 's/ *[0-9]* *//') +# } + +# fkill - kill process +fkill() { + ps -ef | sed 1d | fzf-tmux -m | awk '{print $2}' | xargs kill -${1:-9} +} +# }}} + +# Tmux utils {{{ +kill_detached() { + for sess in $(tmux ls | grep -v attached | sed -s "s/:.*$//"); do + tmux kill-session -t $sess; + done +} +# }}} + +# Docker {{{ + + +# dbp foo/bar . +function dbp () { + docker build -t $1 ${@:2} && docker push $1 +} + +# }}} + +# Vagrant {{{ +# }}} + +# Twitter! {{{ +export TWITTER_WHOAMI='glittershark1' + + +# favelast +function favelast() { + t fave $(t tl -l $1 | head -n1 | first) +} + +function rtlast() { + t rt $(t tl -l $1 | head -n1 | first) +} + +function tthread() { + t reply $(t tl -l $TWITTER_WHOAMI | head -n1 | first) $@ +} +# }}} + +# Geeknote {{{ +gnc() { + gn create --title $1 --content '' && + gn find --count=1 "$1" + gn edit 1 +} +# }}} + +# Systemd aliases {{{ +# }}} + +# Misc aliases {{{ + +function fw() { # fix white + local substitution + local substitution='s/\x1b\[90m/\x1b[92m/g' + $@ > >(perl -pe "$substitution") 2> >(perl -pe "$substitution" 1>&2) +} +# }}} + +# Grep options {{{ +unset GREP_OPTIONS +export GREP_OPTIONS= +# }}} + +# Keyboard backlight {{{ + +KEYBOARD_BRIGHTNESS_FILE='/sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness' + +setkbd() { + echo $1 | sudo tee $KEYBOARD_BRIGHTNESS_FILE +} + +kbdup() { + curr=$(< $KEYBOARD_BRIGHTNESS_FILE) + echo $(( $curr + 15 )) | sudo tee $KEYBOARD_BRIGHTNESS_FILE +} + +kbdup() { + curr=$(< $KEYBOARD_BRIGHTNESS_FILE) + echo $(( $curr - 15 )) | sudo tee $KEYBOARD_BRIGHTNESS_FILE +} + +# }}} + +# Run docker containers {{{ + # -d \ + # -v $HOME/.pentadactyl:/home/firefox/.pentadactyl:rw \ + # -v $HOME/.pentadactylrc:/home/firefox/.pentadactylrc:rw \ + # -v $HOME/.mozilla:/home/firefox/.mozilla:rw \ + # -v $HOME/.config:/home/firefox/.config \ + # -v $HOME/Downloads:/home/firefox/Downloads:rw \ + # -v /etc/fonts:/etc/fonts \ + # -v /tmp/.X11-unix:/tmp/.X11-unix \ + # -v /dev/snd:/dev/snd \ + # --net=host \ + # -v $XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR \ + # -e uid=$(id -u) \ + # -e gid=$(id -g) \ + # -e DISPLAY=$DISPLAY \ + # -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ + # --name firefox \ + # --rm -it \ + # glittershark/firefox +# }}} + +[ -f ./.localrc ] && source ./.localrc diff --git a/install b/install new file mode 100755 index 000000000000..bad60db0202c --- /dev/null +++ b/install @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -eo pipefail + +if [[ -f /etc/nixos/.system-installed ]]; then + echo "=== System config already installed, skipping" +else + echo "==> Installing system config" + + [[ -d /etc/nixos ]] && sudo mv /etc/nixos{,.bak} + sudo mkdir -p /etc/nixos + sudo cp /etc/nixos.bak/hardware-configuration.nix /etc/nixos + + sudo cp ./configuration.nix /etc/nixos/ + sudo ln -s $(pwd)/{machines,modules,pkgs} /etc/nixos + sudo touch /etc/nixos/.system-installed + + nixos-rebuild switch + echo "==> System config installed, your old configuration is at /etc/nixos.bak" +fi +echo + +if [[ -f ~/.config/nixpkgs/system-installed ]]; then + echo "=== home-anager config already installed, skipping" +else + echo "==> Installing home-manager config" + nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager + nix-channel --update + nix-shell '' -A install + + [[ -d ~/.config/nixpkgs ]] && mv ~/.config/{nixpkgs,nixpkgs.bak} + mkdir -p ~/.config/nixpkgs + ln -s home/* ~/.config/nixpkgs + + home-manager switch + + echo "==> home-manager config installed" +fi diff --git a/pkgs/alsi/default.nix b/pkgs/alsi/default.nix new file mode 100644 index 000000000000..d4da8ff38ef7 --- /dev/null +++ b/pkgs/alsi/default.nix @@ -0,0 +1,22 @@ +{ perl, stdenv, fetchFromGitHub }: +stdenv.mkDerivation { + name = "alsi"; + pname = "alsi"; + version = "0.4.8"; + + src = fetchFromGitHub { + owner = "trizen"; + repo = "alsi"; + rev = "fe2a925caad38d4cc7afe10d74ba60c5db09ee66"; + sha256 = "060xlalfclrda5f1h3svj4v2gr19mdrsc62vrg7hgii0f3lib7j5"; + }; + + buildInputs = [ + (perl.withPackages (ps: with ps; [ DataDump ])) + ]; + + installPhase = '' + mkdir -p $out/bin + cp alsi $out/bin/alsi + ''; +} diff --git a/system/configuration.nix b/system/configuration.nix new file mode 100644 index 000000000000..eae567015b73 --- /dev/null +++ b/system/configuration.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +let machine = throw "Pick a machine from ./machines"; in +{ + imports = + [ + /etc/nixos/hardware-configuration.nix + ./modules/common.nix + machine + ]; +} diff --git a/system/machines/bumblebee.nix b/system/machines/bumblebee.nix new file mode 100644 index 000000000000..a1cd3ffa143d --- /dev/null +++ b/system/machines/bumblebee.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ../modules/reusable/battery.nix + ]; + + networking.hostName = "bumblebee"; + + powerManagement = { + enable = true; + cpuFreqGovernor = "powersave"; + powertop.enable = true; + }; + + # Hibernate on low battery + laptop.onLowBattery = { + enable = true; + action = "hibernate"; + thresholdPercentage = 5; + }; +} diff --git a/system/modules/common.nix b/system/modules/common.nix new file mode 100644 index 000000000000..27f4a73f09e9 --- /dev/null +++ b/system/modules/common.nix @@ -0,0 +1,106 @@ +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./xserver.nix + ./emacs.nix + ./sound.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "bumblebee"; + networking.useDHCP = false; + networking.networkmanager.enable = true; + + # Select internationalisation properties. + # i18n = { + # consoleFont = "Lat2-Terminus16"; + # consoleKeyMap = "us"; + # defaultLocale = "en_US.UTF-8"; + # }; + + # Set your time zone. + time.timeZone = "America/New_York"; + + environment.systemPackages = with pkgs; [ + wget + vim + zsh + git + w3m + libnotify + file + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # pinentryFlavor = "gnome3"; + # }; + + programs.nm-applet.enable = true; + + + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + users.mutableUsers = true; + programs.zsh.enable = true; + environment.pathsToLink = [ "/share/zsh" ]; + users.users.grfn = { + isNormalUser = true; + initialPassword = "password"; + extraGroups = [ + "wheel" # Enable ‘sudo’ for the user. + "networkmanager" + "audio" + ]; + shell = pkgs.zsh; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "20.03"; # Did you read the comment? + + nixpkgs.config.allowUnfree = true; + + fonts.fonts = with pkgs; [ + nerdfonts + ]; + + services.geoclue2.enable = true; + + powerManagement = { + enable = true; + cpuFreqGovernor = "powersave"; + powertop.enable = true; + }; + # Hibernate on low battery + laptop.onLowBattery = { + enable = true; + action = "hibernate"; + thresholdPercentage = 5; + }; + + nix = { + autoOptimiseStore = true; + }; +} diff --git a/system/modules/emacs.nix b/system/modules/emacs.nix new file mode 100644 index 000000000000..1cfa2b07452c --- /dev/null +++ b/system/modules/emacs.nix @@ -0,0 +1,23 @@ +{ config, pkgs, lib, ... }: +with lib; +{ + options.programs.emacs.useGit = mkOption { + description = "Use emacs from git"; + type = types.bool; + default = false; + }; + + config = { + nixpkgs.overlays = if config.programs.emacs.useGit then [] else [ + (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)) + ]; + + environment.systemPackages = with pkgs; [ + (if config.programs.emacs.useGit then emacsGit else emacs) + ripgrep + coreutils + fd + clang + ]; + }; +} diff --git a/system/modules/reusable/README.org b/system/modules/reusable/README.org new file mode 100644 index 000000000000..34d9bfdcb729 --- /dev/null +++ b/system/modules/reusable/README.org @@ -0,0 +1,2 @@ +This directory contains things I'm eventually planning on contributing upstream +to nixpkgs diff --git a/system/modules/reusable/battery.nix b/system/modules/reusable/battery.nix new file mode 100644 index 000000000000..d7043bf54979 --- /dev/null +++ b/system/modules/reusable/battery.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: +with lib; +{ + options = { + laptop.onLowBattery = { + enable = mkEnableOption "Perform action on low battery"; + + thresholdPercentage = mkOption { + description = "Threshold battery percentage on which to perform the action"; + default = 5; + type = types.int; + }; + + action = mkOption { + description = "Action to perform on low battery"; + default = "hibernate"; + type = types.enum [ "hibernate" "suspend" "suspend-then-hibernate" ]; + }; + }; + }; + + 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}"'' + ]; + }; +} diff --git a/system/modules/sound.nix b/system/modules/sound.nix new file mode 100644 index 000000000000..0d5ce3e318c3 --- /dev/null +++ b/system/modules/sound.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: +{ + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + nixpkgs.config.pulseaudio = true; + + environment.systemPackages = with pkgs; [ + pulseaudio-ctl + paprefs + pasystray + pavucontrol + ]; +} diff --git a/system/modules/xserver.nix b/system/modules/xserver.nix new file mode 100644 index 000000000000..52f04e2e6a69 --- /dev/null +++ b/system/modules/xserver.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: +{ + # Enable the X11 windowing system. + services.xserver = { + enable = true; + layout = "us"; + xkbOptions = "caps:swapescape"; + + libinput.enable = true; + + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + i3status + i3lock + ]; + }; + }; +} -- cgit 1.4.1 From 678c6b05d32dfc0ff470b886804f4f59a0abd7e6 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:47:02 -0400 Subject: Begin breaking environment variables into shell.nix --- home/modules/shell.nix | 7 +++++++ home/modules/zshrc | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 51dc0e3670e3..e37272cd4ecc 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -5,6 +5,13 @@ autojump ]; + home.sessionVariables = { + EDITOR = "vim"; + LS_COLORS = "no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:"; + TWITTER_WHOAMI = "glittershark1"; + BROWSER = "firefox"; + }; + programs.zsh = { enable = true; enableAutosuggestions = true; diff --git a/home/modules/zshrc b/home/modules/zshrc index 95c1733e13a5..73ceec48e631 100644 --- a/home/modules/zshrc +++ b/home/modules/zshrc @@ -74,16 +74,11 @@ echo "${t[*]}" # }}} # Environment {{{ -export EDITOR="/usr/bin/vim" # }}} # Directory Stuff {{{ # Always use color output for `ls` -if [[ "$OSTYPE" =~ ^darwin ]]; then -else - export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' -fi # Directory listing @@ -205,11 +200,9 @@ done # }}} # adb {{{ -export GNEX_IP='192.168.3.30' # }}} # Golang {{{ -export GOPATH="/home/griffin/code/go" # }}} # Tail logs {{{ @@ -222,7 +215,6 @@ export GOPATH="/home/griffin/code/go" -export NODE_ENV='development' # }}} # SSH shortcuts {{{ @@ -285,7 +277,6 @@ function dbp () { # }}} # Twitter! {{{ -export TWITTER_WHOAMI='glittershark1' # favelast @@ -368,4 +359,14 @@ kbdup() { # glittershark/firefox # }}} +# Alembic {{{ +function aup() { + alembic upgrade ${1:-head} +} + +function adown() { + alembic downgrade ${1:--1} +} +# }}} + [ -f ./.localrc ] && source ./.localrc -- cgit 1.4.1 From 0fcb6d0ca3f8e37b72c55c8f20bfd85c3ebcb47d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:47:58 -0400 Subject: Impurely clone .doom.d Rather than having it there immutably. Makes it easier to hack on. --- home/modules/emacs.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index 05b09ec2c5d8..0487a2ef650a 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -21,7 +21,6 @@ in { ]; programs.emacs.enable = true; - home.file.".doom.d".source = ./doom.d; impure.clonedRepos = { orgClubhouse = { @@ -30,11 +29,17 @@ in { }; doomEmacs = { - github = "hlissner/org-clubhouse"; + github = "hlissner/doom-emacs"; path = ".emacs.d"; - after = ["orgClubhouse"]; + after = ["emacs.d"]; onClone = "bin/doom install"; }; + + "emacs.d" = { + github = "glittershark/emacs.d"; + path = ".doom.d"; + after = ["orgClubhouse"]; + }; }; # Notes -- cgit 1.4.1 From 59f6680d85de19e3c518614f4cce35a82c85a758 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:48:19 -0400 Subject: i3 config for chupacabra --- home/modules/i3.nix | 483 +++++++++++++++++++++++++++++----------------------- 1 file changed, 272 insertions(+), 211 deletions(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index e4820b5280b4..ebe87e8bac1b 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -2,232 +2,293 @@ let mod = "Mod4"; solarized = import ../common/solarized.nix; - decorationFont = "MesloLGSDZ 6"; + # TODO pull this out into lib + emacsclient = eval: pkgs.writeShellScript "emacsclient-eval" '' + msg=$(emacsclient --eval '${eval}' 2>&1) + echo "''${msg:1:-1}" + ''; in { - home.packages = with pkgs; [ - maim - rofi - i3status - python38Packages.py3status - ]; - - xsession.scriptPath = ".hm-xsession"; - xsession.windowManager.i3 = { - enable = true; - config = { - modifier = mod; - keybindings = lib.mkOptionDefault { - "${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+x" = "kill"; - - "${mod}+Return" = "exec alacritty"; - - "${mod}+Shift+s" = "split h"; - "${mod}+Shift+v" = "split v"; - - "${mod}+f" = "fullscreen"; - - "${mod}+Shift+r" = "exec home-manager switch"; - - "${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: ' ''; - - # Screenshots - "${mod}+q" = "exec maim"; - "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; - - # Launching applications - "${mod}+u" = - let rofi = pkgs.writeShellScript "rofi" '' - rofi \ - -modi 'combi' \ - -combi-modi "window,drun,ssh,run" \ - -font 'MesloLGSDZ 10' \ - -show combi - ''; - in "exec ${rofi}"; - - # Media - "XF86AudioPlay" = "exec playerctl play-pause"; - "XF86AudioNext" = "exec playerctl next"; - "XF86AudioPrevious" = "exec playerctl previous"; - "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; - "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; - "XF86AudioMute" = "exec pulseaudio-ctl mute"; - - # Screen Layout - "${mod}+Shift+t" = "exec xrandr --auto"; - # TODO - # $mod+t exec /home/griffin/.screenlayout/work.sh - # $mod+Ctrl+t exec /home/griffin/bin/fix_screen.sh - }; + options = with lib; { + system.machine.wirelessInterface = mkOption { + description = '' + Name of the primary wireless interface. Used by i3status, etc. + ''; + default = "wlp3s0"; + type = types.str; + }; - fonts = [ decorationFont ]; + system.machine.i3FontSize = mkOption { + description = "Font size to use in i3 window decorations etc."; + default = 6; + type = types.int; + }; + }; - colors = with solarized; rec { - focused = { - border = base01; - background = base01; - text = base3; - indicator = red; - childBorder = base02; - }; - focusedInactive = focused // { - border = base03; - background = base03; - # text = base1; - }; - unfocused = focusedInactive; - background = base03; - }; + config = + let decorationFont = "MesloLGSDZ ${toString config.system.machine.i3FontSize}"; in + { + home.packages = with pkgs; [ + maim + rofi + i3status + python38Packages.py3status + i3lock + dconf # for gtk + ]; + + xsession.scriptPath = ".hm-xsession"; + xsession.windowManager.i3 = { + enable = true; + config = { + modifier = mod; + keybindings = lib.mkOptionDefault 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+x" = "kill"; + + "${mod}+Return" = "exec alacritty"; + + "${mod}+Shift+s" = "split h"; + "${mod}+Shift+v" = "split v"; + + "${mod}+f" = "fullscreen"; + + "${mod}+Shift+r" = "exec home-manager switch"; + + "${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: ' ''; + + # Screenshots + "${mod}+q" = "exec maim"; + "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; + + # Launching applications + "${mod}+u" = + let rofi = pkgs.writeShellScript "rofi" '' + rofi \ + -modi 'combi' \ + -combi-modi "window,drun,ssh,run" \ + -font 'MesloLGSDZ 10' \ + -show combi + ''; + in "exec ${rofi}"; + + # Media + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrevious" = "exec playerctl previous"; + "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; + "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; + "XF86AudioMute" = "exec pulseaudio-ctl mute"; + + # Lock + Pause = "exec \"sh -c 'playerctl pause; ${pkgs.i3lock}/bin/i3lock -c 222222'\""; + F7 = Pause; + + # Screen Layout + "${mod}+Shift+t" = "exec xrandr --auto"; + # TODO + # $mod+t exec /home/griffin/.screenlayout/work.sh + # $mod+Ctrl+t exec /home/griffin/bin/fix_screen.sh + }; - modes.resize = { - l = "resize shrink width 5 px or 5 ppt"; - k = "resize grow height 5 px or 5 ppt"; - j = "resize shrink height 5 px or 5 ppt"; - h = "resize grow width 5 px or 5 ppt"; + fonts = [ decorationFont ]; + + colors = with solarized; rec { + focused = { + border = base01; + background = base01; + text = base3; + indicator = red; + childBorder = base02; + }; + focusedInactive = focused // { + border = base03; + background = base03; + # text = base1; + }; + unfocused = focusedInactive; + background = base03; + }; - Return = "mode \"default\""; - }; + modes.resize = { + l = "resize shrink width 5 px or 5 ppt"; + k = "resize grow height 5 px or 5 ppt"; + j = "resize shrink height 5 px or 5 ppt"; + h = "resize grow width 5 px or 5 ppt"; - bars = [{ - statusCommand = - let i3status-conf = pkgs.writeText "i3status.conf" '' - general { - output_format = i3bar - colors = true - color_good = "#859900" - - interval = 1 - } - - order += "mpd" - order += "wireless wlp3s0" - order += "ethernet enp3s0f0" - order += "cpu_usage" - order += "battery 0" - # order += "volume master" - order += "time" - - mpd { - format = "%artist - %album - %title" - } - - wireless wlp3s0 { - 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 " - } - - # volume master { - # format = "☊ %volume" - # format_muted = "☊ X" - # device = "default" - # mixer_idx = 0 - # } - ''; - in "py3status -c ${i3status-conf}"; - fonts = [ decorationFont ]; - position = "top"; - colors = with solarized; rec { - background = base03; - statusline = base3; - separator = base1; - activeWorkspace = { - border = base03; - background = base1; - text = base3; - }; - focusedWorkspace = activeWorkspace; - inactiveWorkspace = activeWorkspace // { - background = base01; - }; - urgentWorkspace = activeWorkspace // { - background = red; + Return = "mode \"default\""; }; - }; - }]; - }; - }; - services.dunst = { - enable = true; - settings = with solarized; { - global = { - font = "Meslo 6"; - allow_markup = true; - format = "%s\n%b"; - sort = true; - alignment = "left"; - geometry = "600x5-30+20"; - idle_threshold = 120; - separator_color = "frame"; + 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 += "wireless ${config.system.machine.wirelessInterface}" + # order += "ethernet enp3s0f0" + order += "cpu_usage" + order += "battery 0" + # order += "volume master" + order += "time" + + mpd { + format = "%artist - %album - %title" + } + + wireless wlp3s0 { + 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" + } + + + # volume master { + # format = "☊ %volume" + # format_muted = "☊ X" + # device = "default" + # mixer_idx = 0 + # } + ''; + in "py3status -c ${i3status-conf}"; + fonts = [ decorationFont ]; + position = "top"; + colors = with solarized; rec { + background = base03; + statusline = base3; + separator = base1; + activeWorkspace = { + border = base03; + background = base1; + text = base3; + }; + focusedWorkspace = activeWorkspace; + inactiveWorkspace = activeWorkspace // { + background = base01; + }; + urgentWorkspace = activeWorkspace // { + background = red; + }; + }; + }]; + }; }; - frame = { - width = 0; - color = "#aaaaaa"; - }; + services.dunst = { + enable = true; + settings = with solarized; { + global = { + font = "Meslo 10"; + allow_markup = true; + format = "%s\n%b"; + sort = true; + alignment = "left"; + geometry = "600x15-30+20"; + idle_threshold = 120; + separator_color = "frame"; + }; - shortcuts = { - close = "ctrl+space"; - close_all = "ctrl+shift+space"; - history = "ctrl+grave"; - context = "ctrl+shift+period"; - }; + frame = { + width = 0; + color = "#aaaaaa"; + }; - urgency_low = { - background = base03; - foreground = base3; - timeout = 5; - }; + shortcuts = { + close = "ctrl+space"; + close_all = "ctrl+shift+space"; + history = "ctrl+grave"; + context = "ctrl+shift+period"; + }; - urgency_normal = { - background = base02; - foreground = base3; - timeout = 7; + urgency_low = { + background = base03; + foreground = base3; + timeout = 5; + }; + + urgency_normal = { + background = base02; + foreground = base3; + timeout = 7; + }; + + urgency_critical = { + background = red; + foreground = base3; + timeout = 0; + }; + }; }; - urgency_critical = { - background = red; - foreground = base3; - timeout = 0; + gtk = { + enable = true; + iconTheme.name = "Adwaita"; + theme.name = "Adwaita"; }; - }; }; } -- cgit 1.4.1 From 83ba2c63653e1ef74cccc4888fe0b9f79987e614 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:48:31 -0400 Subject: extra args to cloneRepo script --- home/modules/lib/cloneRepo.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/modules/lib/cloneRepo.nix b/home/modules/lib/cloneRepo.nix index 50f6ca2d3d01..3f39ad57bd4c 100644 --- a/home/modules/lib/cloneRepo.nix +++ b/home/modules/lib/cloneRepo.nix @@ -50,7 +50,7 @@ with lib; home.activation = mapAttrs (_: { - url, path, github, onClone, after + url, path, github, onClone, after, ... }: let repoURL = if isNull url then "git@github.com:${github}" else url; in hm.dag.entryAfter (["writeBoundary"] ++ after) '' -- cgit 1.4.1 From a303e5c14d8ca768cba72fb1052d614508228415 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:48:42 -0400 Subject: Don't actually do anything on install, just symlink The commands should be run manually --- install | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/install b/install index bad60db0202c..a9a45953da07 100755 --- a/install +++ b/install @@ -11,28 +11,25 @@ else sudo mkdir -p /etc/nixos sudo cp /etc/nixos.bak/hardware-configuration.nix /etc/nixos - sudo cp ./configuration.nix /etc/nixos/ - sudo ln -s $(pwd)/{machines,modules,pkgs} /etc/nixos + sudo cp ./system/configuration.nix /etc/nixos/ + sudo ln -s $(pwd)/system/{machines,modules,pkgs} /etc/nixos sudo touch /etc/nixos/.system-installed - nixos-rebuild switch echo "==> System config installed, your old configuration is at /etc/nixos.bak" fi echo if [[ -f ~/.config/nixpkgs/system-installed ]]; then - echo "=== home-anager config already installed, skipping" + echo "=== home-manager config already installed, skipping" else echo "==> Installing home-manager config" nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager nix-channel --update - nix-shell '' -A install + # nix-shell '' -A install [[ -d ~/.config/nixpkgs ]] && mv ~/.config/{nixpkgs,nixpkgs.bak} mkdir -p ~/.config/nixpkgs - ln -s home/* ~/.config/nixpkgs - - home-manager switch + ln -s $(pwd)/home/* ~/.config/nixpkgs echo "==> home-manager config installed" fi -- cgit 1.4.1 From 4a049b08b1afd62979d939daef733ed42b0964e2 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:49:08 -0400 Subject: machine config for chupacabra --- system/machines/chupacabra.nix | 49 ++++++++++++++++++++++++++++++++++++++++++ system/modules/common.nix | 7 +++--- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 system/machines/chupacabra.nix diff --git a/system/machines/chupacabra.nix b/system/machines/chupacabra.nix new file mode 100644 index 000000000000..a283346ad509 --- /dev/null +++ b/system/machines/chupacabra.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ../modules/reusable/battery.nix + + + ]; + + networking.hostName = "chupacabra"; + + powerManagement = { + enable = true; + powertop.enable = true; + cpuFreqGovernor = "performance"; + }; + + laptop.onLowBattery = { + enable = true; + action = "hibernate"; + thresholdPercentage = 5; + }; + + boot.initrd.luks.devices."cryptswap".device = "/dev/disk/by-uuid/3b6e2fd4-bfe9-4392-a6e0-4f3b3b76e019"; + + boot.kernelParams = [ "acpi_rev_override" ]; + services.thermald.enable = true; + + # Intel-only graphics + hardware.nvidiaOptimus.disable = true; + boot.blacklistedKernelModules = [ "nouveau" "intel" ]; + services.xserver.videoDrivers = [ "intel" ]; + + # Nvidia Optimus (hybrid) - currently not working + # services.xserver.videoDrivers = [ "intel" "nvidia" ]; + # boot.blacklistedKernelModules = [ "nouveau" "bbswitch" ]; + # boot.extraModulePackages = [ pkgs.linuxPackages.nvidia_x11 ]; + # hardware.bumblebee.enable = true; + # hardware.bumblebee.pmMethod = "none"; + + systemd.services.disable-usb-autosuspend = { + description = "Disable USB autosuspend"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { Type = "oneshot"; }; + unitConfig.RequiresMountsFor = "/sys"; + script = '' + echo -1 > /sys/module/usbcore/parameters/autosuspend + ''; + }; +} diff --git a/system/modules/common.nix b/system/modules/common.nix index 27f4a73f09e9..008863bdbfac 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -6,12 +6,12 @@ ./xserver.nix ./emacs.nix ./sound.nix + ./urbint.nix ]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "bumblebee"; networking.useDHCP = false; networking.networkmanager.enable = true; @@ -65,9 +65,10 @@ isNormalUser = true; initialPassword = "password"; extraGroups = [ - "wheel" # Enable ‘sudo’ for the user. + "wheel" "networkmanager" "audio" + "docker" ]; shell = pkgs.zsh; }; @@ -90,7 +91,7 @@ powerManagement = { enable = true; - cpuFreqGovernor = "powersave"; + cpuFreqGovernor = lib.mkDefault "powersave"; powertop.enable = true; }; # Hibernate on low battery -- cgit 1.4.1 From 87909fc5cbbbb3bc29c2c92bd4145f3317d5e945 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:49:51 -0400 Subject: Email module for home notmuch, lieer --- home/home.nix | 1 + home/modules/email.nix | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 home/modules/email.nix diff --git a/home/home.nix b/home/home.nix index e0ecda410b9f..77499a32ba8a 100644 --- a/home/home.nix +++ b/home/home.nix @@ -4,6 +4,7 @@ imports = [ ./modules/alacritty.nix ./modules/emacs.nix + ./modules/email.nix ./modules/i3.nix ./modules/shell.nix ./modules/vim.nix diff --git a/home/modules/email.nix b/home/modules/email.nix new file mode 100644 index 000000000000..028d6fb98206 --- /dev/null +++ b/home/modules/email.nix @@ -0,0 +1,53 @@ +{ pkgs, ... }: +{ + # programs.mbsync.enable = true; + programs.lieer.enable = true; + programs.notmuch.enable = true; + services.lieer.enable = true; + programs.msmtp.enable = true; + + home.packages = with pkgs; [ + mu + ]; + + accounts.email.maildirBasePath = "mail"; + accounts.email.accounts = + let + mkAccount = params@{ passEntry, ... }: { + realName = "Griffin Smith"; + passwordCommand = "pass ${passEntry}"; + + flavor = "gmail.com"; + + imapnotify = { + enable = true; + boxes = [ "Inbox" ]; + }; + + gpg = { + key = "0F11A989879E8BBBFDC1E23644EF5B5E861C09A7"; + signByDefault = true; + }; + + # mbsync.enable = true; + notmuch.enable = true; + lieer = { + enable = true; + sync.enable = true; + }; + msmtp.enable = true; + } // builtins.removeAttrs params ["passEntry"]; + in { + work = mkAccount { + primary = true; + address = "griffin@urbint.com"; + aliases = [ "grfn@urbint.com" ]; + passEntry = "urbint/msmtp-app-password"; + }; + + personal = mkAccount { + address = "root@gws.fyi"; + passEntry = "root-gws-msmtp"; + }; + }; +} -- cgit 1.4.1 From 3f1cff7068d012e5b9a56f9d61659be5172aa987 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:51:12 -0400 Subject: lots of extra packages, misc home config --- home/home.nix | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/home/home.nix b/home/home.nix index 77499a32ba8a..402456e8a4a5 100644 --- a/home/home.nix +++ b/home/home.nix @@ -28,13 +28,28 @@ home.stateVersion = "19.09"; home.packages = with pkgs; [ - nix-prefetch-github + # Desktop stuff + arandr + firefox + chromium + xclip + xorg.xev + + # System utilities htop powertop - pass + usbutils + killall + + # Security + gnupg + + # Programming + jq gitAndTools.hub + gitAndTools.tig shellcheck - gnupg + httpie # Spotify...etc spotify @@ -43,6 +58,9 @@ # games crawl dwarf-fortress + + # Nix things + nix-prefetch-github ]; nixpkgs.config.allowUnfree = true; @@ -51,8 +69,13 @@ enable = true; userEmail = "root@gws.fyi"; userName = "Griffin Smith"; + extraConfig = { + github.user = "glittershark"; + }; }; + programs.password-store.enable = true; + services.redshift = { enable = true; provider = "geoclue2"; @@ -68,4 +91,16 @@ services.gpg-agent = { enable = true; }; + + xdg.mimeApps = { + enable = true; + defaultApplications = { + "text/html" = [ "firefox.desktop" ]; + }; + }; + }; + + services.gpg-agent = { + enable = true; + }; } -- cgit 1.4.1 From 81628a9c399be6747c6c702a54fed7ed95266e7a Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:51:24 -0400 Subject: Uncommitted kube aliases from old config --- home/modules/shell.nix | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index e37272cd4ecc..9d74bc73baff 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -22,11 +22,40 @@ hms = "home-manager switch"; nor = "sudo nixos-rebuild switch"; nrs = nor; - vihome = "vim ~/.config/nixpkgs/home.nix && home-manager switch"; - virc = "vim ~/.config/nixpkgs/home/shell.nix && home-manager switch && source ~/.zshrc"; + nrb = "sudo nixos-rebuild boot"; + vihome = "vim ~/code/system/home/home.nix && home-manager switch"; + virc = "vim ~/code/system/home/modules/shell.nix && home-manager switch && source ~/.zshrc"; + visystem = "sudo vim /etc/nixos/configuration.nix && sudo nixos-rebuild switch"; # Nix ns = "nix-shell"; + nb = "nix build -f ."; + "nc." = "nix copy -f . --to https://nix.urbinternal.com"; + + # Kubernetes + "kc" = "kubectl"; + "kg" = "kc get"; + "kga" = "kc get --all-namespaces"; + "kpd" = "kubectl get pods"; + "kpa" = "kubectl get pods --all-namespaces"; + "kdep" = "kubectl get deployments"; + "ked" = "kubectl edit deployment"; + "kpw" = "kubectl get pods -w"; + "kew" = "kubectl get events -w"; + "kdel" = "kubectl delete"; + "knw" = "kubectl get nodes -w"; + "arsy" = "argocd app sync --prune"; + + # Docker and friends + "dcu" = "docker-compose up"; + "dcud" = "docker-compose up -d"; + "dc" = "docker-compose"; + "dcr" = "docker-compose restart"; + "dclf" = "docker-compose logs -f"; + "dck" = "docker"; + "dockerclean" = "dockercleancontainers && dockercleanimages"; + "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; + "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; # Aliases from old config stck = "dirs -v"; @@ -50,12 +79,6 @@ "gnn" = "gn notebook-list"; "mytl" = "t tl $TWITTER_WHOAMI"; "first" = "awk '{print \$$1}'"; - "dcu" = "docker-compose up"; - "dc" = "docker-compose"; - "dck" = "docker"; - "dockerclean" = "dockercleancontainers && dockercleanimages"; - "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; - "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; "vi" = "vim"; -- cgit 1.4.1 From 6ae7133781e13b86f6d0a7f6eb1edba76c3b6457 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 29 Mar 2020 12:51:55 -0400 Subject: chupacabra home machine config --- home/home.nix | 7 ++----- home/machines/chupacabra.nix | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 home/machines/chupacabra.nix diff --git a/home/home.nix b/home/home.nix index 402456e8a4a5..f6b2d81b6048 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,5 +1,6 @@ { config, pkgs, ... }: +let machine = ./machines/chupacabra.nix; in { imports = [ ./modules/alacritty.nix @@ -11,6 +12,7 @@ ./modules/alsi.nix ./modules/lib/cloneRepo.nix + machine ]; # Let Home Manager install and manage itself. @@ -98,9 +100,4 @@ "text/html" = [ "firefox.desktop" ]; }; }; - }; - - services.gpg-agent = { - enable = true; - }; } diff --git a/home/machines/chupacabra.nix b/home/machines/chupacabra.nix new file mode 100644 index 000000000000..714348e3f174 --- /dev/null +++ b/home/machines/chupacabra.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + system.machine = { + wirelessInterface = "wlp59s0"; + i3FontSize = 9; + }; +} -- cgit 1.4.1 From cf4159a6da75200d9e3971cc3253a62cb517ed72 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:09:22 -0400 Subject: Some extra i3 shortcuts, plus dunst config --- home/modules/i3.nix | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index ebe87e8bac1b..c564ed8221d4 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -7,6 +7,14 @@ let msg=$(emacsclient --eval '${eval}' 2>&1) echo "''${msg:1:-1}" ''; + screenlayout = { + home = pkgs.writeShellScript "screenlayout_home.sh" '' + xrandr \ + --output eDP1 --mode 3840x2160 --pos 0x0 --rotate normal \ + --output DP1 --primary --mode 3840x2160 --pos 0x2160 --rotate normal \ + --output DP2 --off --output DP3 --off --output VIRTUAL1 --off + ''; + }; in { options = with lib; { system.machine.wirelessInterface = mkOption { @@ -71,7 +79,7 @@ in { "${mod}+m" = ''exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Go to: ' ''; # Screenshots - "${mod}+q" = "exec maim"; + "${mod}+q" = "exec \"maim | xclip -selection clipboard -t image/png\""; "${mod}+Shift+q" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; # Launching applications @@ -99,9 +107,10 @@ in { # Screen Layout "${mod}+Shift+t" = "exec xrandr --auto"; - # TODO - # $mod+t exec /home/griffin/.screenlayout/work.sh - # $mod+Ctrl+t exec /home/griffin/bin/fix_screen.sh + "${mod}+t" = "exec ${screenlayout.home}"; + "${mod}+Ctrl+t" = "exec ${pkgs.writeShellScript "fix_term.sh" '' + xrandr --output eDP-1 --off && ${screenlayout.home} + ''}"; }; fonts = [ decorationFont ]; @@ -243,14 +252,18 @@ in { enable = true; settings = with solarized; { global = { - font = "Meslo 10"; + font = "MesloLGSDZ ${toString (config.system.machine.i3FontSize * 1.5)}"; allow_markup = true; format = "%s\n%b"; sort = true; alignment = "left"; - geometry = "600x15-30+20"; + geometry = "600x15-40+40"; idle_threshold = 120; separator_color = "frame"; + separator_height = 1; + word_wrap = true; + padding = 8; + horizontal_padding = 8; }; frame = { -- cgit 1.4.1 From 562100bad219434920f1787187c7a3be19c19c86 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:10:12 -0400 Subject: More robust config for default firefox browser --- home/home.nix | 12 ++++-------- home/modules/firefox.nix | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 home/modules/firefox.nix diff --git a/home/home.nix b/home/home.nix index f6b2d81b6048..bb56cb6ea576 100644 --- a/home/home.nix +++ b/home/home.nix @@ -6,6 +6,7 @@ let machine = ./machines/chupacabra.nix; in ./modules/alacritty.nix ./modules/emacs.nix ./modules/email.nix + ./modules/firefox.nix ./modules/i3.nix ./modules/shell.nix ./modules/vim.nix @@ -87,17 +88,12 @@ let machine = ./machines/chupacabra.nix; in impure.clonedRepos.passwordStore = { github = "glittershark/pass"; - path = ".password-store"; + path = ".local/share/password-store"; }; - services.gpg-agent = { - enable = true; - }; + urbint.projectPath = "code/urb"; - xdg.mimeApps = { + services.gpg-agent = { enable = true; - defaultApplications = { - "text/html" = [ "firefox.desktop" ]; - }; }; } diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix new file mode 100644 index 000000000000..c7e78685a5a3 --- /dev/null +++ b/home/modules/firefox.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +{ + + xdg.mimeApps = rec { + enable = true; + defaultApplications = { + "text/html" = [ "firefox.desktop" ]; + "x-scheme-handler/http" = [ "firefox.desktop" ]; + "x-scheme-handler/https" = [ "firefox.desktop" ]; + "x-scheme-handler/ftp" = [ "firefox.desktop" ]; + "x-scheme-handler/chrome" = [ "firefox.desktop" ]; + "application/x-extension-htm" = [ "firefox.desktop" ]; + "application/x-extension-html" = [ "firefox.desktop" ]; + "application/x-extension-shtml" = [ "firefox.desktop" ]; + "application/xhtml+xml" = [ "firefox.desktop" ]; + "application/x-extension-xhtml" = [ "firefox.desktop" ]; + "application/x-extension-xht" = [ "firefox.desktop" ]; + }; + associations.added = defaultApplications; + }; +} -- cgit 1.4.1 From 58741dad6307672fe1f9618043e29e6ccc122041 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:10:28 -0400 Subject: klf alias --- home/modules/shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 9d74bc73baff..9316285b477d 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -38,6 +38,7 @@ "kga" = "kc get --all-namespaces"; "kpd" = "kubectl get pods"; "kpa" = "kubectl get pods --all-namespaces"; + "klf" = "kubectl logs -f"; "kdep" = "kubectl get deployments"; "ked" = "kubectl edit deployment"; "kpw" = "kubectl get pods -w"; -- cgit 1.4.1 From 2de47035c93590c5ab3d4815e45391ae74c09444 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:10:38 -0400 Subject: fix alacritty bright colors needed to get vim color scheme working as expected --- home/modules/alacritty.nix | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/home/modules/alacritty.nix b/home/modules/alacritty.nix index ba26360fe924..34ccf47f18e4 100644 --- a/home/modules/alacritty.nix +++ b/home/modules/alacritty.nix @@ -8,6 +8,9 @@ enable = true; settings = { font.size = 6; + font.normal.family = "Meslo LGSDZ Nerd Font"; + + draw_bold_text_with_bright_colors = false; colors = with import ../common/solarized.nix; rec { # Default colors @@ -29,17 +32,17 @@ }; # Bright colors - bright = normal; - # bright = { - # black = base03; - # red = orange; - # green = base01; - # yellow = base00; - # blue = base0; - # magenta = violet; - # cyan = base1; - # white = base3; - # }; + # bright = normal; + bright = { + black = base03; + red = orange; + green = base01; + yellow = base00; + blue = base0; + magenta = violet; + cyan = base1; + white = base3; + }; }; }; }; -- cgit 1.4.1 From 31fbb493f5d07c0fc6fdcd5d968601458b4e9550 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:11:00 -0400 Subject: packages --- home/home.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home/home.nix b/home/home.nix index bb56cb6ea576..871b82009446 100644 --- a/home/home.nix +++ b/home/home.nix @@ -31,6 +31,8 @@ let machine = ./machines/chupacabra.nix; in home.stateVersion = "19.09"; home.packages = with pkgs; [ + (import (fetchTarball "https://github.com/ashkitten/nixpkgs/archive/init-glimpse.tar.gz") {}).glimpse + # Desktop stuff arandr firefox @@ -42,7 +44,9 @@ let machine = ./machines/chupacabra.nix; in htop powertop usbutils + pciutils killall + gdmap # Security gnupg @@ -53,6 +57,7 @@ let machine = ./machines/chupacabra.nix; in gitAndTools.tig shellcheck httpie + entr # Spotify...etc spotify -- cgit 1.4.1 From 5ed0ad3bac47978b35cbc8d91642467e94b6a7e8 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:11:32 -0400 Subject: try installing msmtp directly --- home/modules/email.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/email.nix b/home/modules/email.nix index 028d6fb98206..80c5385e69ae 100644 --- a/home/modules/email.nix +++ b/home/modules/email.nix @@ -8,6 +8,7 @@ home.packages = with pkgs; [ mu + msmtp ]; accounts.email.maildirBasePath = "mail"; -- cgit 1.4.1 From ac2549ce500400ed7ffaefe42a1785a11b2de6fd Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 31 Mar 2020 17:11:46 -0400 Subject: argocd from unstable --- pkgs/argocd.nix | 1 + 1 file changed, 1 insertion(+) create mode 100644 pkgs/argocd.nix diff --git a/pkgs/argocd.nix b/pkgs/argocd.nix new file mode 100644 index 000000000000..5ab0e95d4462 --- /dev/null +++ b/pkgs/argocd.nix @@ -0,0 +1 @@ +(import {}).argocd -- cgit 1.4.1 From 74ad2caf32fc35dcb6e7117c4b1b349ed7a7a545 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 2 Apr 2020 11:57:18 -0400 Subject: git merge conflictstyle diff3 why is this not the default --- home/home.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/home.nix b/home/home.nix index 871b82009446..92632913dcfd 100644 --- a/home/home.nix +++ b/home/home.nix @@ -79,6 +79,7 @@ let machine = ./machines/chupacabra.nix; in userName = "Griffin Smith"; extraConfig = { github.user = "glittershark"; + merge.conflictstyle = "diff3"; }; }; -- cgit 1.4.1 From 4399b2ac44fa8539a9f8294fce0c2d63ed8327de Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 4 Apr 2020 11:38:03 -0400 Subject: rofi-pass config --- home/modules/i3.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index c564ed8221d4..1c02939ecbd6 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -38,6 +38,7 @@ in { home.packages = with pkgs; [ maim rofi + rofi-pass i3status python38Packages.py3status i3lock @@ -88,11 +89,14 @@ in { rofi \ -modi 'combi' \ -combi-modi "window,drun,ssh,run" \ - -font 'MesloLGSDZ 10' \ + -font '${decorationFont}' \ -show combi ''; in "exec ${rofi}"; + # Passwords + "${mod}+p" = "exec rofi-pass -font '${decorationFont}'"; + # Media "XF86AudioPlay" = "exec playerctl play-pause"; "XF86AudioNext" = "exec playerctl next"; -- cgit 1.4.1 From 4da947bf9102d719b3d3de5523c4eb398a57558d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 4 Apr 2020 11:38:27 -0400 Subject: lots of extra packages --- home/home.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home/home.nix b/home/home.nix index 92632913dcfd..702be83242e5 100644 --- a/home/home.nix +++ b/home/home.nix @@ -36,9 +36,12 @@ let machine = ./machines/chupacabra.nix; in # Desktop stuff arandr firefox + feh chromium xclip xorg.xev + picom + peek # System utilities htop @@ -47,6 +50,8 @@ let machine = ./machines/chupacabra.nix; in pciutils killall gdmap + bind + lsof # Security gnupg -- cgit 1.4.1 From a8e42d6e6d811ca31862606263f5818c95b0ab18 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 4 Apr 2020 11:45:37 -0400 Subject: binding for peek --- home/modules/i3.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index 1c02939ecbd6..b4ffd202e07c 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -36,13 +36,18 @@ in { let decorationFont = "MesloLGSDZ ${toString config.system.machine.i3FontSize}"; in { home.packages = with pkgs; [ - maim rofi rofi-pass - i3status python38Packages.py3status i3lock dconf # for gtk + + # Screenshots + maim + + # GIFs + picom + peek ]; xsession.scriptPath = ".hm-xsession"; @@ -82,6 +87,12 @@ in { # 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" '' + picom & + picom_pid=$! + peek || true + kill -SIGINT $picom_pid + ''}"; # Launching applications "${mod}+u" = -- cgit 1.4.1 From fe0347d1a357b1c7c61a47630961590523e941a4 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 4 Apr 2020 11:45:46 -0400 Subject: ncg alias --- home/modules/shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 9316285b477d..eeab2d0f6202 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -23,6 +23,7 @@ nor = "sudo nixos-rebuild switch"; nrs = nor; nrb = "sudo nixos-rebuild boot"; + ncg = "nix-collect-garbage"; vihome = "vim ~/code/system/home/home.nix && home-manager switch"; virc = "vim ~/code/system/home/modules/shell.nix && home-manager switch && source ~/.zshrc"; visystem = "sudo vim /etc/nixos/configuration.nix && sudo nixos-rebuild switch"; -- cgit 1.4.1 From 07d4cf66eb1ae4972764debfeb824c50fbdc6e21 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 4 Apr 2020 11:45:57 -0400 Subject: lots of vimrc cleanup --- home/modules/vimrc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/home/modules/vimrc b/home/modules/vimrc index 16bc8d9184c6..3e33b5e2bee7 100644 --- a/home/modules/vimrc +++ b/home/modules/vimrc @@ -27,9 +27,9 @@ let maplocalleader = '\' set undofile " set undodir=~/.vim/undo set wildignore=*.pyc,*.o,.git -set clipboard=unnamed -" set backupdir=$HOME/.vim/backup -" set directory=$HOME/.vim/tmp +set clipboard=unnamedplus +" set backupdir=$HOME/.vim/backup +" set directory=$HOME/.vim/tmp set foldmarker={{{,}}} set colorcolumn=+1 set concealcursor= @@ -276,7 +276,7 @@ let g:syntastic_enable_signs = 0 let g:syntastic_python_checkers = ['flake8'] let g:syntastic_python_flake8_post_args = "--ignore=E101,E223,E224,E301,E302,E303,E501,E701,W,F401,E111,E261" -" }}} +" }}} " Javascript {{{ let g:syntastic_javascript_checkers = ['eslint'] let g:flow#autoclose = 1 @@ -284,7 +284,7 @@ let g:flow#enable = 1 " augroup syntastic_javascript_jsx " autocmd! -" autocmd BufReadPre,BufNewFile *.js +" autocmd BufReadPre,BufNewFile *.js " autocmd BufReadPre,BufNewFile *.jsx " \ let g:syntastic_javascript_checkers = ['jsxhint'] " augroup END @@ -502,7 +502,7 @@ let g:projectionist_heuristics = { \ } \ }, \ "pom.xml&src/main/clj/|src/main/cljs": { - \ "*": { + \ "*": { \ "start": "USE_NREPL=1 bin/run -m elephant.dev-system" , \ "connect": "nrepl://localhost:5554", \ "piggieback": "(figwheel-sidecar.repl-api/repl-env)" @@ -542,7 +542,7 @@ let g:AutoPairsCenterLine = 0 " Filetypes {{{ " Python {{{ -aug Python +aug Python au! au FileType python set tabstop=4 shiftwidth=4 softtabstop=4 expandtab aug END @@ -556,7 +556,7 @@ aug PHP aug END " }}} " Mail {{{ -aug Mail +aug Mail au FileType mail setlocal spell aug END " }}} @@ -591,15 +591,15 @@ endfunction " Ruby {{{ function! s:RSpecSyntax() - syn keyword rspecMethod describe context it its specify shared_context - \ shared_examples shared_examples_for shared_context include_examples - \ include_context it_should_behave_like it_behaves_like before after - \ around fixtures controller_name helper_name scenario feature + syn keyword rspecMethod describe context it its specify shared_context + \ shared_examples shared_examples_for shared_context include_examples + \ include_context it_should_behave_like it_behaves_like before after + \ around fixtures controller_name helper_name scenario feature \ background given described_class syn match rspecMethod '\!\=' syn match rspecMethod '\!\=' - syn keyword rspecMethod violated pending expect expect_any_instance_of allow - \ allow_any_instance_of double instance_double mock mock_model + syn keyword rspecMethod violated pending expect expect_any_instance_of allow + \ allow_any_instance_of double instance_double mock mock_model \ stub_model xit syn match rspecMethod '\.\@!\@!' @@ -610,7 +610,7 @@ function! s:RSpecHiDefaults() hi def link rspecMethod rubyFunction endfunction -augroup Ruby +augroup Ruby au! " au FileType ruby let b:surround_114 = "\\(module|class,def,if,unless,case,while,until,begin,do) \r end" " au FileType ruby set fdm=syntax @@ -618,7 +618,7 @@ augroup Ruby au FileType ruby set omnifunc= au FileType ruby nnoremap gy orequire 'pry'; binding.pry^ au FileType ruby nnoremap gY Orequire 'pry'; binding.pry^ - au FileType ruby nnoremap yu :g/require 'pry'; binding.pry/d + au FileType ruby nnoremap yu :g/require 'pry'; binding.pry/d au BufNewFile,BufRead *_spec.rb call RSpecSyntax() augroup END @@ -657,7 +657,7 @@ aug Clojure \ '[': ']'} " Don't auto-pair quote reader macros " \'`': '`', - " \ '''': '''', + " \ '''': '''', autocmd User ProjectionistActivate call s:projectionist_connect() @@ -674,7 +674,7 @@ aug Clojure endfor endif - " if connected && exists(':Piggieback') + " if connected && exists(':Piggieback') " for [root, value] in projectionist#query('piggieback') " silent execute "Piggieback" value " break @@ -1102,10 +1102,10 @@ function! s:sort_motion(mode) abort endif endfunction -function! s:sort_lines() +function! s:sort_lines() let beginning = line('.') let end = v:count + beginning - 1 - execute beginning . ',' . end . 'sort' + execute beginning . ',' . end . 'sort' endfunction xnoremap SortMotionVisual :call sort_motion(visualmode()) -- cgit 1.4.1 From a566e0208f2134e69e4550d1c05fc49d2b3c6efd Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 5 Apr 2020 15:26:16 -0400 Subject: Swap caps+escape and alt+super only on chupacabra laptop keyboard --- home/machines/chupacabra.nix | 28 ++++++++++++++++++++++++++-- system/machines/bumblebee.nix | 2 ++ system/modules/xserver.nix | 1 - 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/home/machines/chupacabra.nix b/home/machines/chupacabra.nix index 714348e3f174..c0d1fce431fb 100644 --- a/home/machines/chupacabra.nix +++ b/home/machines/chupacabra.nix @@ -1,7 +1,31 @@ -{ ... }: -{ +{ pkgs, ... }: +let + laptopKeyboardId = "25"; +in { system.machine = { wirelessInterface = "wlp59s0"; i3FontSize = 9; }; + + systemd.user.services.laptop-keyboard = { + Unit = { + Description = "Swap caps+escape and alt+super, but only on the built-in laptop keyboard"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = ( + "${pkgs.xorg.setxkbmap}/bin/setxkbmap " + + "-device ${laptopKeyboardId} " + + "-option caps:swapescape " + + "-option compose:ralt " + + "-option altwin:swap_alt_win" + ); + }; + }; } diff --git a/system/machines/bumblebee.nix b/system/machines/bumblebee.nix index a1cd3ffa143d..0fec21409255 100644 --- a/system/machines/bumblebee.nix +++ b/system/machines/bumblebee.nix @@ -18,4 +18,6 @@ action = "hibernate"; thresholdPercentage = 5; }; + + services.xserver.xkbOptions = "caps:swapescape"; } diff --git a/system/modules/xserver.nix b/system/modules/xserver.nix index 52f04e2e6a69..2638f075249c 100644 --- a/system/modules/xserver.nix +++ b/system/modules/xserver.nix @@ -4,7 +4,6 @@ services.xserver = { enable = true; layout = "us"; - xkbOptions = "caps:swapescape"; libinput.enable = true; -- cgit 1.4.1 From fae347ee0f25f26f234d6ec4dc5b4b41897b2996 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Apr 2020 23:23:40 -0400 Subject: packages for org-mode latex export --- home/modules/emacs.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index 0487a2ef650a..cb78db7febfa 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -16,8 +16,18 @@ in { # ''; # - home.packages = [ + home.packages = with pkgs; [ # haskellPackages.Agda BROKEN + + # LaTeX (for org export) + (pkgs.texlive.combine { + inherit (pkgs.texlive) + scheme-basic collection-fontsrecommended ulem + fncychap titlesec tabulary varwidth framed fancyvrb float parskip + wrapfig upquote capt-of needspace; + }) + + ispell ]; programs.emacs.enable = true; -- cgit 1.4.1 From bf92d3b7407d306944eca92df2bf49c787546b11 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Apr 2020 23:23:49 -0400 Subject: simplify rofi script --- home/modules/i3.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index b4ffd202e07c..e3eea5f7d8d8 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -95,15 +95,13 @@ in { ''}"; # Launching applications - "${mod}+u" = - let rofi = pkgs.writeShellScript "rofi" '' + "${mod}+u" = "exec ${pkgs.writeShellScript "rofi" '' rofi \ -modi 'combi' \ -combi-modi "window,drun,ssh,run" \ -font '${decorationFont}' \ -show combi - ''; - in "exec ${rofi}"; + ''}"; # Passwords "${mod}+p" = "exec rofi-pass -font '${decorationFont}'"; -- cgit 1.4.1 From 05dfaed88fdb219bcf89e3be7fdc96953a38ce35 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Apr 2020 23:24:01 -0400 Subject: many more packages --- home/home.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home/home.nix b/home/home.nix index 702be83242e5..e8902a699527 100644 --- a/home/home.nix +++ b/home/home.nix @@ -42,6 +42,8 @@ let machine = ./machines/chupacabra.nix; in xorg.xev picom peek + signal-desktop + apvlv # pdf viewer # System utilities htop @@ -52,6 +54,9 @@ let machine = ./machines/chupacabra.nix; in gdmap bind lsof + zip + tree + ncat # Security gnupg @@ -63,6 +68,7 @@ let machine = ./machines/chupacabra.nix; in shellcheck httpie entr + gnumake # Spotify...etc spotify -- cgit 1.4.1 From 3bad122d10f4e5aee1f52fcc39701e208c14c5f4 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Apr 2020 23:24:11 -0400 Subject: more git aliases, plus alias sorting --- home/modules/shell.nix | 61 ++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index eeab2d0f6202..09024c4901e0 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -59,35 +59,7 @@ "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; - # Aliases from old config - stck = "dirs -v"; - b= "cd ~1"; - ".." = "cd .."; - "..." = "cd ../.."; - "...." = "cd ../../.."; - "....." = "cd ../../../.."; - "http" = "http --style solarized"; - "grep" = "grep $GREP_OPTIONS"; - "bak" = "~/bin/backup.sh"; - "xmm" = "xmodmap ~/.Xmodmap"; - "asdflkj" = "asdf"; - "asdf" = "asdfghjkl"; - "asdfghjkl" = "echo \"Having some trouble?\""; - "ift" = "sudo iftop -i wlp3s0"; - "rvpn" = "sudo systemctl restart openvpn@bldr-dev openvpn@lsvl-dev"; - "gne" = "gn edit"; - "gnf" = "gn find"; - "gnt" = "gn tag-list"; - "gnn" = "gn notebook-list"; - "mytl" = "t tl $TWITTER_WHOAMI"; - "first" = "awk '{print \$$1}'"; - "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; - "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; - "vi" = "vim"; - "awa" = "ssh aw2-admin.nomi.host"; - "dtf" = "cd ~/.dotfiles"; - "adbdev" = "adb devices"; - "adbcon" = "adb connect $GNEX_IP"; + # Git "gwip" = "git add . && git commit -am wip"; "gpr" = "g pull-request"; "gcl" = "git clone"; @@ -128,6 +100,37 @@ "gnp" = "git --no-pager"; "g" = "git"; "git" = "hub"; + "grim" = " git fetch && git rebase -i origin/master"; + + # Aliases from old config + stck = "dirs -v"; + b= "cd ~1"; + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../.."; + "....." = "cd ../../../.."; + "http" = "http --style solarized"; + "grep" = "grep $GREP_OPTIONS"; + "bak" = "~/bin/backup.sh"; + "xmm" = "xmodmap ~/.Xmodmap"; + "asdflkj" = "asdf"; + "asdf" = "asdfghjkl"; + "asdfghjkl" = "echo \"Having some trouble?\""; + "ift" = "sudo iftop -i wlp3s0"; + "rvpn" = "sudo systemctl restart openvpn@bldr-dev openvpn@lsvl-dev"; + "gne" = "gn edit"; + "gnf" = "gn find"; + "gnt" = "gn tag-list"; + "gnn" = "gn notebook-list"; + "mytl" = "t tl $TWITTER_WHOAMI"; + "first" = "awk '{print \$$1}'"; + "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; + "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; + "vi" = "vim"; + "awa" = "ssh aw2-admin.nomi.host"; + "dtf" = "cd ~/.dotfiles"; + "adbdev" = "adb devices"; + "adbcon" = "adb connect $GNEX_IP"; "mpalb" = "mpc search album"; "mpart" = "mpc search artist"; "mps" = "mpc search"; -- cgit 1.4.1 From c4650be8f0be289e3687c2525ebfbcd5319fe102 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Apr 2020 23:24:23 -0400 Subject: global gitignoress --- home/home.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home/home.nix b/home/home.nix index e8902a699527..6632a4f13819 100644 --- a/home/home.nix +++ b/home/home.nix @@ -88,6 +88,15 @@ let machine = ./machines/chupacabra.nix; in enable = true; userEmail = "root@gws.fyi"; userName = "Griffin Smith"; + ignores = [ + "*.sw*" + ".classpath" + ".project" + ".settings/" + ".dir-locals.el" + ".stack-work-profiling" + ".projectile" + ]; extraConfig = { github.user = "glittershark"; merge.conflictstyle = "diff3"; -- cgit 1.4.1 From 100b962b7211a6544c8214b3690f45fe457818f3 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Apr 2020 23:24:31 -0400 Subject: emoji fonts --- system/modules/common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index 008863bdbfac..feb8b92b09a6 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -85,6 +85,7 @@ fonts.fonts = with pkgs; [ nerdfonts + noto-fonts-emoji ]; services.geoclue2.enable = true; -- cgit 1.4.1 From 446c8bfddd0bca947433b848a43b953c08dc8506 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 28 Apr 2020 14:36:57 -0400 Subject: Bump kubie, extract kube config --- home/modules/development.nix | 75 +++++++++++++++++++++++++++++++++++++++ home/modules/development/kube.nix | 52 +++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 home/modules/development.nix create mode 100644 home/modules/development/kube.nix diff --git a/home/modules/development.nix b/home/modules/development.nix new file mode 100644 index 000000000000..fecb48f1644b --- /dev/null +++ b/home/modules/development.nix @@ -0,0 +1,75 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./development/kube.nix + ]; + + home.packages = with pkgs; [ + jq + gitAndTools.hub + gitAndTools.tig + shellcheck + httpie + entr + gnumake + inetutils + (import (pkgs.fetchFromGitHub { + owner = "moretea"; + repo = "yarn2nix"; + rev = "9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae"; + sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7"; + }) { inherit pkgs; }).yarn2nix + julia + ]; + + programs.git = { + enable = true; + # bah, this doesn't work + # package = pkgs.git.override { + # sendEmailSupport = true; + # }; + userEmail = "root@gws.fyi"; + userName = "Griffin Smith"; + ignores = [ + "*.sw*" + ".classpath" + ".project" + ".settings/" + ".dir-locals.el" + ".stack-work-profiling" + ".projectile" + ]; + extraConfig = { + github.user = "glittershark"; + merge.conflictstyle = "diff3"; + }; + }; + + home.file.".psqlrc".text = '' + \set QUIET 1 + \timing + \set ON_ERROR_ROLLBACK interactive + \set VERBOSITY verbose + \x auto + \set PROMPT1 '%[%033[1m%]%M/%/%R%[%033[0m%]%# ' + \set PROMPT2 '...%# ' + \set HISTFILE ~/.psql_history- :DBNAME + \set HISTCONTROL ignoredups + \pset null [null] + \unset QUIET + ''; + + home.file.".ipython/profile_default/ipython_config.py".text = '' + c.InteractiveShellApp.exec_lines = ['%autoreload 2'] + c.InteractiveShellApp.extensions = ['autoreload'] + c.TerminalInteractiveShell.editing_mode = 'vi' + ''; + + programs.readline = { + enable = true; + extraConfig = '' + set editing-mode vi + ''; + }; +} diff --git a/home/modules/development/kube.nix b/home/modules/development/kube.nix new file mode 100644 index 000000000000..58de4b70ed00 --- /dev/null +++ b/home/modules/development/kube.nix @@ -0,0 +1,52 @@ +{ config, lib, pkgs, ... }: +let + pkgs-unstable = import {}; + + kubie = pkgs-unstable.kubie.overrideAttrs (drv: rec { + name = "kubie-${version}"; + version = "0.8.4"; + src = pkgs.fetchFromGitHub { + rev = "v${version}"; + owner = "sbstp"; + repo = "kubie"; + sha256 = "1f82xlhhxbjadjw609kr1kdm4n69c9mqjia4b3k505wjh7cc55n0"; + }; + + cargoDeps = drv.cargoDeps.overrideAttrs (lib.const { + name = "${name}-vendor.tar.gz"; + inherit src; + outputHash = "0mish7wqwq5ynl98n6swdn5i6mg62aih5rfykbl3wx39b468n481"; + }); + }); +in +{ + home.packages = with pkgs; [ + kubectl + kubetail + sops + kubie + pkgs-unstable.argocd + ]; + + programs.zsh.shellAliases = { + "kc" = "kubectl"; + "kg" = "kc get"; + "kga" = "kc get --all-namespaces"; + "kpd" = "kubectl get pods"; + "kpa" = "kubectl get pods --all-namespaces"; + "klf" = "kubectl logs -f"; + "kdep" = "kubectl get deployments"; + "ked" = "kubectl edit deployment"; + "kpw" = "kubectl get pods -w"; + "kew" = "kubectl get events -w"; + "kdel" = "kubectl delete"; + "knw" = "kubectl get nodes -w"; + "arsy" = "argocd app sync --prune"; + }; + + home.file.".kube/kubie.yaml".text = '' + shell: zsh + prompt: + zsh_use_rps1: true + ''; +} -- cgit 1.4.1 From 9405a6391a2cc76fdb0977da2bcf27a400f73c7e Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:12:31 -0400 Subject: Add tarsnap module --- home/home.nix | 1 + home/modules/tarsnap.nix | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 home/modules/tarsnap.nix diff --git a/home/home.nix b/home/home.nix index 6632a4f13819..8a6704ecc8e1 100644 --- a/home/home.nix +++ b/home/home.nix @@ -9,6 +9,7 @@ let machine = ./machines/chupacabra.nix; in ./modules/firefox.nix ./modules/i3.nix ./modules/shell.nix + ./modules/tarsnap.nix ./modules/vim.nix ./modules/alsi.nix ./modules/lib/cloneRepo.nix diff --git a/home/modules/tarsnap.nix b/home/modules/tarsnap.nix new file mode 100644 index 000000000000..4bff19910f05 --- /dev/null +++ b/home/modules/tarsnap.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tarsnap + ]; + + home.file.".tarsnaprc".text = '' + ### Recommended options + + # Tarsnap cache directory + cachedir /home/grfn/.cache/tarsnap + + # Tarsnap key file + keyfile /home/grfn/.private/tarsnap.key + + # Don't archive files which have the nodump flag set. + nodump + + # Print statistics when creating or deleting archives. + print-stats + + # Create a checkpoint once per GB of uploaded data. + checkpoint-bytes 1G + + ### Commonly useful options + + # Use SI prefixes to make numbers printed by --print-stats more readable. + humanize-numbers + + ### 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 + + # 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 + + # 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 + + # Snapshot time. Use this option if you are backing up files + # from a filesystem snapshot rather than from a "live" filesystem. + #snaptime + ''; +} -- cgit 1.4.1 From 46cd32c557128cea69ff9a2d7c9efe425d0063a0 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:12:54 -0400 Subject: linux-ck --- system/modules/common.nix | 1 + system/modules/kernel.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 system/modules/kernel.nix diff --git a/system/modules/common.nix b/system/modules/common.nix index feb8b92b09a6..8d2902eaa6ae 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -7,6 +7,7 @@ ./emacs.nix ./sound.nix ./urbint.nix + ./kernel.nix ]; boot.loader.systemd-boot.enable = true; diff --git a/system/modules/kernel.nix b/system/modules/kernel.nix new file mode 100644 index 000000000000..92aa6955a73b --- /dev/null +++ b/system/modules/kernel.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: +with lib.versions; +let + inherit (pkgs) runCommand; + kernelRelease = config.linuxPackages.kernel.version or pkgs.linux.version; + mj = major kernelRelease; + mm = majorMinor kernelRelease; + linux-ck = runCommand "linux-ck-combined.patch" {} '' + ${pkgs.xz}/bin/unxz -kfdc ${builtins.fetchurl { + # http://ck.kolivas.org/patches/5.0/5.4/5.4-ck1/patch-5.4-ck1.xz + url = "http://ck.kolivas.org/patches/${mj}.0/${mm}/${mm}-ck1/patch-${mm}-ck1.xz"; + sha256 = "0p2ccwlsmq0587x6cnbrk4h2bwpl9342bmhsbyi1a87cs2jfwigl"; + }} > $out + ''; +in +{ + boot.kernelPackages = pkgs.linuxPackages.extend (self: super: { + kernel = super.kernel.override { + kernelPatches = super.kernel.kernelPatches ++ [{ + name = "linux-ck"; + patch = linux-ck; + }]; + argsOverride = { + modDirVersion = super.kernel.modDirVersion + "-ck1"; + }; + }; + }); +} -- cgit 1.4.1 From 7ff91eb99a77364e1404a11c4ae1d34101138736 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:14:02 -0400 Subject: Break fonts out into their own module More will go here --- home/home.nix | 2 ++ system/modules/common.nix | 6 +----- system/modules/fonts.nix | 12 ++++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 system/modules/fonts.nix diff --git a/home/home.nix b/home/home.nix index 8a6704ecc8e1..42f155362e98 100644 --- a/home/home.nix +++ b/home/home.nix @@ -4,6 +4,8 @@ let machine = ./machines/chupacabra.nix; in { imports = [ ./modules/alacritty.nix + ./modules/alsi.nix + ./modules/development.nix ./modules/emacs.nix ./modules/email.nix ./modules/firefox.nix diff --git a/system/modules/common.nix b/system/modules/common.nix index 8d2902eaa6ae..d35298175515 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -4,6 +4,7 @@ imports = [ ./xserver.nix + ./fonts.nix ./emacs.nix ./sound.nix ./urbint.nix @@ -84,11 +85,6 @@ nixpkgs.config.allowUnfree = true; - fonts.fonts = with pkgs; [ - nerdfonts - noto-fonts-emoji - ]; - services.geoclue2.enable = true; powerManagement = { diff --git a/system/modules/fonts.nix b/system/modules/fonts.nix new file mode 100644 index 000000000000..babe30d4271f --- /dev/null +++ b/system/modules/fonts.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: +{ + fonts = { + fonts = with pkgs; [ + nerdfonts + noto-fonts-emoji + twitter-color-emoji + ]; + + fontconfig.defaultFonts.emoji = ["Twitter Color Emoji"]; + }; +} -- cgit 1.4.1 From a7e96371712f285b37678ac33f210590947275c9 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:14:14 -0400 Subject: Update intel microcode --- system/machines/chupacabra.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/machines/chupacabra.nix b/system/machines/chupacabra.nix index a283346ad509..2186a59ebad0 100644 --- a/system/machines/chupacabra.nix +++ b/system/machines/chupacabra.nix @@ -25,6 +25,8 @@ boot.kernelParams = [ "acpi_rev_override" ]; services.thermald.enable = true; + hardware.cpu.intel.updateMicrocode = true; + # Intel-only graphics hardware.nvidiaOptimus.disable = true; boot.blacklistedKernelModules = [ "nouveau" "intel" ]; -- cgit 1.4.1 From 73e59d225a0515dc9f9b7bfc6d48f700623875e4 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:14:27 -0400 Subject: Shell aliases go to bash too just in case something really wants to run bash (kubie?) --- home/modules/shell.nix | 242 +++++++++++++++++++++++-------------------------- 1 file changed, 115 insertions(+), 127 deletions(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 09024c4901e0..9378490bb6f3 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -1,5 +1,112 @@ { config, lib, pkgs, ... }: -{ +let + shellAliases = rec { + # NixOS stuff + hms = "home-manager switch"; + nor = "sudo nixos-rebuild switch"; + nrs = nor; + nrb = "sudo nixos-rebuild boot"; + ncg = "nix-collect-garbage"; + vihome = "vim ~/code/system/home/home.nix && home-manager switch"; + virc = "vim ~/code/system/home/modules/shell.nix && home-manager switch && source ~/.zshrc"; + visystem = "sudo vim /etc/nixos/configuration.nix && sudo nixos-rebuild switch"; + + # Nix + ns = "nix-shell"; + nb = "nix build -f ."; + "nc." = "nix copy -f . --to https://nix.urbinternal.com"; + + # Docker and friends + "dcu" = "docker-compose up"; + "dcud" = "docker-compose up -d"; + "dc" = "docker-compose"; + "dcr" = "docker-compose restart"; + "dclf" = "docker-compose logs -f"; + "dck" = "docker"; + "dockerclean" = "dockercleancontainers && dockercleanimages"; + "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; + "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; + + # Git + "gwip" = "git add . && git commit -am wip"; + "gpr" = "g pull-request"; + "gcl" = "git clone"; + "grs" = "gr --soft"; + "grhh" = "grh HEAD"; + "grh" = "gr --hard"; + "gr" = "git reset"; + "gcb" = "gc -b"; + "gco" = "gc"; + "gcd" = "gc development"; + "gcm" = "gc master"; + "gc" = "git checkout"; + "gbg" = "git branch | grep"; + "gba" = "git branch -a"; + "gb" = "git branch"; + "gcv" = "git commit --verbose"; + "gci" = "git commit"; + "gm" = "git merge"; + "gdc" = "gd --cached"; + "gd" = "git diff"; + "gsl" = "git stash list"; + "gss" = "git show stash"; + "gsad" = "git stash drop"; + "gsa" = "git stash"; + "gst" = "gs"; + "gs" = "git status"; + "gg" = "gl --decorate --oneline --graph --date-order --all"; + "gl" = "git log"; + "gf" = "git fetch"; + "gur" = "gu --rebase"; + "gu" = "git pull"; + "gpf" = "gp -f"; + "gpa" = "gp --all"; + "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; + "gp" = "git push"; + "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; + "ga" = "git add"; + "gnp" = "git --no-pager"; + "g" = "git"; + "git" = "hub"; + "grim" = "git fetch && git rebase -i origin/master"; + "grc" = "git rebase --continue"; + "gcan" = "git commit --amend --no-edit"; + + # Aliases from old config + stck = "dirs -v"; + b= "cd ~1"; + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../.."; + "....." = "cd ../../../.."; + "http" = "http --style solarized"; + "grep" = "grep $GREP_OPTIONS"; + "bak" = "~/bin/backup.sh"; + "xmm" = "xmodmap ~/.Xmodmap"; + "asdflkj" = "asdf"; + "asdf" = "asdfghjkl"; + "asdfghjkl" = "echo \"Having some trouble?\""; + "ift" = "sudo iftop -i wlp3s0"; + "mytl" = "t tl $TWITTER_WHOAMI"; + "first" = "awk '{print \$$1}'"; + "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; + "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; + "vi" = "vim"; + "adbdev" = "adb devices"; + "adbcon" = "adb connect $GNEX_IP"; + "mpalb" = "mpc search album"; + "mpart" = "mpc search artist"; + "mps" = "mpc search"; + "mpa" = "mpc add"; + "mpt" = "mpc toggle"; + "mpl" = "mpc playlist"; + "dsstore" = "find . -name '*.DS_Store' -type f -ls -delete"; + "df" = "df -h"; + "fs" = "stat -f '%z bytes'"; + "ll" = "ls -al"; + "la" = "ls -a"; + }; +in { home.packages = with pkgs; [ zsh autojump @@ -12,137 +119,17 @@ BROWSER = "firefox"; }; + programs.bash = { + enable = true; + inherit shellAliases; + }; + programs.zsh = { enable = true; enableAutosuggestions = true; autocd = true; - shellAliases = rec { - # NixOS stuff - hms = "home-manager switch"; - nor = "sudo nixos-rebuild switch"; - nrs = nor; - nrb = "sudo nixos-rebuild boot"; - ncg = "nix-collect-garbage"; - vihome = "vim ~/code/system/home/home.nix && home-manager switch"; - virc = "vim ~/code/system/home/modules/shell.nix && home-manager switch && source ~/.zshrc"; - visystem = "sudo vim /etc/nixos/configuration.nix && sudo nixos-rebuild switch"; - - # Nix - ns = "nix-shell"; - nb = "nix build -f ."; - "nc." = "nix copy -f . --to https://nix.urbinternal.com"; - - # Kubernetes - "kc" = "kubectl"; - "kg" = "kc get"; - "kga" = "kc get --all-namespaces"; - "kpd" = "kubectl get pods"; - "kpa" = "kubectl get pods --all-namespaces"; - "klf" = "kubectl logs -f"; - "kdep" = "kubectl get deployments"; - "ked" = "kubectl edit deployment"; - "kpw" = "kubectl get pods -w"; - "kew" = "kubectl get events -w"; - "kdel" = "kubectl delete"; - "knw" = "kubectl get nodes -w"; - "arsy" = "argocd app sync --prune"; - - # Docker and friends - "dcu" = "docker-compose up"; - "dcud" = "docker-compose up -d"; - "dc" = "docker-compose"; - "dcr" = "docker-compose restart"; - "dclf" = "docker-compose logs -f"; - "dck" = "docker"; - "dockerclean" = "dockercleancontainers && dockercleanimages"; - "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; - "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; - - # Git - "gwip" = "git add . && git commit -am wip"; - "gpr" = "g pull-request"; - "gcl" = "git clone"; - "grs" = "gr --soft"; - "grhh" = "grh HEAD"; - "grh" = "gr --hard"; - "gr" = "git reset"; - "gcb" = "gc -b"; - "gco" = "gc"; - "gcd" = "gc development"; - "gcm" = "gc master"; - "gc" = "git checkout"; - "gbg" = "git branch | grep"; - "gba" = "git branch -a"; - "gb" = "git branch"; - "gcv" = "git commit --verbose"; - "gci" = "git commit"; - "gm" = "git merge"; - "gdc" = "gd --cached"; - "gd" = "git diff"; - "gsl" = "git stash list"; - "gss" = "git show stash"; - "gsad" = "git stash drop"; - "gsa" = "git stash"; - "gst" = "gs"; - "gs" = "git status"; - "gg" = "gl --decorate --oneline --graph --date-order --all"; - "gl" = "git log"; - "gf" = "git fetch"; - "gur" = "gu --rebase"; - "gu" = "git pull"; - "gpf" = "gp -f"; - "gpa" = "gp --all"; - "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; - "gp" = "git push"; - "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; - "ga" = "git add"; - "gnp" = "git --no-pager"; - "g" = "git"; - "git" = "hub"; - "grim" = " git fetch && git rebase -i origin/master"; - - # Aliases from old config - stck = "dirs -v"; - b= "cd ~1"; - ".." = "cd .."; - "..." = "cd ../.."; - "...." = "cd ../../.."; - "....." = "cd ../../../.."; - "http" = "http --style solarized"; - "grep" = "grep $GREP_OPTIONS"; - "bak" = "~/bin/backup.sh"; - "xmm" = "xmodmap ~/.Xmodmap"; - "asdflkj" = "asdf"; - "asdf" = "asdfghjkl"; - "asdfghjkl" = "echo \"Having some trouble?\""; - "ift" = "sudo iftop -i wlp3s0"; - "rvpn" = "sudo systemctl restart openvpn@bldr-dev openvpn@lsvl-dev"; - "gne" = "gn edit"; - "gnf" = "gn find"; - "gnt" = "gn tag-list"; - "gnn" = "gn notebook-list"; - "mytl" = "t tl $TWITTER_WHOAMI"; - "first" = "awk '{print \$$1}'"; - "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; - "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; - "vi" = "vim"; - "awa" = "ssh aw2-admin.nomi.host"; - "dtf" = "cd ~/.dotfiles"; - "adbdev" = "adb devices"; - "adbcon" = "adb connect $GNEX_IP"; - "mpalb" = "mpc search album"; - "mpart" = "mpc search artist"; - "mps" = "mpc search"; - "mpa" = "mpc add"; - "mpt" = "mpc toggle"; - "mpl" = "mpc playlist"; - "dsstore" = "find . -name '*.DS_Store' -type f -ls -delete"; - "df" = "df -h"; - "fs" = "stat -f '%z bytes'"; - "ll" = "ls -al"; - "la" = "ls -a"; - }; + inherit shellAliases; oh-my-zsh = { enable = true; @@ -209,6 +196,7 @@ sha256 = "0l41ac5b7p8yyjvpfp438kw7zl9dblrpd7icjg1v3ig3xy87zv0n"; }}/nix-shell.plugin.zsh + export RPS1="" autoload -U promptinit; promptinit prompt pure -- cgit 1.4.1 From 7221955a24fa32ce30cf36ee93cdaadb2390985c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:14:48 -0400 Subject: Emacs needs gnutls --- home/modules/emacs.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index cb78db7febfa..e7543eb1685d 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -28,6 +28,8 @@ in { }) ispell + + gnutls ]; programs.emacs.enable = true; -- cgit 1.4.1 From e2136a9e589d72086536f296b3baae410fa61209 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:14:56 -0400 Subject: Use right keysym for prev --- home/modules/i3.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index e3eea5f7d8d8..eaba0086e401 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -109,7 +109,7 @@ in { # Media "XF86AudioPlay" = "exec playerctl play-pause"; "XF86AudioNext" = "exec playerctl next"; - "XF86AudioPrevious" = "exec playerctl previous"; + "XF86AudioPrev" = "exec playerctl previous"; "XF86AudioRaiseVolume" = "exec pulseaudio-ctl up"; "XF86AudioLowerVolume" = "exec pulseaudio-ctl down"; "XF86AudioMute" = "exec pulseaudio-ctl mute"; -- cgit 1.4.1 From 976ff9bbd3a9eef8d8051d617ef7099f3e0c6390 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:15:03 -0400 Subject: keybinds for enable/disable notifications --- home/modules/i3.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index eaba0086e401..2176d72811fe 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -124,6 +124,10 @@ in { "${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"; }; fonts = [ decorationFont ]; -- cgit 1.4.1 From d22a0381a5f8d9c52d251d3a8e6be08adeb89e4e Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:17:59 -0400 Subject: git config is in development --- home/home.nix | 45 ++++++++++++++++---------------------------- home/modules/development.nix | 6 ++++++ 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/home/home.nix b/home/home.nix index 42f155362e98..af289c8d0bcf 100644 --- a/home/home.nix +++ b/home/home.nix @@ -13,9 +13,11 @@ let machine = ./machines/chupacabra.nix; in ./modules/shell.nix ./modules/tarsnap.nix ./modules/vim.nix - ./modules/alsi.nix + ./modules/lib/cloneRepo.nix + ./modules/urbint + machine ]; @@ -47,6 +49,9 @@ let machine = ./machines/chupacabra.nix; in peek signal-desktop apvlv # pdf viewer + vlc + irssi + gnutls # System utilities htop @@ -60,18 +65,12 @@ let machine = ./machines/chupacabra.nix; in zip tree ncat + unzip # Security gnupg - - # Programming - jq - gitAndTools.hub - gitAndTools.tig - shellcheck - httpie - entr - gnumake + keybase + openssl # Spotify...etc spotify @@ -87,25 +86,6 @@ let machine = ./machines/chupacabra.nix; in nixpkgs.config.allowUnfree = true; - programs.git = { - enable = true; - userEmail = "root@gws.fyi"; - userName = "Griffin Smith"; - ignores = [ - "*.sw*" - ".classpath" - ".project" - ".settings/" - ".dir-locals.el" - ".stack-work-profiling" - ".projectile" - ]; - extraConfig = { - github.user = "glittershark"; - merge.conflictstyle = "diff3"; - }; - }; - programs.password-store.enable = true; services.redshift = { @@ -125,4 +105,11 @@ let machine = ./machines/chupacabra.nix; in services.gpg-agent = { enable = true; }; + + gtk = { + enable = true; + gtk3.bookmarks = [ + "file:///home/grfn/code" + ]; + }; } diff --git a/home/modules/development.nix b/home/modules/development.nix index fecb48f1644b..6403858ff68c 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -21,6 +21,12 @@ sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7"; }) { inherit pkgs; }).yarn2nix julia + (pkgs.callPackage (pkgs.fetchFromGitHub { + owner = "hlolli"; + repo = "clj2nix"; + rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; + sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; + }) {}) ]; programs.git = { -- cgit 1.4.1 From b2d21123139cb37f8c5e31976e72e7beba14ca93 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:18:10 -0400 Subject: macos build machine --- system/modules/common.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index d35298175515..9a09920a8a39 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -103,3 +103,17 @@ autoOptimiseStore = true; }; } + + buildMachines = [{ + hostName = "172.16.0.3"; + sshUser = "griffin"; + sshKey = "/home/grfn/.ssh/id_rsa"; + system = "x86_64-darwin"; + maxJobs = 4; + }]; + + distributedBuilds = true; + + # gc = { + # automatic = true; + # dates = " -- cgit 1.4.1 From 5222b8d15a51d6118b090040a1bfd4d48ffff8c2 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:18:55 -0400 Subject: urbint module --- home/modules/urbint/backend.nix | 22 +++++++++++ home/modules/urbint/common.nix | 79 ++++++++++++++++++++++++++++++++++++++++ home/modules/urbint/default.nix | 8 ++++ home/modules/urbint/frontend.nix | 14 +++++++ 4 files changed, 123 insertions(+) create mode 100644 home/modules/urbint/backend.nix create mode 100644 home/modules/urbint/common.nix create mode 100644 home/modules/urbint/default.nix create mode 100644 home/modules/urbint/frontend.nix diff --git a/home/modules/urbint/backend.nix b/home/modules/urbint/backend.nix new file mode 100644 index 000000000000..ed8a3a3e7a76 --- /dev/null +++ b/home/modules/urbint/backend.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./common.nix + ]; + + home.packages = with pkgs; [ + cloud-sql-proxy + postgresql + jupyter + python3Packages.jupyter_core + redis + ngrok-2 + ]; + + home.file.".ipython/profile_default/ipython_config.py".text = '' + c.InteractiveShellApp.exec_lines = ['%autoreload 2'] + c.InteractiveShellApp.extensions = ['autoreload'] + c.TerminalInteractiveShell.editing_mode = 'vi' + ''; +} diff --git a/home/modules/urbint/common.nix b/home/modules/urbint/common.nix new file mode 100644 index 000000000000..52db4c66629b --- /dev/null +++ b/home/modules/urbint/common.nix @@ -0,0 +1,79 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + aliases = { + cluster = "gcloud container clusters get-credentials"; + vpon = "sudo systemctl start openvpn-urbint.service"; + }; +in +{ + imports = [ ../lib/cloneRepo.nix ]; + + options = { + urbint.projectPath = mkOption { + description = '' + Root path to clone Urbint repos in, relative to your home directory + ''; + type = types.str; + default = "code"; + }; + }; + + config = { + services.lorri.enable = true; + + programs.direnv = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; + + home.packages = with pkgs; [ + docker + docker-compose + skopeo + + kubectl + kubetail + google-cloud-sdk + openvpn + sops + (import {}).argocd + drone-cli + + git + + zoom-us + slack + _1password + ]; + + nixpkgs.config.allowUnfree = true; + + impure.clonedRepos = { + grid = { + github = "urbint/grid"; + path = "${config.urbint.projectPath}/grid"; + }; + + docker-images = { + github = "urbint/docker-images"; + path = "${config.urbint.projectPath}/docker-images"; + }; + + gitops = { + github = "urbint/gitops"; + path = "${config.urbint.projectPath}/gitops"; + }; + }; + + programs.zsh.shellAliases = aliases; + programs.bash.shellAliases = aliases; + + programs.zsh.envExtra = '' + export DRONE_SERVER=https://ci.urbinternal.com + ''; + }; +} diff --git a/home/modules/urbint/default.nix b/home/modules/urbint/default.nix new file mode 100644 index 000000000000..fac57acff701 --- /dev/null +++ b/home/modules/urbint/default.nix @@ -0,0 +1,8 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./frontend.nix + ./backend.nix + ]; +} diff --git a/home/modules/urbint/frontend.nix b/home/modules/urbint/frontend.nix new file mode 100644 index 000000000000..543e9eebc057 --- /dev/null +++ b/home/modules/urbint/frontend.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./common.nix + ]; + + home.packages = with pkgs; [ + yarn + nodejs + clojure + nodePackages.prettier + ]; +} -- cgit 1.4.1 From 21783174014640c9a8ed0784bdd91aac9d84aa8e Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 4 May 2020 13:19:42 -0400 Subject: urbint system module --- system/modules/common.nix | 3 +-- system/modules/urbint.nix | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 system/modules/urbint.nix diff --git a/system/modules/common.nix b/system/modules/common.nix index 9a09920a8a39..3f5023793d0e 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -100,9 +100,8 @@ }; nix = { + trustedUsers = [ "griffin" ]; autoOptimiseStore = true; - }; -} buildMachines = [{ hostName = "172.16.0.3"; diff --git a/system/modules/urbint.nix b/system/modules/urbint.nix new file mode 100644 index 000000000000..4b05175756bc --- /dev/null +++ b/system/modules/urbint.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: +{ + virtualisation.docker.enable = true; + + nix = rec { + binaryCaches = [ "https://nix.urbinternal.com" ]; + trustedBinaryCaches = binaryCaches; + trustedUsers = [ "griffin" ]; + requireSignedBinaryCaches = false; + }; + + services.openvpn.servers.urbint = { + config = '' + config /root/openvpn/urbint.conf + ''; + autoStart = false; + }; +} -- cgit 1.4.1 From 1316d4fccd3e946813b824d04b7d277da6e753aa Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:53:32 -0400 Subject: Don't hardcode wireless interface we have an option for it! Fixes #1 - ty @jskrzypek --- home/modules/i3.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index 2176d72811fe..8b83f880a4dc 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -183,7 +183,7 @@ in { format = "%artist - %album - %title" } - wireless wlp3s0 { + wireless ${config.system.machine.wirelessInterface} { format_up = "W: (%quality - %essid - %bitrate) %ip" format_down = "W: -" } -- cgit 1.4.1 From c6963f8cb5a7995d889c6aacfd5e13510c63844c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:56:09 -0400 Subject: dogfood urbos --- home/home.nix | 4 +- home/modules/urbint/backend.nix | 22 ----------- home/modules/urbint/common.nix | 79 ---------------------------------------- home/modules/urbint/default.nix | 8 ---- home/modules/urbint/frontend.nix | 14 ------- system/modules/common.nix | 2 +- system/modules/urbint.nix | 18 --------- 7 files changed, 2 insertions(+), 145 deletions(-) delete mode 100644 home/modules/urbint/backend.nix delete mode 100644 home/modules/urbint/common.nix delete mode 100644 home/modules/urbint/default.nix delete mode 100644 home/modules/urbint/frontend.nix delete mode 100644 system/modules/urbint.nix diff --git a/home/home.nix b/home/home.nix index af289c8d0bcf..1a4d6e50de9a 100644 --- a/home/home.nix +++ b/home/home.nix @@ -14,9 +14,7 @@ let machine = ./machines/chupacabra.nix; in ./modules/tarsnap.nix ./modules/vim.nix - ./modules/lib/cloneRepo.nix - - ./modules/urbint + ~/code/urb/urbos/home machine ]; diff --git a/home/modules/urbint/backend.nix b/home/modules/urbint/backend.nix deleted file mode 100644 index ed8a3a3e7a76..000000000000 --- a/home/modules/urbint/backend.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - ./common.nix - ]; - - home.packages = with pkgs; [ - cloud-sql-proxy - postgresql - jupyter - python3Packages.jupyter_core - redis - ngrok-2 - ]; - - home.file.".ipython/profile_default/ipython_config.py".text = '' - c.InteractiveShellApp.exec_lines = ['%autoreload 2'] - c.InteractiveShellApp.extensions = ['autoreload'] - c.TerminalInteractiveShell.editing_mode = 'vi' - ''; -} diff --git a/home/modules/urbint/common.nix b/home/modules/urbint/common.nix deleted file mode 100644 index 52db4c66629b..000000000000 --- a/home/modules/urbint/common.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - aliases = { - cluster = "gcloud container clusters get-credentials"; - vpon = "sudo systemctl start openvpn-urbint.service"; - }; -in -{ - imports = [ ../lib/cloneRepo.nix ]; - - options = { - urbint.projectPath = mkOption { - description = '' - Root path to clone Urbint repos in, relative to your home directory - ''; - type = types.str; - default = "code"; - }; - }; - - config = { - services.lorri.enable = true; - - programs.direnv = { - enable = true; - enableBashIntegration = true; - enableZshIntegration = true; - }; - - home.packages = with pkgs; [ - docker - docker-compose - skopeo - - kubectl - kubetail - google-cloud-sdk - openvpn - sops - (import {}).argocd - drone-cli - - git - - zoom-us - slack - _1password - ]; - - nixpkgs.config.allowUnfree = true; - - impure.clonedRepos = { - grid = { - github = "urbint/grid"; - path = "${config.urbint.projectPath}/grid"; - }; - - docker-images = { - github = "urbint/docker-images"; - path = "${config.urbint.projectPath}/docker-images"; - }; - - gitops = { - github = "urbint/gitops"; - path = "${config.urbint.projectPath}/gitops"; - }; - }; - - programs.zsh.shellAliases = aliases; - programs.bash.shellAliases = aliases; - - programs.zsh.envExtra = '' - export DRONE_SERVER=https://ci.urbinternal.com - ''; - }; -} diff --git a/home/modules/urbint/default.nix b/home/modules/urbint/default.nix deleted file mode 100644 index fac57acff701..000000000000 --- a/home/modules/urbint/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - ./frontend.nix - ./backend.nix - ]; -} diff --git a/home/modules/urbint/frontend.nix b/home/modules/urbint/frontend.nix deleted file mode 100644 index 543e9eebc057..000000000000 --- a/home/modules/urbint/frontend.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - ./common.nix - ]; - - home.packages = with pkgs; [ - yarn - nodejs - clojure - nodePackages.prettier - ]; -} diff --git a/system/modules/common.nix b/system/modules/common.nix index 3f5023793d0e..d172ff4a45a3 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -7,8 +7,8 @@ ./fonts.nix ./emacs.nix ./sound.nix - ./urbint.nix ./kernel.nix + /home/grfn/code/urb/urbos/system ]; boot.loader.systemd-boot.enable = true; diff --git a/system/modules/urbint.nix b/system/modules/urbint.nix deleted file mode 100644 index 4b05175756bc..000000000000 --- a/system/modules/urbint.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, pkgs, ... }: -{ - virtualisation.docker.enable = true; - - nix = rec { - binaryCaches = [ "https://nix.urbinternal.com" ]; - trustedBinaryCaches = binaryCaches; - trustedUsers = [ "griffin" ]; - requireSignedBinaryCaches = false; - }; - - services.openvpn.servers.urbint = { - config = '' - config /root/openvpn/urbint.conf - ''; - autoStart = false; - }; -} -- cgit 1.4.1 From 924c51aa1fd963665ed0e9c40d7bbb0025f88a20 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:56:23 -0400 Subject: Add tarsnap config Based on rycee/home-manager#1218 --- home/home.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/home/home.nix b/home/home.nix index 1a4d6e50de9a..c8debbfda8d3 100644 --- a/home/home.nix +++ b/home/home.nix @@ -33,6 +33,9 @@ let machine = ./machines/chupacabra.nix; in # changes in each release. home.stateVersion = "19.09"; + # for when hacking + programs.home-manager.path = "/home/grfn/code/home-manager"; + home.packages = with pkgs; [ (import (fetchTarball "https://github.com/ashkitten/nixpkgs/archive/init-glimpse.tar.gz") {}).glimpse @@ -110,4 +113,11 @@ let machine = ./machines/chupacabra.nix; in "file:///home/grfn/code" ]; }; + + programs.tarsnap = { + enable = true; + keyfile = "/home/grfn/.private/tarsnap.key"; + printStats = true; + humanizeNumbers = true; + }; } -- cgit 1.4.1 From 28489a2141a6ab41285bd6a4f8259b4f621001c9 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:57:12 -0400 Subject: use gitFull now that I figured out why it wasn't working (it was urbos's fault) --- home/modules/development.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/home/modules/development.nix b/home/modules/development.nix index 6403858ff68c..79b4f1251453 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -31,10 +31,7 @@ programs.git = { enable = true; - # bah, this doesn't work - # package = pkgs.git.override { - # sendEmailSupport = true; - # }; + package = pkgs.gitFull; userEmail = "root@gws.fyi"; userName = "Griffin Smith"; ignores = [ -- cgit 1.4.1 From e085facc30503715dc088b0a0c065c9bd424ae1b Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:57:36 -0400 Subject: fix conflict with urbos --- home/modules/development/kube.nix | 2 +- home/modules/emacs.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home/modules/development/kube.nix b/home/modules/development/kube.nix index 58de4b70ed00..916e1cd7a70d 100644 --- a/home/modules/development/kube.nix +++ b/home/modules/development/kube.nix @@ -25,7 +25,7 @@ in kubetail sops kubie - pkgs-unstable.argocd + # pkgs-unstable.argocd # provided by urbos ]; programs.zsh.shellAliases = { diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index e7543eb1685d..80116312e945 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -8,7 +8,7 @@ let # # and packages.el files # }; in { - imports = [ ./lib/cloneRepo.nix ]; + # imports = [ ./lib/cloneRepo.nix ]; # home.packages = [ doom-emacs ]; # home.file.".emacs.d/init.el".text = '' -- cgit 1.4.1 From 5d5ec0f7a170c960ce729e4a61313d98852158ce Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:57:59 -0400 Subject: dwarf-fortress-full --- home/home.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home/home.nix b/home/home.nix index c8debbfda8d3..95096425653c 100644 --- a/home/home.nix +++ b/home/home.nix @@ -79,7 +79,10 @@ let machine = ./machines/chupacabra.nix; in # games crawl - dwarf-fortress + (dwarf-fortress-packages.dwarf-fortress-full.override { + enableIntro = false; + enableFPS = true; + }) # Nix things nix-prefetch-github -- cgit 1.4.1 From 9ab4a9b2e4006fcee396bd21cc9debfd374c902c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:58:16 -0400 Subject: some new aliases and shell config --- home/modules/shell.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 9378490bb6f3..be084793f377 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -14,6 +14,7 @@ let # Nix ns = "nix-shell"; nb = "nix build -f ."; + nc = "nix copy --to https://nix.urbinternal.com"; "nc." = "nix copy -f . --to https://nix.urbinternal.com"; # Docker and friends @@ -71,6 +72,7 @@ let "grim" = "git fetch && git rebase -i origin/master"; "grc" = "git rebase --continue"; "gcan" = "git commit --amend --no-edit"; + "grl" = "git reflog"; # Aliases from old config stck = "dirs -v"; @@ -131,6 +133,11 @@ in { inherit shellAliases; + history = rec { + save = 100000; + size = save; + }; + oh-my-zsh = { enable = true; -- cgit 1.4.1 From 2e03eba922649afc57561d952c83b5182693a793 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 10:58:27 -0400 Subject: git delta config --- home/modules/development.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home/modules/development.nix b/home/modules/development.nix index 79b4f1251453..cde541f5608f 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -47,6 +47,15 @@ github.user = "glittershark"; merge.conflictstyle = "diff3"; }; + + delta = { + enable = true; + options = [ + "--theme 'Solarized (light)'" + "--hunk-style" "plain" + "--commit-style" "box" + ]; + }; }; home.file.".psqlrc".text = '' -- cgit 1.4.1 From 7266a417076eb7e69c8f4f235c640608ed8c624d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 7 May 2020 23:48:21 -0400 Subject: Properly configured dwarf fortress The dwarf fortress packages built into nixpkgs are a little silly and a lot overbearing - do a bunch of hacky substitution to pound them into submission so that I can actually configure stuff like SHOW_FLOW_AMOUNTS and AUTOSAVE, which I feel like I need. --- home/home.nix | 8 +----- home/modules/games.nix | 46 +++++++++++++++++++++++++++++++++++ home/modules/games/dwarf-fortress.nix | 39 +++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 home/modules/games.nix create mode 100644 home/modules/games/dwarf-fortress.nix diff --git a/home/home.nix b/home/home.nix index 95096425653c..213560b095f8 100644 --- a/home/home.nix +++ b/home/home.nix @@ -9,6 +9,7 @@ let machine = ./machines/chupacabra.nix; in ./modules/emacs.nix ./modules/email.nix ./modules/firefox.nix + ./modules/games.nix ./modules/i3.nix ./modules/shell.nix ./modules/tarsnap.nix @@ -77,13 +78,6 @@ let machine = ./machines/chupacabra.nix; in spotify playerctl - # games - crawl - (dwarf-fortress-packages.dwarf-fortress-full.override { - enableIntro = false; - enableFPS = true; - }) - # Nix things nix-prefetch-github ]; diff --git a/home/modules/games.nix b/home/modules/games.nix new file mode 100644 index 000000000000..14b2d1b4b325 --- /dev/null +++ b/home/modules/games.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: + +with pkgs; + +let + + df-orig = dwarf-fortress-packages.dwarf-fortress-original; + + df-full = (dwarf-fortress-packages.dwarf-fortress-full.override { + theme = null; + enableIntro = false; + enableFPS = true; + }); + + 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" {} '' + substitute "${df-orig}/data/init/d_init.txt" $out \ + --replace "[AUTOSAVE:NONE]" "[AUTOSAVE:SEASONAL]" \ + --replace "[AUTOSAVE_PAUSE:NO]" "[AUTOSAVE_PAUSE:YES]" \ + --replace "[INITIAL_SAVE:NO]" "[INITIAL_SAVE:YES]" \ + --replace "[EMBARK_WARNING_ALWAYS:NO]" "[EMBARK_WARNING_ALWAYS:YES]" \ + --replace "[VARIED_GROUND_TILES:YES]" "[VARIED_GROUND_TILES:NO]" \ + --replace "[SHOW_FLOW_AMOUNTS:NO]" "[SHOW_FLOW_AMOUNTS:YES]" + ''; + + df = runCommand "dwarf-fortress" {} '' + mkdir -p $out/bin + sed \ + -e '4icp -f ${init} "$DF_DIR/data/init/init.txt"' \ + -e '4icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \ + < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress" + chmod +x $out/bin/dwarf-fortress + ''; + +in { + home.packages = [ + crawl + df + ]; +} diff --git a/home/modules/games/dwarf-fortress.nix b/home/modules/games/dwarf-fortress.nix new file mode 100644 index 000000000000..8db61456605a --- /dev/null +++ b/home/modules/games/dwarf-fortress.nix @@ -0,0 +1,39 @@ +{ pkgs ? import {}, ... }: + +with pkgs; + +rec { + df-orig = dwarf-fortress-packages.dwarf-fortress-original; + + df-full = (dwarf-fortress-packages.dwarf-fortress-full.override { + theme = null; + enableIntro = false; + enableFPS = true; + }); + + 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" {} '' + substitute "${df-orig}/data/init/d_init.txt" $out \ + --replace "[AUTOSAVE:NONE]" "[AUTOSAVE:SEASONAL]" \ + --replace "[AUTOSAVE_PAUSE:NO]" "[AUTOSAVE_PAUSE:YES]" \ + --replace "[INITIAL_SAVE:NO]" "[INITIAL_SAVE:YES]" \ + --replace "[EMBARK_WARNING_ALWAYS:NO]" "[EMBARK_WARNING_ALWAYS:YES]" \ + --replace "[VARIED_GROUND_TILES:YES]" "[VARIED_GROUND_TILES:NO]" \ + --replace "[SHOW_FLOW_AMOUNTS:NO]" "[SHOW_FLOW_AMOUNTS:YES]" + ''; + + df = runCommand "dwarf-fortress" {} '' + mkdir -p $out/bin + sed \ + -e '2icp -f ${init} "$DF_DIR/data/init/init.txt"' \ + -e '3icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \ + < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress" + ''; + +} -- cgit 1.4.1 From ebc7ec44a26838b430a53cc092c31eac9db02195 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 8 May 2020 10:16:52 -0400 Subject: Add yq --- home/modules/development.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/development.nix b/home/modules/development.nix index cde541f5608f..98f0ac8a8019 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -7,6 +7,7 @@ home.packages = with pkgs; [ jq + yq gitAndTools.hub gitAndTools.tig shellcheck -- cgit 1.4.1 From ed9621a6662bf527aa83af1067ce73bdf7d54317 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 8 May 2020 11:55:54 -0400 Subject: add nix-review --- home/home.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/home.nix b/home/home.nix index 213560b095f8..f0570cf14470 100644 --- a/home/home.nix +++ b/home/home.nix @@ -80,6 +80,7 @@ let machine = ./machines/chupacabra.nix; in # Nix things nix-prefetch-github + nix-review ]; nixpkgs.config.allowUnfree = true; -- cgit 1.4.1 From 02777331ed00a576f39916a4f788b76ce615e916 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 8 May 2020 11:56:40 -0400 Subject: use the right username for trustedUsers --- system/modules/common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/modules/common.nix b/system/modules/common.nix index d172ff4a45a3..fd646aa4a1d3 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -100,7 +100,7 @@ }; nix = { - trustedUsers = [ "griffin" ]; + trustedUsers = [ "grfn" ]; autoOptimiseStore = true; buildMachines = [{ -- cgit 1.4.1 From f8d43c8143ca07e8aecc499e86cba5f114beae55 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 8 May 2020 11:57:15 -0400 Subject: udev rules for ergodox --- system/modules/common.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index fd646aa4a1d3..2aa487cdf1bd 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -116,3 +116,13 @@ # gc = { # automatic = true; # dates = " + }; + + services.udev.extraRules = '' + # UDEV rules for Teensy USB devices + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" + KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" + ''; +} -- cgit 1.4.1 From 83d482f5329f413832661db0eb28f2b8edee93a7 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 8 May 2020 11:57:33 -0400 Subject: urbos config --- system/modules/common.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index 2aa487cdf1bd..1d858e644deb 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -118,6 +118,9 @@ # dates = " }; + urbos.enable = true; + urbos.username = "grfn"; + services.udev.extraRules = '' # UDEV rules for Teensy USB devices ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" -- cgit 1.4.1 From bf0be392810b18b0ada2e91d990b18c761844e1b Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 8 May 2020 11:57:47 -0400 Subject: start ssh agent --- system/modules/common.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index 1d858e644deb..7d940beebb79 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -51,6 +51,8 @@ services.openssh.enable = true; + programs.ssh.startAgent = true; + # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; -- cgit 1.4.1 From c628a0516c293a125d400eb459c110211b766a76 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 10 May 2020 18:40:14 -0400 Subject: finish up dwarf-fortress stuff --- home/modules/games.nix | 20 ++++++++++++------ home/modules/games/dwarf-fortress.nix | 39 ----------------------------------- 2 files changed, 14 insertions(+), 45 deletions(-) delete mode 100644 home/modules/games/dwarf-fortress.nix diff --git a/home/modules/games.nix b/home/modules/games.nix index 14b2d1b4b325..c68342ba6bb7 100644 --- a/home/modules/games.nix +++ b/home/modules/games.nix @@ -30,15 +30,23 @@ let ''; df = runCommand "dwarf-fortress" {} '' - mkdir -p $out/bin - sed \ - -e '4icp -f ${init} "$DF_DIR/data/init/init.txt"' \ - -e '4icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \ - < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress" - chmod +x $out/bin/dwarf-fortress + mkdir -p $out/bin + sed \ + -e '4icp -f ${init} "$DF_DIR/data/init/init.txt"' \ + -e '4icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \ + < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress" + + shopt -s extglob + ln -s ${df-full}/bin/!(dwarf-fortress) $out/bin + + chmod +x $out/bin/dwarf-fortress ''; in { + imports = [ + ./obs.nix + ]; + home.packages = [ crawl df diff --git a/home/modules/games/dwarf-fortress.nix b/home/modules/games/dwarf-fortress.nix deleted file mode 100644 index 8db61456605a..000000000000 --- a/home/modules/games/dwarf-fortress.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ pkgs ? import {}, ... }: - -with pkgs; - -rec { - df-orig = dwarf-fortress-packages.dwarf-fortress-original; - - df-full = (dwarf-fortress-packages.dwarf-fortress-full.override { - theme = null; - enableIntro = false; - enableFPS = true; - }); - - 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" {} '' - substitute "${df-orig}/data/init/d_init.txt" $out \ - --replace "[AUTOSAVE:NONE]" "[AUTOSAVE:SEASONAL]" \ - --replace "[AUTOSAVE_PAUSE:NO]" "[AUTOSAVE_PAUSE:YES]" \ - --replace "[INITIAL_SAVE:NO]" "[INITIAL_SAVE:YES]" \ - --replace "[EMBARK_WARNING_ALWAYS:NO]" "[EMBARK_WARNING_ALWAYS:YES]" \ - --replace "[VARIED_GROUND_TILES:YES]" "[VARIED_GROUND_TILES:NO]" \ - --replace "[SHOW_FLOW_AMOUNTS:NO]" "[SHOW_FLOW_AMOUNTS:YES]" - ''; - - df = runCommand "dwarf-fortress" {} '' - mkdir -p $out/bin - sed \ - -e '2icp -f ${init} "$DF_DIR/data/init/init.txt"' \ - -e '3icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \ - < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress" - ''; - -} -- cgit 1.4.1 From ce868cf2d630a7d29de245f551c1eae3ffd264f4 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 10 May 2020 18:40:41 -0400 Subject: obs, with input-overlay plugin --- home/modules/obs.nix | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 home/modules/obs.nix diff --git a/home/modules/obs.nix b/home/modules/obs.nix new file mode 100644 index 000000000000..d1dade477ccc --- /dev/null +++ b/home/modules/obs.nix @@ -0,0 +1,66 @@ +{ config, lib, pkgs, ... }: + +with pkgs; + +let + libuiohook = stdenv.mkDerivation rec { + pname = "libuiohook"; + version = "1.1"; + src = fetchFromGitHub { + owner = "kwhat"; + repo = "libuiohook"; + rev = version; + sha256 = "1isfxn3cfrdqq22d3mlz2lzm4asf9gprs7ww2xy9c3j3srk9kd7r"; + }; + + preConfigure = '' + ./bootstrap.sh + ''; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + libtool autoconf automake + x11 + xorg.libXtst + xorg.libXinerama + xorg.libxkbfile + libxkbcommon + ]; + }; + + obs-input-overlay = stdenv.mkDerivation rec { + pname = "obs-input-overlay"; + version = "4.8"; + src = fetchFromGitHub { + owner = "univrsal"; + repo = "input-overlay"; + rev = "v${version}"; + sha256 = "1dklg0dx9ijwyhgwcaqz859rbpaivmqxqvh9w3h4byrh5pnkz8bf"; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ obs-studio libuiohook ]; + + postPatch = '' + sed -i CMakeLists.txt \ + -e '2iinclude(${obs-studio.src}/cmake/Modules/ObsHelpers.cmake)' \ + -e '2ifind_package(LibObs REQUIRED)' + ''; + + cmakeFlags = [ + "-Wno-dev" + ]; + }; +in +{ + home.packages = [ + obs-studio + obs-input-overlay + ]; + + xdg.configFile."obs-studio/plugins/input-overlay/bin/64bit/input-overlay.so".source = + "${obs-input-overlay}/lib/obs-plugins/input-overlay.so"; + xdg.configFile."obs-studio/plugins/input-overlay/data".source = + "${obs-input-overlay}/share/obs/obs-plugins/input-overlay"; +} -- cgit 1.4.1 From 16faaa22921a5e186cd59700288aea21f1038029 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 10 May 2020 18:40:54 -0400 Subject: install pandoc --- home/home.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/home.nix b/home/home.nix index f0570cf14470..39fc1f14293b 100644 --- a/home/home.nix +++ b/home/home.nix @@ -54,6 +54,7 @@ let machine = ./machines/chupacabra.nix; in vlc irssi gnutls + pandoc # System utilities htop -- cgit 1.4.1 From 3ae2b02e8f12c516af1debf1e304f3d377142881 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 10 May 2020 18:41:11 -0400 Subject: beginning of setup for haskell dev just some aliases cribbed from old config + cachix, for now --- home/home.nix | 1 + home/modules/development.nix | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/home/home.nix b/home/home.nix index 39fc1f14293b..5dd9b8a6b77e 100644 --- a/home/home.nix +++ b/home/home.nix @@ -82,6 +82,7 @@ let machine = ./machines/chupacabra.nix; in # Nix things nix-prefetch-github nix-review + cachix ]; nixpkgs.config.allowUnfree = true; diff --git a/home/modules/development.nix b/home/modules/development.nix index 98f0ac8a8019..1b38157d4deb 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -85,4 +85,12 @@ set editing-mode vi ''; }; + + programs.zsh.shellAliases = { + # Haskell + "cnb" = "cabal new-build"; + "cob" = "cabal old-build"; + "cnr" = "cabal new-run"; + "cor" = "cabal old-run"; + }; } -- cgit 1.4.1 From 1f0f282e76ab71ac9d46d3fb984832c9d5fdcbfd Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 10 May 2020 18:41:53 -0400 Subject: use emacsUnstable (27) --- system/modules/emacs.nix | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/system/modules/emacs.nix b/system/modules/emacs.nix index 1cfa2b07452c..480711b97853 100644 --- a/system/modules/emacs.nix +++ b/system/modules/emacs.nix @@ -1,23 +1,41 @@ { config, pkgs, lib, ... }: with lib; { - options.programs.emacs.useGit = mkOption { - description = "Use emacs from git"; - type = types.bool; - default = false; + options = { + programs.emacs.useGit = mkOption { + description = "Use emacs from git"; + type = types.bool; + default = false; + }; + + programs.emacs.useUnstable = mkOption { + description = "Use emacs unstable"; + type = types.bool; + default = false; + }; }; config = { - nixpkgs.overlays = if config.programs.emacs.useGit then [] else [ - (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)) + nixpkgs.overlays = [ + (import (builtins.fetchTarball { + url = "https://github.com/nix-community/emacs-overlay/archive/54afb061bdd12c61bbfcc13bad98b7a3aab7d8d3.tar.gz"; + sha256 = "0hrbg65d5h0cb0nky7a46md7vlvhajq1hf0328l2f7ln9hznqz6j"; + })) ]; environment.systemPackages = with pkgs; [ - (if config.programs.emacs.useGit then emacsGit else emacs) + (if config.programs.emacs.useGit + then emacsGit + else + if config.programs.emacs.useUnstable + then emacsUnstable + else emacs) ripgrep coreutils fd clang ]; + + programs.emacs.useUnstable = true; }; } -- cgit 1.4.1 From 765e7b5cc6cea6c8bbb47c82db4addcd65eea64d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 11 May 2020 11:14:59 -0400 Subject: hoogle alias --- home/modules/development.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/development.nix b/home/modules/development.nix index 1b38157d4deb..3417b212618a 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -92,5 +92,6 @@ "cob" = "cabal old-build"; "cnr" = "cabal new-run"; "cor" = "cabal old-run"; + "ho" = "hoogle"; }; } -- cgit 1.4.1 From 3e8f0eeeec8708f9e5521333bc6884de8fa2067b Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 11 May 2020 11:15:10 -0400 Subject: Use emacsUnstable (27) also doing this in home rather than system --- home/modules/emacs.nix | 16 +++++++++++++++- system/modules/common.nix | 1 - system/modules/emacs.nix | 41 ----------------------------------------- 3 files changed, 15 insertions(+), 43 deletions(-) delete mode 100644 system/modules/emacs.nix diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index 80116312e945..71d7cbf70efe 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -29,10 +29,24 @@ in { ispell + ripgrep + coreutils + fd + clang gnutls ]; - programs.emacs.enable = true; + nixpkgs.overlays = [ + (import (builtins.fetchTarball { + url = "https://github.com/nix-community/emacs-overlay/archive/54afb061bdd12c61bbfcc13bad98b7a3aab7d8d3.tar.gz"; + sha256 = "0hrbg65d5h0cb0nky7a46md7vlvhajq1hf0328l2f7ln9hznqz6j"; + })) + ]; + + programs.emacs = { + enable = true; + package = pkgs.emacsUnstable; + }; impure.clonedRepos = { orgClubhouse = { diff --git a/system/modules/common.nix b/system/modules/common.nix index 7d940beebb79..74e7729ef350 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -5,7 +5,6 @@ [ ./xserver.nix ./fonts.nix - ./emacs.nix ./sound.nix ./kernel.nix /home/grfn/code/urb/urbos/system diff --git a/system/modules/emacs.nix b/system/modules/emacs.nix deleted file mode 100644 index 480711b97853..000000000000 --- a/system/modules/emacs.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -{ - options = { - programs.emacs.useGit = mkOption { - description = "Use emacs from git"; - type = types.bool; - default = false; - }; - - programs.emacs.useUnstable = mkOption { - description = "Use emacs unstable"; - type = types.bool; - default = false; - }; - }; - - config = { - nixpkgs.overlays = [ - (import (builtins.fetchTarball { - url = "https://github.com/nix-community/emacs-overlay/archive/54afb061bdd12c61bbfcc13bad98b7a3aab7d8d3.tar.gz"; - sha256 = "0hrbg65d5h0cb0nky7a46md7vlvhajq1hf0328l2f7ln9hznqz6j"; - })) - ]; - - environment.systemPackages = with pkgs; [ - (if config.programs.emacs.useGit - then emacsGit - else - if config.programs.emacs.useUnstable - then emacsUnstable - else emacs) - ripgrep - coreutils - fd - clang - ]; - - programs.emacs.useUnstable = true; - }; -} -- cgit 1.4.1 From b374cfc71149b05c1e79c518e7d60c3c24fe84e8 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 14 May 2020 18:04:17 -0400 Subject: install lm_sensors --- system/modules/common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index 74e7729ef350..3bac19becde7 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -34,6 +34,7 @@ w3m libnotify file + lm_sensors ]; # Some programs need SUID wrappers, can be configured further or are -- cgit 1.4.1 From caa82ab48788bdf6859380fcb9b8bbb3feb15da2 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 18 May 2020 10:25:23 -0400 Subject: barrier, nixfmt --- home/home.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/home.nix b/home/home.nix index 5dd9b8a6b77e..42debbfc3494 100644 --- a/home/home.nix +++ b/home/home.nix @@ -55,6 +55,7 @@ let machine = ./machines/chupacabra.nix; in irssi gnutls pandoc + barrier # System utilities htop @@ -80,6 +81,7 @@ let machine = ./machines/chupacabra.nix; in playerctl # Nix things + nixfmt nix-prefetch-github nix-review cachix -- cgit 1.4.1 From 269486fd272b3bcc724dcca7c4b6448f1c0975a2 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 18 May 2020 20:19:39 -0400 Subject: automatic gc weekly, delete older than 30d --- system/modules/common.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system/modules/common.nix b/system/modules/common.nix index 3bac19becde7..230652c3da7b 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -115,9 +115,11 @@ distributedBuilds = true; - # gc = { - # automatic = true; - # dates = " + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; }; urbos.enable = true; -- cgit 1.4.1 From 86b5f58ca51bfb91de4cd29e66b781d5e035db7a Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 18 May 2020 20:19:57 -0400 Subject: bring back i3 restart shortcut home-manager switch is too slow, plus I want it in the foreground --- home/modules/i3.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/modules/i3.nix b/home/modules/i3.nix index 8b83f880a4dc..36f2d450edd5 100644 --- a/home/modules/i3.nix +++ b/home/modules/i3.nix @@ -76,7 +76,7 @@ in { "${mod}+f" = "fullscreen"; - "${mod}+Shift+r" = "exec home-manager switch"; + "${mod}+Shift+r" = "restart"; "${mod}+r" = "mode resize"; -- cgit 1.4.1 From 9036dc7c32739d302cdd6fe51fe2d01418a99c9d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 10:43:19 -0400 Subject: Beginnings of config for Darwin machines Split out a platforms/ directory with a linux.nix and darwin.nix, and starting splitting things out between the two --- home/home.nix | 107 +------------------------------------------ home/machines/chupacabra.nix | 7 +++ home/machines/dobharchu.nix | 17 +++++++ home/modules/alsi.nix | 41 ++++++++++++----- home/modules/common.nix | 38 +++++++++++++++ home/modules/development.nix | 6 ++- home/modules/emacs.nix | 106 ++++++++++++++++++++++-------------------- home/modules/games.nix | 22 +++++---- home/platforms/darwin.nix | 24 ++++++++++ home/platforms/linux.nix | 103 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 294 insertions(+), 177 deletions(-) create mode 100644 home/machines/dobharchu.nix create mode 100644 home/modules/common.nix create mode 100644 home/platforms/darwin.nix create mode 100644 home/platforms/linux.nix diff --git a/home/home.nix b/home/home.nix index 42debbfc3494..39045c147d76 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,28 +1,12 @@ { config, pkgs, ... }: -let machine = ./machines/chupacabra.nix; in { imports = [ - ./modules/alacritty.nix - ./modules/alsi.nix - ./modules/development.nix - ./modules/emacs.nix - ./modules/email.nix - ./modules/firefox.nix - ./modules/games.nix - ./modules/i3.nix - ./modules/shell.nix - ./modules/tarsnap.nix - ./modules/vim.nix - - ~/code/urb/urbos/home - - machine + (throw "Pick a machine from ./machines") ]; # Let Home Manager install and manage itself. programs.home-manager.enable = true; - xsession.enable = true; # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage @@ -33,93 +17,4 @@ let machine = ./machines/chupacabra.nix; in # the Home Manager release notes for a list of state version # changes in each release. home.stateVersion = "19.09"; - - # for when hacking - programs.home-manager.path = "/home/grfn/code/home-manager"; - - home.packages = with pkgs; [ - (import (fetchTarball "https://github.com/ashkitten/nixpkgs/archive/init-glimpse.tar.gz") {}).glimpse - - # Desktop stuff - arandr - firefox - feh - chromium - xclip - xorg.xev - picom - peek - signal-desktop - apvlv # pdf viewer - vlc - irssi - gnutls - pandoc - barrier - - # System utilities - htop - powertop - usbutils - pciutils - killall - gdmap - bind - lsof - zip - tree - ncat - unzip - - # Security - gnupg - keybase - openssl - - # Spotify...etc - spotify - playerctl - - # Nix things - nixfmt - nix-prefetch-github - nix-review - cachix - ]; - - nixpkgs.config.allowUnfree = true; - - programs.password-store.enable = true; - - services.redshift = { - enable = true; - provider = "geoclue2"; - }; - - services.pasystray.enable = true; - - impure.clonedRepos.passwordStore = { - github = "glittershark/pass"; - path = ".local/share/password-store"; - }; - - urbint.projectPath = "code/urb"; - - services.gpg-agent = { - enable = true; - }; - - gtk = { - enable = true; - gtk3.bookmarks = [ - "file:///home/grfn/code" - ]; - }; - - programs.tarsnap = { - enable = true; - keyfile = "/home/grfn/.private/tarsnap.key"; - printStats = true; - humanizeNumbers = true; - }; } diff --git a/home/machines/chupacabra.nix b/home/machines/chupacabra.nix index c0d1fce431fb..86be9b361ddf 100644 --- a/home/machines/chupacabra.nix +++ b/home/machines/chupacabra.nix @@ -2,6 +2,13 @@ let laptopKeyboardId = "25"; in { + imports = [ + ../platforms/linux.nix + + ../modules/common.nix + ../modules/games.nix + ]; + system.machine = { wirelessInterface = "wlp59s0"; i3FontSize = 9; diff --git a/home/machines/dobharchu.nix b/home/machines/dobharchu.nix new file mode 100644 index 000000000000..0b8503a00e98 --- /dev/null +++ b/home/machines/dobharchu.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../platforms/darwin.nix + ../modules/common.nix + ../modules/games.nix + ]; + + home.packages = with pkgs; [ + coreutils + gnupg + nix-prefetch-github + pass + pinentry_mac + ]; +} diff --git a/home/modules/alsi.nix b/home/modules/alsi.nix index cb9802e2ceea..e42524bb8884 100644 --- a/home/modules/alsi.nix +++ b/home/modules/alsi.nix @@ -1,29 +1,30 @@ { config, lib, pkgs, ... }: -let alsi = pkgs.callPackage ../../pkgs/alsi {}; +let alsi = pkgs.callPackage ~/code/system/pkgs/alsi {}; in { home.packages = [ alsi ]; - home.file.".config/alsi/alsi.logo" = { + xdg.configFile."alsi/alsi.logo" = { source = ./nixos-logo.txt; force = true; }; - home.file.".config/alsi/alsi.conf" = { + xdg.configFile."alsi/alsi.conf" = { + force = true; text = '' #!${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", + COLORS_FILE => "/${config.home.homeDirectory}/.config/alsi/alsi.colors", + DE_FILE => "/${config.home.homeDirectory}/.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", + GTK2_RC_FILE => "/${config.home.homeDirectory}/.gtkrc-2.0", + GTK3_RC_FILE => "/${config.home.homeDirectory}/.config/gtk-3.0/settings.ini", + LOGO_FILE => "/${config.home.homeDirectory}/.config/alsi/alsi.logo", + OUTPUT_FILE => "/${config.home.homeDirectory}/.config/alsi/alsi.output", # PACKAGES_PATH => "/var/lib/pacman/local/", PS_COMMAND => "ps -A", USAGE_COLORS => 0, @@ -33,9 +34,27 @@ in USAGE_PRECENT_YELLOW => 85, USE_LOGO_FROM_FILE => 1, USE_VALUES_COLOR => 0, - WM_FILE => "/home/grfn/.config/alsi/alsi.wm", + WM_FILE => "/${config.home.homeDirectory}/.config/alsi/alsi.wm", } ''; - force = true; }; + + xdg.configFile."alsi/alsi.colors".text = '' + #!${pkgs.perl}/bin/perl + + # Colors for alsi + + scalar { + black => {normal => "\e[0;30m", bold => "\e[1;30m"}, + red => {normal => "\e[0;31m", bold => "\e[1;31m"}, + green => {normal => "\e[0;32m", bold => "\e[1;32m"}, + yellow => {normal => "\e[0;33m", bold => "\e[1;33m"}, + default => {normal => "\e[0;34m", bold => "\e[1;34m"}, + blue => {normal => "\e[0;34m", bold => "\e[1;34m"}, + purple => {normal => "\e[0;35m", bold => "\e[1;35m"}, + cyan => {normal => "\e[0;36m", bold => "\e[1;36m"}, + white => {normal => "\e[0;37m", bold => "\e[1;37m"}, + reset => "\e[0m", + } + ''; } diff --git a/home/modules/common.nix b/home/modules/common.nix new file mode 100644 index 000000000000..ad712a335bcd --- /dev/null +++ b/home/modules/common.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../modules/shell.nix + ../modules/development.nix + ../modules/emacs.nix + ../modules/vim.nix + ../modules/tarsnap.nix + ]; + + nixpkgs.config.allowUnfree = true; + programs.password-store.enable = true; + + impure.clonedRepos.passwordStore = { + github = "glittershark/pass"; + path = ".local/share/password-store"; + }; + + home.packages = with pkgs; [ + htop + killall + bind + zip unzip + tree + ncat + + gnupg + keybase + openssl + + # Nix things + nixfmt + nix-prefetch-github + nix-review + cachix + ]; +} diff --git a/home/modules/development.nix b/home/modules/development.nix index 3417b212618a..5e17a7a925ab 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -1,5 +1,7 @@ { config, lib, pkgs, ... }: +with lib; + { imports = [ ./development/kube.nix @@ -21,14 +23,14 @@ rev = "9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae"; sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7"; }) { inherit pkgs; }).yarn2nix - julia (pkgs.callPackage (pkgs.fetchFromGitHub { owner = "hlolli"; repo = "clj2nix"; rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; }) {}) - ]; + ] ++ + optional (stdenv.isLinux) julia; programs.git = { enable = true; diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index 71d7cbf70efe..2a4babf5e1d2 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -1,5 +1,7 @@ { pkgs, lib, ... }: +with lib; + let # doom-emacs = pkgs.callPackage (builtins.fetchTarball { # url = https://github.com/vlaci/nix-doom-emacs/archive/master.tar.gz; @@ -8,7 +10,7 @@ let # # and packages.el files # }; in { - # imports = [ ./lib/cloneRepo.nix ]; + imports = [ ./lib/cloneRepo.nix ]; # home.packages = [ doom-emacs ]; # home.file.".emacs.d/init.el".text = '' @@ -16,61 +18,67 @@ in { # ''; # - home.packages = with pkgs; [ - # haskellPackages.Agda BROKEN + config = mkMerge [ + { + home.packages = with pkgs; [ + haskellPackages.Agda - # LaTeX (for org export) - (pkgs.texlive.combine { - inherit (pkgs.texlive) - scheme-basic collection-fontsrecommended ulem - fncychap titlesec tabulary varwidth framed fancyvrb float parskip - wrapfig upquote capt-of needspace; - }) + # LaTeX (for org export) + (pkgs.texlive.combine { + inherit (pkgs.texlive) + scheme-basic collection-fontsrecommended ulem + fncychap titlesec tabulary varwidth framed fancyvrb float parskip + wrapfig upquote capt-of needspace; + }) - ispell + ispell - ripgrep - coreutils - fd - clang - gnutls - ]; + ripgrep + coreutils + fd + clang + gnutls + ]; - nixpkgs.overlays = [ - (import (builtins.fetchTarball { - url = "https://github.com/nix-community/emacs-overlay/archive/54afb061bdd12c61bbfcc13bad98b7a3aab7d8d3.tar.gz"; - sha256 = "0hrbg65d5h0cb0nky7a46md7vlvhajq1hf0328l2f7ln9hznqz6j"; - })) - ]; + nixpkgs.overlays = [ + (import (builtins.fetchTarball { + url = "https://github.com/nix-community/emacs-overlay/archive/54afb061bdd12c61bbfcc13bad98b7a3aab7d8d3.tar.gz"; + sha256 = "0hrbg65d5h0cb0nky7a46md7vlvhajq1hf0328l2f7ln9hznqz6j"; + })) + ]; - programs.emacs = { - enable = true; - package = pkgs.emacsUnstable; - }; + programs.emacs = { + enable = true; + package = pkgs.emacsUnstable; + }; - impure.clonedRepos = { - orgClubhouse = { - github = "glittershark/org-clubhouse"; - path = "code/org-clubhouse"; - }; + impure.clonedRepos = { + orgClubhouse = { + github = "glittershark/org-clubhouse"; + path = "code/org-clubhouse"; + }; - doomEmacs = { - github = "hlissner/doom-emacs"; - path = ".emacs.d"; - after = ["emacs.d"]; - onClone = "bin/doom install"; - }; + doomEmacs = { + github = "hlissner/doom-emacs"; + path = ".emacs.d"; + after = ["emacs.d"]; + onClone = "bin/doom install"; + }; - "emacs.d" = { - github = "glittershark/emacs.d"; - path = ".doom.d"; - after = ["orgClubhouse"]; - }; - }; + "emacs.d" = { + github = "glittershark/emacs.d"; + path = ".doom.d"; + after = ["orgClubhouse"]; + }; + }; - # Notes - services.syncthing = { - enable = true; - tray = true; - }; + } + (mkIf pkgs.stdenv.isLinux { + # Notes + services.syncthing = { + enable = true; + tray = true; + }; + }) + ]; } diff --git a/home/modules/games.nix b/home/modules/games.nix index c68342ba6bb7..a9adf9c91036 100644 --- a/home/modules/games.nix +++ b/home/modules/games.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: with pkgs; +with lib; let @@ -42,13 +43,16 @@ let chmod +x $out/bin/dwarf-fortress ''; -in { - imports = [ - ./obs.nix - ]; +in mkMerge [ + { + home.packages = [ + crawl + ]; + } + (mkIf stdenv.isLinux { + home.packages = [ + df + ]; + }) +] - home.packages = [ - crawl - df - ]; -} diff --git a/home/platforms/darwin.nix b/home/platforms/darwin.nix new file mode 100644 index 000000000000..d6b33ba5625c --- /dev/null +++ b/home/platforms/darwin.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + home.packages = with pkgs; [ + coreutils + gnupg + pinentry_mac + ]; + + home.activation.linkApplications = lib.hm.dag.entryAfter ["writeBoundary"] '' + $DRY_RUN_CMD ln -sf $VERBOSE_ARG \ + ~/.nix-profile/Applications/* ~/Applications/ + ''; + + programs.zsh.initExtra = '' + export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH + + if [[ "$TERM" == "alacritty" ]]; then + export TERM="xterm-256color" + fi + ''; +} diff --git a/home/platforms/linux.nix b/home/platforms/linux.nix new file mode 100644 index 000000000000..b49193442b07 --- /dev/null +++ b/home/platforms/linux.nix @@ -0,0 +1,103 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../modules/alacritty.nix + ../modules/alsi.nix + ../modules/development.nix + ../modules/emacs.nix + ../modules/email.nix + ../modules/firefox.nix + ../modules/games.nix + ../modules/obs.nix + ../modules/i3.nix + ../modules/shell.nix + ../modules/tarsnap.nix + ../modules/vim.nix + + ~/code/urb/urbos/home + + machine + ]; + + xsession.enable = true; + + home.packages = with pkgs; [ + (import (fetchTarball "https://github.com/ashkitten/nixpkgs/archive/init-glimpse.tar.gz") {}).glimpse + + # Desktop stuff + arandr + firefox + feh + chromium + xclip + xorg.xev + picom + peek + signal-desktop + apvlv # pdf viewer + vlc + irssi + gnutls + pandoc + barrier + + # System utilities + powertop + usbutils + pciutils + gdmap + lsof + tree + ncat + + # Security + gnupg + keybase + openssl + + # Spotify...etc + spotify + playerctl + ]; + + nixpkgs.config.allowUnfree = true; + + programs.password-store.enable = true; + + services.redshift = { + enable = true; + provider = "geoclue2"; + }; + + services.pasystray.enable = true; + + impure.clonedRepos.passwordStore = { + github = "glittershark/pass"; + path = ".local/share/password-store"; + }; + + urbint.projectPath = "code/urb"; + + services.gpg-agent = { + enable = true; + }; + + gtk = { + enable = true; + gtk3.bookmarks = [ + "file:///home/grfn/code" + ]; + }; + + programs.tarsnap = { + enable = true; + keyfile = "/home/grfn/.private/tarsnap.key"; + printStats = true; + humanizeNumbers = true; + }; + + programs.zsh.initExtra = '' + [[ ! $IN_NIX_SHELL ]] && alsi -l + ''; +} -- cgit 1.4.1 From 82c0404c4fccc163fab4efa11f0fb8986de8858d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 10:44:00 -0400 Subject: Make Tramp work per https://wxchen.wordpress.com/2012/05/20/getting-tramp-in-emacs-to-work-with-zsh-as-default-shell/, make the PS1 etc. properly work with Tramp so I can edit stuff over ssh (it's working quite well) --- home/modules/shell.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index be084793f377..69672473af23 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -207,7 +207,14 @@ in { autoload -U promptinit; promptinit prompt pure - [[ ! $IN_NIX_SHELL ]] && alsi -l + if [[ "$TERM" == "dumb" ]]; then + unsetopt zle + unsetopt prompt_cr + unsetopt prompt_subst + unfunction precmd + unfunction preexec + export PS1='$ ' + fi ''; }; -- cgit 1.4.1 From 0e9a2388bf9e1a3258b19ebd00da0a804875ad10 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 10:29:39 -0400 Subject: Start of an RTL-SDR module --- home/machines/chupacabra.nix | 1 + home/modules/rtlsdr.nix | 21 +++++++++++++++++++++ system/modules/common.nix | 1 + system/modules/rtlsdr.nix | 17 +++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 home/modules/rtlsdr.nix create mode 100644 system/modules/rtlsdr.nix diff --git a/home/machines/chupacabra.nix b/home/machines/chupacabra.nix index 86be9b361ddf..69d1c604a63a 100644 --- a/home/machines/chupacabra.nix +++ b/home/machines/chupacabra.nix @@ -7,6 +7,7 @@ in { ../modules/common.nix ../modules/games.nix + ../modules/rtlsdr.nix ]; system.machine = { diff --git a/home/modules/rtlsdr.nix b/home/modules/rtlsdr.nix new file mode 100644 index 000000000000..a1c717617a62 --- /dev/null +++ b/home/modules/rtlsdr.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: + +let + + nixpkgs-gnuradio = import (pkgs.fetchFromGitHub { + owner = "doronbehar"; + repo = "nixpkgs"; + rev = "712561aa5f10bfe6112a1726a912585612a70d1f"; + sha256 = "04yqflbwjcfl9vlplphpj82csqqz9k6m3nj1ybhwgmsc4by7vivl"; + }) {}; + +in + +{ + home.packages = with pkgs; [ + rtl-sdr + nixpkgs-gnuradio.gnuradio + nixpkgs-gnuradio.gnuradio.plugins.osmosdr + nixpkgs-gnuradio.gqrx + ]; +} diff --git a/system/modules/common.nix b/system/modules/common.nix index 230652c3da7b..c505d0d5dcd7 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -7,6 +7,7 @@ ./fonts.nix ./sound.nix ./kernel.nix + ./rtlsdr.nix /home/grfn/code/urb/urbos/system ]; diff --git a/system/modules/rtlsdr.nix b/system/modules/rtlsdr.nix new file mode 100644 index 000000000000..ce58ebb0dcda --- /dev/null +++ b/system/modules/rtlsdr.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +{ + + environment.systemPackages = with pkgs; [ + rtl-sdr + ]; + + services.udev.packages = with pkgs; [ + rtl-sdr + ]; + + # blacklist for rtl-sdr + boot.blacklistedKernelModules = [ + "dvb_usb_rtl28xxu" + ]; +} -- cgit 1.4.1 From 9b2dd5c20fec6ca76adb470374ccea0f7c944233 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 11:27:20 -0400 Subject: break out an urbint development module --- home/modules/development.nix | 40 ++++++++++++++++----------------- home/modules/development/urbint.nix | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 20 deletions(-) create mode 100644 home/modules/development/urbint.nix diff --git a/home/modules/development.nix b/home/modules/development.nix index 5e17a7a925ab..326193f61444 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -1,10 +1,22 @@ { config, lib, pkgs, ... }: +let + + clj2nix = pkgs.callPackage (pkgs.fetchFromGitHub { + owner = "hlolli"; + repo = "clj2nix"; + rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; + sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; + }) {}; + +in + with lib; { imports = [ ./development/kube.nix + ./development/urbint.nix ]; home.packages = with pkgs; [ @@ -17,20 +29,14 @@ with lib; entr gnumake inetutils - (import (pkgs.fetchFromGitHub { - owner = "moretea"; - repo = "yarn2nix"; - rev = "9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae"; - sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7"; - }) { inherit pkgs; }).yarn2nix - (pkgs.callPackage (pkgs.fetchFromGitHub { - owner = "hlolli"; - repo = "clj2nix"; - rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383"; - sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; - }) {}) - ] ++ - optional (stdenv.isLinux) julia; + + clj2nix + + haskellPackages.Agda + AgdaStdlib + + (import ../pkgs/clang-tools { inherit pkgs; }) + ] ++ optional (stdenv.isLinux) julia; programs.git = { enable = true; @@ -75,12 +81,6 @@ with lib; \unset QUIET ''; - home.file.".ipython/profile_default/ipython_config.py".text = '' - c.InteractiveShellApp.exec_lines = ['%autoreload 2'] - c.InteractiveShellApp.extensions = ['autoreload'] - c.TerminalInteractiveShell.editing_mode = 'vi' - ''; - programs.readline = { enable = true; extraConfig = '' diff --git a/home/modules/development/urbint.nix b/home/modules/development/urbint.nix new file mode 100644 index 000000000000..6958e3155b58 --- /dev/null +++ b/home/modules/development/urbint.nix @@ -0,0 +1,45 @@ +# urbint-only dev stuff +{ config, lib, pkgs, ... }: + +let + + yarn2nix = (import (pkgs.fetchFromGitHub { + owner = "moretea"; + repo = "yarn2nix"; + rev = "9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae"; + sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7"; + }) { inherit pkgs; }).yarn2nix; + +in + +{ + home.packages = with pkgs; [ + yarn2nix + python36 + python36Packages.ipython + ]; + + programs.zsh = { + shellAliases = { + ipy = "ipython"; + amerge = "alembic merge heads"; + }; + + initExtra = '' + # Alembic {{{ + function aup() { + alembic upgrade ''${1:-head} + } + + function adown() { + alembic downgrade ''${1:--1} + } + ''; + }; + + home.file.".ipython/profile_default/ipython_config.py".text = '' + c.InteractiveShellApp.exec_lines = ['%autoreload 2'] + c.InteractiveShellApp.extensions = ['autoreload'] + c.TerminalInteractiveShell.editing_mode = 'vi' + ''; +} -- cgit 1.4.1 From 0275aaec03149b641ef2d6516cad20bddcce6bb5 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 11:27:54 -0400 Subject: some adjustments to per-platform config --- home/machines/chupacabra.nix | 8 +++++++- home/modules/common.nix | 11 ++++++++++- home/modules/emacs.nix | 2 +- home/modules/lib/cloneRepo.nix | 4 ++-- home/platforms/linux.nix | 15 --------------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/home/machines/chupacabra.nix b/home/machines/chupacabra.nix index 69d1c604a63a..06b0d21567bb 100644 --- a/home/machines/chupacabra.nix +++ b/home/machines/chupacabra.nix @@ -4,12 +4,16 @@ let in { imports = [ ../platforms/linux.nix - ../modules/common.nix ../modules/games.nix ../modules/rtlsdr.nix + + ~/code/urb/urbos/home ]; + # for when hacking + programs.home-manager.path = "/home/grfn/code/home-manager"; + system.machine = { wirelessInterface = "wlp59s0"; i3FontSize = 9; @@ -36,4 +40,6 @@ in { ); }; }; + + urbint.projectPath = "code/urb"; } diff --git a/home/modules/common.nix b/home/modules/common.nix index ad712a335bcd..72107a459fc2 100644 --- a/home/modules/common.nix +++ b/home/modules/common.nix @@ -1,5 +1,7 @@ { config, lib, pkgs, ... }: +# Everything in here needs to work on linux or darwin + { imports = [ ../modules/shell.nix @@ -7,17 +9,23 @@ ../modules/emacs.nix ../modules/vim.nix ../modules/tarsnap.nix + ../modules/lib/cloneRepo.nix ]; nixpkgs.config.allowUnfree = true; + programs.password-store.enable = true; - impure.clonedRepos.passwordStore = { + grfn.impure.clonedRepos.passwordStore = { github = "glittershark/pass"; path = ".local/share/password-store"; }; + urbint.projectPath = "code/urb"; + home.packages = with pkgs; [ + # System utilities + bat htop killall bind @@ -25,6 +33,7 @@ tree ncat + # Security gnupg keybase openssl diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index 2a4babf5e1d2..b6b8994638df 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -52,7 +52,7 @@ in { package = pkgs.emacsUnstable; }; - impure.clonedRepos = { + grfn.impure.clonedRepos = { orgClubhouse = { github = "glittershark/org-clubhouse"; path = "code/org-clubhouse"; diff --git a/home/modules/lib/cloneRepo.nix b/home/modules/lib/cloneRepo.nix index 3f39ad57bd4c..dc487dc6bd05 100644 --- a/home/modules/lib/cloneRepo.nix +++ b/home/modules/lib/cloneRepo.nix @@ -2,7 +2,7 @@ with lib; { options = { - impure.clonedRepos = mkOption { + grfn.impure.clonedRepos = mkOption { description = "Repositories to clone"; default = {}; type = with types; loaOf ( @@ -62,6 +62,6 @@ with lib; popd fi '') - config.impure.clonedRepos; + config.grfn.impure.clonedRepos; }; } diff --git a/home/platforms/linux.nix b/home/platforms/linux.nix index b49193442b07..0b95241cbdd1 100644 --- a/home/platforms/linux.nix +++ b/home/platforms/linux.nix @@ -14,10 +14,6 @@ ../modules/shell.nix ../modules/tarsnap.nix ../modules/vim.nix - - ~/code/urb/urbos/home - - machine ]; xsession.enable = true; @@ -61,10 +57,6 @@ playerctl ]; - nixpkgs.config.allowUnfree = true; - - programs.password-store.enable = true; - services.redshift = { enable = true; provider = "geoclue2"; @@ -72,13 +64,6 @@ services.pasystray.enable = true; - impure.clonedRepos.passwordStore = { - github = "glittershark/pass"; - path = ".local/share/password-store"; - }; - - urbint.projectPath = "code/urb"; - services.gpg-agent = { enable = true; }; -- cgit 1.4.1 From 9d6939dc4bcfbbd5652501d7cca6000027ccc219 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 11:28:06 -0400 Subject: Bat theme --- home/modules/shell.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 69672473af23..dc4580039ba2 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -74,13 +74,15 @@ let "gcan" = "git commit --amend --no-edit"; "grl" = "git reflog"; - # Aliases from old config + # Directories stck = "dirs -v"; b= "cd ~1"; ".." = "cd .."; "..." = "cd ../.."; "...." = "cd ../../.."; "....." = "cd ../../../.."; + + # Aliases from old config "http" = "http --style solarized"; "grep" = "grep $GREP_OPTIONS"; "bak" = "~/bin/backup.sh"; @@ -119,6 +121,7 @@ in { LS_COLORS = "no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:"; TWITTER_WHOAMI = "glittershark1"; BROWSER = "firefox"; + BAT_THEME = "ansi-light"; }; programs.bash = { -- cgit 1.4.1 From da6724c979eb5f241e0f1b5ca856b1aadcee32c0 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 11:28:28 -0400 Subject: use kubie from pkgs-unstable --- home/modules/development/kube.nix | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/home/modules/development/kube.nix b/home/modules/development/kube.nix index 916e1cd7a70d..432704ddd315 100644 --- a/home/modules/development/kube.nix +++ b/home/modules/development/kube.nix @@ -1,30 +1,13 @@ { config, lib, pkgs, ... }: let pkgs-unstable = import {}; - - kubie = pkgs-unstable.kubie.overrideAttrs (drv: rec { - name = "kubie-${version}"; - version = "0.8.4"; - src = pkgs.fetchFromGitHub { - rev = "v${version}"; - owner = "sbstp"; - repo = "kubie"; - sha256 = "1f82xlhhxbjadjw609kr1kdm4n69c9mqjia4b3k505wjh7cc55n0"; - }; - - cargoDeps = drv.cargoDeps.overrideAttrs (lib.const { - name = "${name}-vendor.tar.gz"; - inherit src; - outputHash = "0mish7wqwq5ynl98n6swdn5i6mg62aih5rfykbl3wx39b468n481"; - }); - }); in { home.packages = with pkgs; [ kubectl kubetail sops - kubie + pkgs-unstable.kubie # pkgs-unstable.argocd # provided by urbos ]; -- cgit 1.4.1 From db371a5a61340865228434b298ac6a81ea6bbc47 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 11:29:00 -0400 Subject: clang-tools, perhaps --- pkgs/clang-tools.nix | 15 +++++++++++++++ pkgs/clang-tools/default.nix | 24 ++++++++++++++++++++++++ pkgs/clang-tools/wrapper | 20 ++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 pkgs/clang-tools.nix create mode 100644 pkgs/clang-tools/default.nix create mode 100644 pkgs/clang-tools/wrapper diff --git a/pkgs/clang-tools.nix b/pkgs/clang-tools.nix new file mode 100644 index 000000000000..d13fbd44576a --- /dev/null +++ b/pkgs/clang-tools.nix @@ -0,0 +1,15 @@ +with import {}; +runCommand "clang-tools" {} '' + mkdir -p $out/bin + for file in ${clang-tools}/bin/*; do + if [ $(basename "$file") != "clangd" ]; then + ln -s "$file" $out/bin + fi + done + + sed \ + -e "18iexport CPLUS_INCLUDE_PATH=${llvmPackages.libcxx}/include/c++/v1\\''${CPATH:+':'}\\''${CPATH}" \ + -e '/CPLUS_INCLUDE_PATH/d' \ + < ${clang-tools}/bin/clangd \ + > $out/bin/clangd +'' diff --git a/pkgs/clang-tools/default.nix b/pkgs/clang-tools/default.nix new file mode 100644 index 000000000000..7c1009665eb6 --- /dev/null +++ b/pkgs/clang-tools/default.nix @@ -0,0 +1,24 @@ +{ pkgs }: +with pkgs; + +runCommand "clang-tools" {} '' + mkdir -p $out/bin + export libc_includes="${stdenv.lib.getDev stdenv.cc.libc}/include" + export libcpp_includes="${llvmPackages.libcxx}/include/c++/v1" + + export clang=${llvmPackages.clang-unwrapped} + + echo $clang + + substituteAll ${./wrapper} $out/bin/clangd + chmod +x $out/bin/clangd + for tool in \ + clang-apply-replacements \ + clang-check \ + clang-format \ + clang-rename \ + clang-tidy + do + ln -s $out/bin/clangd $out/bin/$tool + done +'' diff --git a/pkgs/clang-tools/wrapper b/pkgs/clang-tools/wrapper new file mode 100644 index 000000000000..949a4243e009 --- /dev/null +++ b/pkgs/clang-tools/wrapper @@ -0,0 +1,20 @@ +#!/bin/sh + +buildcpath() { + local path + while (( $# )); do + case $1 in + -isystem) + shift + path=$path${path:+':'}$1 + esac + shift + done + echo $path +} + +export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE}) +export CPATH=${CPATH}${CPATH:+':'}@libc_includes@ +export CPLUS_INCLUDE_PATH=@libcpp_includes@${CPATH:+':'}${CPATH} + +exec -a "$0" @clang@/bin/$(basename $0) "$@" -- cgit 1.4.1 From a7a525d09a1c8db688189d69bb4410c3360b1c7e Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 26 May 2020 11:30:00 -0400 Subject: Gitignore result --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..41fbeb02c47d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/result -- cgit 1.4.1 From ef2f6f32c11f2a976595b85745071357aa624a52 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 27 May 2020 09:40:53 -0400 Subject: work email in work repos --- home/modules/development/urbint.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home/modules/development/urbint.nix b/home/modules/development/urbint.nix index 6958e3155b58..2844b0dbf1c4 100644 --- a/home/modules/development/urbint.nix +++ b/home/modules/development/urbint.nix @@ -37,6 +37,15 @@ in ''; }; + programs.git = { + includes = [{ + condition = "gitdir:~/code/urb/"; + contents = { + user.email = "grfn@urbint.com"; + }; + }]; + }; + home.file.".ipython/profile_default/ipython_config.py".text = '' c.InteractiveShellApp.exec_lines = ['%autoreload 2'] c.InteractiveShellApp.extensions = ['autoreload'] -- cgit 1.4.1 From d13ef4080d1eb1fa53ba4f52bf72c0d37c9ca20e Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 27 May 2020 09:53:10 -0400 Subject: git filter to black from 100chars to 80chars --- home/modules/development/urbint.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/home/modules/development/urbint.nix b/home/modules/development/urbint.nix index 2844b0dbf1c4..4bf39b656f58 100644 --- a/home/modules/development/urbint.nix +++ b/home/modules/development/urbint.nix @@ -38,6 +38,13 @@ in }; programs.git = { + extraConfig.filter.black100to80 = + let inherit (pkgs.python36Packages) black; in { + clean = "${black}/bin/black --target-version py36 -l 100 -"; + smudge = "${black}/bin/black --target-version py36 -l 80 -"; + }; + + includes = [{ condition = "gitdir:~/code/urb/"; contents = { -- cgit 1.4.1 From 67c88d91757750bafef057a907eef3c338e43a9d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 3 Jun 2020 16:28:43 -0400 Subject: make vihome point at the right home.nix --- home/modules/shell.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/modules/shell.nix b/home/modules/shell.nix index dc4580039ba2..7737ab9d8c90 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -7,7 +7,7 @@ let nrs = nor; nrb = "sudo nixos-rebuild boot"; ncg = "nix-collect-garbage"; - vihome = "vim ~/code/system/home/home.nix && home-manager switch"; + vihome = "vim ~/.config/nixpkgs/home.nix && home-manager switch"; virc = "vim ~/code/system/home/modules/shell.nix && home-manager switch && source ~/.zshrc"; visystem = "sudo vim /etc/nixos/configuration.nix && sudo nixos-rebuild switch"; -- cgit 1.4.1 From e516ee4ca28d5429d755dd40a50687e9ca770291 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 3 Jun 2020 16:29:05 -0400 Subject: twitter module, for t --- home/modules/common.nix | 1 + home/modules/shell.nix | 2 -- home/modules/twitter.nix | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 home/modules/twitter.nix diff --git a/home/modules/common.nix b/home/modules/common.nix index 72107a459fc2..90db48a17c9b 100644 --- a/home/modules/common.nix +++ b/home/modules/common.nix @@ -9,6 +9,7 @@ ../modules/emacs.nix ../modules/vim.nix ../modules/tarsnap.nix + ../modules/twitter.nix ../modules/lib/cloneRepo.nix ]; diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 7737ab9d8c90..411851bc5ea5 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -91,7 +91,6 @@ let "asdf" = "asdfghjkl"; "asdfghjkl" = "echo \"Having some trouble?\""; "ift" = "sudo iftop -i wlp3s0"; - "mytl" = "t tl $TWITTER_WHOAMI"; "first" = "awk '{print \$$1}'"; "cmt" = "git log --oneline | fzf-tmux | awk '{print \$$1}'"; "workmon" = "xrandr --output DP-2 --pos 1440x900 --primary"; @@ -119,7 +118,6 @@ in { home.sessionVariables = { EDITOR = "vim"; LS_COLORS = "no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:"; - TWITTER_WHOAMI = "glittershark1"; BROWSER = "firefox"; BAT_THEME = "ansi-light"; }; diff --git a/home/modules/twitter.nix b/home/modules/twitter.nix new file mode 100644 index 000000000000..9a6dc969b873 --- /dev/null +++ b/home/modules/twitter.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, ... }: + +{ + home.packages = with pkgs; [ + t + ]; + + home.sessionVariables = { + TWITTER_WHOAMI = "glittershark1"; + }; + + programs.zsh.shellAliases = { + "mytl" = "t tl $TWITTER_WHOAMI"; + }; +} -- cgit 1.4.1 From cce0bfff8554bf7718b21b26f318fd0f6aa7de58 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 3 Jun 2020 16:29:14 -0400 Subject: remote builds on new mbp --- system/modules/common.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/modules/common.nix b/system/modules/common.nix index c505d0d5dcd7..66d57704a089 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -112,6 +112,12 @@ sshKey = "/home/grfn/.ssh/id_rsa"; system = "x86_64-darwin"; maxJobs = 4; + } { + hostName = "172.16.0.4"; + sshUser = "griffin"; + sshKey = "/home/grfn/.ssh/id_rsa"; + system = "x86_64-darwin"; + maxJobs = 8; # 16 cpus }]; distributedBuilds = true; -- cgit 1.4.1 From 1f38ccf7c0b4992fa5bb75e789662b2ca746e248 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 3 Jun 2020 16:29:22 -0400 Subject: install bc --- home/modules/common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/common.nix b/home/modules/common.nix index 90db48a17c9b..ed7a729a7975 100644 --- a/home/modules/common.nix +++ b/home/modules/common.nix @@ -33,6 +33,7 @@ zip unzip tree ncat + bc # Security gnupg -- cgit 1.4.1 From 8f50a550c5afd1a4d1704818053f49437d27c95e Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 4 Jun 2020 10:47:02 -0400 Subject: git aliases to development.nix --- home/modules/development.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++ home/modules/shell.nix | 46 -------------------------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/home/modules/development.nix b/home/modules/development.nix index 326193f61444..54a0e6e68469 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -89,6 +89,52 @@ with lib; }; programs.zsh.shellAliases = { + # Git + "gwip" = "git add . && git commit -am wip"; + "gpr" = "g pull-request"; + "gcl" = "git clone"; + "grs" = "gr --soft"; + "grhh" = "grh HEAD"; + "grh" = "gr --hard"; + "gr" = "git reset"; + "gcb" = "gc -b"; + "gco" = "gc"; + "gcd" = "gc development"; + "gcm" = "gc master"; + "gc" = "git checkout"; + "gbg" = "git branch | grep"; + "gba" = "git branch -a"; + "gb" = "git branch"; + "gcv" = "git commit --verbose"; + "gci" = "git commit"; + "gm" = "git merge"; + "gdc" = "gd --cached"; + "gd" = "git diff"; + "gsl" = "git stash list"; + "gss" = "git show stash"; + "gsad" = "git stash drop"; + "gsa" = "git stash"; + "gst" = "gs"; + "gs" = "git status"; + "gg" = "gl --decorate --oneline --graph --date-order --all"; + "gl" = "git log"; + "gf" = "git fetch"; + "gur" = "gu --rebase"; + "gu" = "git pull"; + "gpf" = "gp -f"; + "gpa" = "gp --all"; + "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; + "gp" = "git push"; + "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; + "ga" = "git add"; + "gnp" = "git --no-pager"; + "g" = "git"; + "git" = "hub"; + "grim" = "git fetch && git rebase -i origin/master"; + "grc" = "git rebase --continue"; + "gcan" = "git commit --amend --no-edit"; + "grl" = "git reflog"; + # Haskell "cnb" = "cabal new-build"; "cob" = "cabal old-build"; diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 411851bc5ea5..71e607063fe2 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -28,52 +28,6 @@ let "dockercleanimages" = "docker images -a --no-trunc | grep none | awk '{print \$$3}' | xargs -L 1 -r docker rmi"; "dockercleancontainers" = "docker ps -a --no-trunc| grep 'Exit' | awk '{print \$$1}' | xargs -L 1 -r docker rm"; - # Git - "gwip" = "git add . && git commit -am wip"; - "gpr" = "g pull-request"; - "gcl" = "git clone"; - "grs" = "gr --soft"; - "grhh" = "grh HEAD"; - "grh" = "gr --hard"; - "gr" = "git reset"; - "gcb" = "gc -b"; - "gco" = "gc"; - "gcd" = "gc development"; - "gcm" = "gc master"; - "gc" = "git checkout"; - "gbg" = "git branch | grep"; - "gba" = "git branch -a"; - "gb" = "git branch"; - "gcv" = "git commit --verbose"; - "gci" = "git commit"; - "gm" = "git merge"; - "gdc" = "gd --cached"; - "gd" = "git diff"; - "gsl" = "git stash list"; - "gss" = "git show stash"; - "gsad" = "git stash drop"; - "gsa" = "git stash"; - "gst" = "gs"; - "gs" = "git status"; - "gg" = "gl --decorate --oneline --graph --date-order --all"; - "gl" = "git log"; - "gf" = "git fetch"; - "gur" = "gu --rebase"; - "gu" = "git pull"; - "gpf" = "gp -f"; - "gpa" = "gp --all"; - "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; - "gp" = "git push"; - "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; - "ga" = "git add"; - "gnp" = "git --no-pager"; - "g" = "git"; - "git" = "hub"; - "grim" = "git fetch && git rebase -i origin/master"; - "grc" = "git rebase --continue"; - "gcan" = "git commit --amend --no-edit"; - "grl" = "git reflog"; - # Directories stck = "dirs -v"; b= "cd ~1"; -- cgit 1.4.1 From d59b69e6a39249e4834202e00cf9a78c24e33ca7 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:18:47 -0400 Subject: install loc --- home/modules/development.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/modules/development.nix b/home/modules/development.nix index 54a0e6e68469..8474456e678d 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -29,6 +29,7 @@ with lib; entr gnumake inetutils + loc clj2nix -- cgit 1.4.1 From 77f3860a651ee7f35c8e65747c0c45fb001cfb0b Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:19:05 -0400 Subject: add zshFunctions config option --- home/modules/development.nix | 1 + home/modules/lib/zshFunctions.nix | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 home/modules/lib/zshFunctions.nix diff --git a/home/modules/development.nix b/home/modules/development.nix index 8474456e678d..9bb24b256110 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -15,6 +15,7 @@ with lib; { imports = [ + ./lib/zshFunctions.nix ./development/kube.nix ./development/urbint.nix ]; diff --git a/home/modules/lib/zshFunctions.nix b/home/modules/lib/zshFunctions.nix new file mode 100644 index 000000000000..7c39b3478cfd --- /dev/null +++ b/home/modules/lib/zshFunctions.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + options = { + programs.zsh.functions = mkOption { + description = "An attribute set that maps function names to their source"; + default = {}; + type = with types; attrsOf (either str path); + }; + }; + + config.programs.zsh.initExtra = concatStringsSep "\n" ( + mapAttrsToList (name: funSrc: '' + function ${name}() { + ${funSrc} + } + '') config.programs.zsh.functions + ); +} -- cgit 1.4.1 From 5477cc1b2a71b11810e4dee195dea3f74a9942d3 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:19:26 -0400 Subject: some twitter functions --- home/modules/twitter.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home/modules/twitter.nix b/home/modules/twitter.nix index 9a6dc969b873..3cb2e90adc34 100644 --- a/home/modules/twitter.nix +++ b/home/modules/twitter.nix @@ -9,7 +9,15 @@ TWITTER_WHOAMI = "glittershark1"; }; - programs.zsh.shellAliases = { - "mytl" = "t tl $TWITTER_WHOAMI"; + programs.zsh = { + shellAliases = { + "mytl" = "t tl $TWITTER_WHOAMI"; + }; + + functions = { + favelast = "t fave $(t tl -l $1 | head -n1 | cut -d' ' -f1)"; + rtlast = "t rt $(t tl -l $1 | head -n1 | cut -d' ' -f1)"; + tthread = "t reply $(t tl -l $TWITTER_WHOAMI | head -n1 | cut -d' ' -f1) $@"; + }; }; } -- cgit 1.4.1 From f48477cfdb9cbf7d6e185e91af050c5202033911 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:19:43 -0400 Subject: drop cpuFreqGovernor for compat with new nixos --- system/machines/chupacabra.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/system/machines/chupacabra.nix b/system/machines/chupacabra.nix index 2186a59ebad0..99225e354562 100644 --- a/system/machines/chupacabra.nix +++ b/system/machines/chupacabra.nix @@ -11,7 +11,6 @@ powerManagement = { enable = true; powertop.enable = true; - cpuFreqGovernor = "performance"; }; laptop.onLowBattery = { -- cgit 1.4.1 From 0a7b41284df1b7c124197f89935d37f2d902ee98 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:20:00 -0400 Subject: convert hardcoded functions to new functions option --- home/modules/development/urbint.nix | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/home/modules/development/urbint.nix b/home/modules/development/urbint.nix index 4bf39b656f58..63f92bf50d4e 100644 --- a/home/modules/development/urbint.nix +++ b/home/modules/development/urbint.nix @@ -25,16 +25,10 @@ in amerge = "alembic merge heads"; }; - initExtra = '' - # Alembic {{{ - function aup() { - alembic upgrade ''${1:-head} - } - - function adown() { - alembic downgrade ''${1:--1} - } - ''; + functions = { + aup = "alembic upgrade \${1:-head}"; + adown = "alembic downgrade \${1:--1}"; + }; }; programs.git = { -- cgit 1.4.1 From f2ddb560dd6d2aa195f99f48a0d8e9b5c978bd94 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:20:18 -0400 Subject: drop a bunch of unused stuff from zshrc --- home/modules/zshrc | 66 ------------------------------------------------------ 1 file changed, 66 deletions(-) diff --git a/home/modules/zshrc b/home/modules/zshrc index 73ceec48e631..cca822c4ce3e 100644 --- a/home/modules/zshrc +++ b/home/modules/zshrc @@ -187,43 +187,6 @@ fi function vconflicts() { $EDITOR $(git status --porcelain | awk '/^UU/ { print $2 }') } - -function fetchall() { -for repo in ~/code/nomi/gems/* ~/code/nomi/services/svc-users ~/code/nomi/services/svc-entities ~/code/go/src/github.com/getnomi/svc-gateway; do - echo -e "\x1b[34;1m=======> \x1b[37;1m$repo\x1b[0m" - git -C $repo fetch -done -} -# }}} - -# Wifi {{{ -# }}} - -# adb {{{ -# }}} - -# Golang {{{ -# }}} - -# Tail logs {{{ -# }}} - -# Running stuff {{{ -# }}} - -# Directories {{{ - - - -# }}} - -# SSH shortcuts {{{ -# }}} - -# Editing config files {{{ -# }}} - -# XRandR {{{ # }}} # fzf {{{ @@ -318,25 +281,6 @@ unset GREP_OPTIONS export GREP_OPTIONS= # }}} -# Keyboard backlight {{{ - -KEYBOARD_BRIGHTNESS_FILE='/sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness' - -setkbd() { - echo $1 | sudo tee $KEYBOARD_BRIGHTNESS_FILE -} - -kbdup() { - curr=$(< $KEYBOARD_BRIGHTNESS_FILE) - echo $(( $curr + 15 )) | sudo tee $KEYBOARD_BRIGHTNESS_FILE -} - -kbdup() { - curr=$(< $KEYBOARD_BRIGHTNESS_FILE) - echo $(( $curr - 15 )) | sudo tee $KEYBOARD_BRIGHTNESS_FILE -} - -# }}} # Run docker containers {{{ # -d \ @@ -359,14 +303,4 @@ kbdup() { # glittershark/firefox # }}} -# Alembic {{{ -function aup() { - alembic upgrade ${1:-head} -} - -function adown() { - alembic downgrade ${1:--1} -} -# }}} - [ -f ./.localrc ] && source ./.localrc -- cgit 1.4.1 From 51e202ff47a2690b9942d11507572039fdbb7a58 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:20:35 -0400 Subject: a gdelmerged function --- home/modules/development.nix | 114 +++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/home/modules/development.nix b/home/modules/development.nix index 9bb24b256110..a8e74ed6dff3 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -90,58 +90,66 @@ with lib; ''; }; - programs.zsh.shellAliases = { - # Git - "gwip" = "git add . && git commit -am wip"; - "gpr" = "g pull-request"; - "gcl" = "git clone"; - "grs" = "gr --soft"; - "grhh" = "grh HEAD"; - "grh" = "gr --hard"; - "gr" = "git reset"; - "gcb" = "gc -b"; - "gco" = "gc"; - "gcd" = "gc development"; - "gcm" = "gc master"; - "gc" = "git checkout"; - "gbg" = "git branch | grep"; - "gba" = "git branch -a"; - "gb" = "git branch"; - "gcv" = "git commit --verbose"; - "gci" = "git commit"; - "gm" = "git merge"; - "gdc" = "gd --cached"; - "gd" = "git diff"; - "gsl" = "git stash list"; - "gss" = "git show stash"; - "gsad" = "git stash drop"; - "gsa" = "git stash"; - "gst" = "gs"; - "gs" = "git status"; - "gg" = "gl --decorate --oneline --graph --date-order --all"; - "gl" = "git log"; - "gf" = "git fetch"; - "gur" = "gu --rebase"; - "gu" = "git pull"; - "gpf" = "gp -f"; - "gpa" = "gp --all"; - "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; - "gp" = "git push"; - "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; - "ga" = "git add"; - "gnp" = "git --no-pager"; - "g" = "git"; - "git" = "hub"; - "grim" = "git fetch && git rebase -i origin/master"; - "grc" = "git rebase --continue"; - "gcan" = "git commit --amend --no-edit"; - "grl" = "git reflog"; - - # Haskell - "cnb" = "cabal new-build"; - "cob" = "cabal old-build"; - "cnr" = "cabal new-run"; - "cor" = "cabal old-run"; - "ho" = "hoogle"; + programs.zsh = { + shellAliases = { + # Git + "gwip" = "git add . && git commit -am wip"; + "gpr" = "g pull-request"; + "gcl" = "git clone"; + "grs" = "gr --soft"; + "grhh" = "grh HEAD"; + "grh" = "gr --hard"; + "gr" = "git reset"; + "gcb" = "gc -b"; + "gco" = "gc"; + "gcd" = "gc development"; + "gcm" = "gc master"; + "gc" = "git checkout"; + "gbg" = "git branch | grep"; + "gba" = "git branch -a"; + "gb" = "git branch"; + "gcv" = "git commit --verbose"; + "gci" = "git commit"; + "gm" = "git merge"; + "gdc" = "gd --cached"; + "gd" = "git diff"; + "gsl" = "git stash list"; + "gss" = "git show stash"; + "gsad" = "git stash drop"; + "gsa" = "git stash"; + "gst" = "gs"; + "gs" = "git status"; + "gg" = "gl --decorate --oneline --graph --date-order --all"; + "gl" = "git log"; + "gf" = "git fetch"; + "gur" = "gu --rebase"; + "gu" = "git pull"; + "gpf" = "gp -f"; + "gpa" = "gp --all"; + "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\""; + "gp" = "git push"; + "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace"; + "ga" = "git add"; + "gnp" = "git --no-pager"; + "g" = "git"; + "git" = "hub"; + "grim" = "git fetch && git rebase -i origin/master"; + "grc" = "git rebase --continue"; + "gcan" = "git commit --amend --no-edit"; + "grl" = "git reflog"; + + # Haskell + "cnb" = "cabal new-build"; + "cob" = "cabal old-build"; + "cnr" = "cabal new-run"; + "cor" = "cabal old-run"; + "ho" = "hoogle"; + }; + + functions = { + gdelmerged = '' + git branch --merged | egrep -v 'master' | tr -d '+ ' | xargs git branch -d + ''; + }; }; } -- cgit 1.4.1 From 3c61742a3740a2f56433dd4334f15f735e523756 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 15 Jun 2020 11:53:39 -0400 Subject: Install pg-dump-upsert --- home/modules/development.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/home/modules/development.nix b/home/modules/development.nix index a8e74ed6dff3..04c672539fff 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -9,6 +9,20 @@ let sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6"; }) {}; + pg-dump-upsert = pkgs.buildGoModule rec { + pname = "pg-dump-upsert"; + version = "165258deaebded5e9b88f7a0acf3a4b7350e7bf4"; + + src = pkgs.fetchFromGitHub { + owner = "tomyl"; + repo = "pg-dump-upsert"; + rev = version; + sha256 = "1an4h8jjbj3r618ykjwk9brii4h9cxjqy47c4c8rivnvhimgf4wm"; + }; + + modSha256 = "07ci2726nrn8qjvwcypk6nf8zqmfnmvch8l28bmgj7hpfrbyb424"; + }; + in with lib; @@ -36,6 +50,7 @@ with lib; haskellPackages.Agda AgdaStdlib + pg-dump-upsert (import ../pkgs/clang-tools { inherit pkgs; }) ] ++ optional (stdenv.isLinux) julia; -- cgit 1.4.1 From f59e705eca2f3dc5a1cc7d9a9fad62ac67b95a04 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 15 Jun 2020 11:54:01 -0400 Subject: break out an agda.nix --- home/modules/development.nix | 3 +- home/modules/development/agda.nix | 61 +++++++++++++++++++++++++++++++++++++++ home/modules/emacs.nix | 2 -- 3 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 home/modules/development/agda.nix diff --git a/home/modules/development.nix b/home/modules/development.nix index 04c672539fff..39e964d1da3e 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -32,6 +32,7 @@ with lib; ./lib/zshFunctions.nix ./development/kube.nix ./development/urbint.nix + ./development/agda.nix ]; home.packages = with pkgs; [ @@ -48,8 +49,6 @@ with lib; clj2nix - haskellPackages.Agda - AgdaStdlib pg-dump-upsert (import ../pkgs/clang-tools { inherit pkgs; }) diff --git a/home/modules/development/agda.nix b/home/modules/development/agda.nix new file mode 100644 index 000000000000..7a197e907f3c --- /dev/null +++ b/home/modules/development/agda.nix @@ -0,0 +1,61 @@ +{ config, lib, pkgs, ... }: + +let + + nixpkgs-unstable = import {}; + + agda-categories = with nixpkgs-unstable.agdaPackages; mkDerivation rec { + pname = "agda-categories"; + version = "2128fab"; + src = pkgs.fetchFromGitHub { + owner = "agda"; + repo = "agda-categories"; + rev = version; + sha256 = "08mc20qaz9vp5rhi60rh8wvjkg5aby3bgwwdhfnxha1663qf1q24"; + }; + + buildInputs = [ standard-library ]; + }; + +in + +{ + imports = [ + ../lib/cloneRepo.nix + ]; + + home.packages = with pkgs; [ + (nixpkgs-unstable.agda.withPackages + (p: with p; [ + p.standard-library + + ])) + ]; + + grfn.impure.clonedRepos = { + agda-stdlib = { + github = "agda/agda-stdlib"; + path = "code/agda-stdlib"; + }; + + agda-categories = { + github = "agda/agda-categories"; + path = "code/agda-categories"; + }; + + categories-examples = { + github = "agda/categories-examples"; + path = "code/categories-examples"; + }; + }; + + home.file.".agda/defaults".text = '' + standard-library + ''; + + home.file.".agda/libraries".text = '' + ${config.home.homeDirectory}/code/agda-stdlib/standard-library.agda-lib + ${config.home.homeDirectory}/code/agda-categories/agda-categories.agda-lib + ''; + +} diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index b6b8994638df..3f82880d2bd6 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -21,8 +21,6 @@ in { config = mkMerge [ { home.packages = with pkgs; [ - haskellPackages.Agda - # LaTeX (for org export) (pkgs.texlive.combine { inherit (pkgs.texlive) -- cgit 1.4.1 From 453c2d5e319cf20691f98e3bfbd7b327823c9005 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 15 Jun 2020 11:54:07 -0400 Subject: install iftop on linux --- home/platforms/linux.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/platforms/linux.nix b/home/platforms/linux.nix index 0b95241cbdd1..6ffc1c770d70 100644 --- a/home/platforms/linux.nix +++ b/home/platforms/linux.nix @@ -46,6 +46,7 @@ lsof tree ncat + iftop # Security gnupg -- cgit 1.4.1 From 3b174300ae60f63f50427cde3bfd680fd3043c3a Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 15 Jun 2020 11:54:17 -0400 Subject: kubectl get events sorted by timestamp --- home/modules/development/kube.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/modules/development/kube.nix b/home/modules/development/kube.nix index 432704ddd315..346dd57dee7e 100644 --- a/home/modules/development/kube.nix +++ b/home/modules/development/kube.nix @@ -24,6 +24,8 @@ in "kew" = "kubectl get events -w"; "kdel" = "kubectl delete"; "knw" = "kubectl get nodes -w"; + "kev" = "kubectl get events --sort-by='.metadata.creationTimestamp'"; + "arsy" = "argocd app sync --prune"; }; -- cgit 1.4.1