···11# Set fish_user_paths here instead of fish_variables to expand $HOME per-machine
22-set -U fish_user_paths ~/.cargo/bin $fish_user_paths
22+set -U fish_user_paths \
33+ ~/.cargo/bin \
44+ ~/Library/Python/3.7/bin \
55+ $fish_user_paths
3647# Set a proper TTY for gpg commands to work
58set -x GPG_TTY (tty)
···710# Run nvm to update fish_user_paths for npm installs. Allow failure if running
811# outside home directory (no .nvmrc found), and run in background to avoid
912# blocking the shell from starting
1010-functions -q nvm; and nvm &>/dev/null & || true
1313+if command -qs nvm
1414+ nvm &>/dev/null & || true
1515+end
11161217if not set -q DOCKER_NAME; and test -f /etc/profile.d/docker_name.sh
1318 set -gx DOCKER_NAME (sed -E 's/.*DOCKER_NAME=(.+)/\1/' /etc/profile.d/docker_name.sh)
···11-function fish_normalize_saved_functions --description "Remove fish-generated paths in saved functions"
11+function fish_normalize_saved_functions --description 'Remove fish-generated paths in saved functions'
22 set -l exclude_functions \
33 "fish_normalize_saved_functions" \
44 "fish_prompt" \
+1-1
.config/fish/functions/fish_prompt.fish
···3030 set -g __fish_prompt_docker ""
3131 end
32323333- if set -l pyenv_version (pyenv local 2>/dev/null)
3333+ if command -qs pyenv; and set -l pyenv_version (pyenv local 2>/dev/null)
3434 set -g __fish_prompt_pyenv "$white"'('"$pyenv_version"')'" $__fish_prompt_normal"
3535 else
3636 set -g __fish_prompt_pyenv ""
···11function vim
22- command nvim -p $argv
22+ if command -qs nvim
33+ command nvim -p $argv
44+ else
55+ command vim -p $argv
66+ end
37end
+151
.config/nixos/prismo/configuration.nix
···11+# To apply this file, symlink this directory to /etc/nixos
22+# E.g. `rm -rf /etc/nixos && ln -s $PWD /etc/nixos`
33+44+{ config, pkgs, ... }:
55+66+let
77+ unstable = import <nixos-unstable> {};
88+in
99+1010+{
1111+ imports =
1212+ [
1313+ # Include the results of the hardware scan.
1414+ ./hardware-configuration.nix
1515+1616+ # To use home-manager config in this file
1717+ <home-manager/nixos>
1818+ ];
1919+2020+2121+ # ==========================================================================
2222+ # Boot configuration
2323+ # ==========================================================================
2424+ boot.loader.systemd-boot.enable = true;
2525+ boot.loader.efi.canTouchEfiVariables = true;
2626+2727+2828+ # ==========================================================================
2929+ # Networking configuration
3030+ # ==========================================================================
3131+ networking.hostName = "prismo";
3232+ networking.networkmanager.enable = true;
3333+3434+ # Open ports in the firewall.
3535+ networking.firewall.allowedTCPPorts = [
3636+ 8200 # Deluge web interface
3737+3838+ # Plex media server
3939+ 32400
4040+ 3005
4141+ 8324
4242+ 32469
4343+4444+ # SMB share
4545+ 139
4646+ 445
4747+ ];
4848+ networking.firewall.allowedUDPPorts = [
4949+ # UPnP
5050+ 1900
5151+5252+ # SMB share
5353+ 137
5454+ 138
5555+5656+ # Plex media server
5757+ 32410
5858+ 32412
5959+ 32413
6060+ 32414
6161+ ];
6262+6363+6464+ # ==========================================================================
6565+ # Service configuration
6666+ # ==========================================================================
6767+ services.openssh.enable = true;
6868+6969+ # Prevent lid sleep when plugged in
7070+ services.logind.lidSwitchExternalPower = "ignore";
7171+7272+ /* Uncomment these to enable graphical desktop
7373+ # TODO can this just be a one-line import or something?
7474+7575+ # Enable the X11 windowing system.
7676+ services.xserver.enable = true;
7777+ services.xserver.layout = "us";
7878+ services.xserver.xkbOptions = "eurosign:e";
7979+8080+ # Enable touchpad support.
8181+ services.xserver.libinput.enable = true;
8282+8383+ # Enable the KDE Desktop Environment.
8484+ services.xserver.displayManager.sddm.enable = true;
8585+ services.xserver.desktopManager.plasma5.enable = true;
8686+8787+ # Enable CUPS to print documents.
8888+ services.printing.enable = true;
8989+9090+ # Enable sound.
9191+ sound.enable = true;
9292+ hardware.pulseaudio.enable = true;
9393+ */
9494+9595+9696+ # ==========================================================================
9797+ # General system configuration
9898+ # ==========================================================================
9999+ time.timeZone = "America/New_York";
100100+101101+ # Allow unfree software (required for some drivers)
102102+ nixpkgs.config.allowUnfree = true;
103103+104104+ # List packages installed in system profile. To search, run:
105105+ # $ nix search wget
106106+ environment.systemPackages = with pkgs; [
107107+ brightnessctl
108108+ docker
109109+ git
110110+ hfsprogs
111111+ firefox
112112+ lm_sensors
113113+ vim
114114+ wget
115115+ ];
116116+117117+ # TODO: use podman from unstaable instead of docker
118118+ virtualisation.docker = {
119119+ enable = true;
120120+ };
121121+122122+ # ==========================================================================
123123+ # User configuration
124124+ # ==========================================================================
125125+ users.users.ianchamberlain = {
126126+ isNormalUser = true;
127127+ extraGroups = [
128128+ # Enable sudo
129129+ "wheel"
130130+131131+ # Allow managing network settings
132132+ "networkmanager"
133133+134134+ # Groups for media server
135135+ "docker"
136136+ "deluge"
137137+ ];
138138+ shell = unstable.fish;
139139+ };
140140+141141+142142+ # This value determines the NixOS release from which the default
143143+ # settings for stateful data, like file locations and database versions
144144+ # on your system were taken. It‘s perfectly fine and recommended to leave
145145+ # this value at the release version of the first install of this system.
146146+ # Before changing this value read the documentation for this option
147147+ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
148148+ system.stateVersion = "20.03"; # Did you read the comment?
149149+150150+}
151151+
+31
.config/nixos/prismo/hardware-configuration.nix
···11+# Do not modify this file! It was generated by ‘nixos-generate-config’
22+# and may be overwritten by future invocations. Please make changes
33+# to /etc/nixos/configuration.nix instead.
44+{ config, lib, pkgs, ... }:
55+66+{
77+ imports =
88+ [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
99+ ];
1010+1111+ boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "firewire_ohci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
1212+ boot.initrd.kernelModules = [ ];
1313+ boot.kernelModules = [ "kvm-intel" "wl" ];
1414+ boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
1515+1616+ fileSystems."/" =
1717+ { device = "/dev/disk/by-uuid/77290c0f-82d0-4fd2-bc73-45363b081c46";
1818+ fsType = "ext4";
1919+ };
2020+2121+ fileSystems."/boot" =
2222+ { device = "/dev/disk/by-uuid/E498-6BE5";
2323+ fsType = "vfat";
2424+ };
2525+2626+ swapDevices =
2727+ [ { device = "/dev/disk/by-uuid/07f3ddeb-9031-427d-ae31-3108ae86dbf0"; }
2828+ ];
2929+3030+ nix.maxJobs = lib.mkDefault 4;
3131+}
+81
.config/nixpkgs/home.nix
···11+{ config, pkgs, ... }:
22+33+let
44+ unstable = import <nixos-unstable> {};
55+in
66+77+{
88+ programs = {
99+ # Let Home Manager install and manage itself.
1010+ home-manager.enable = true;
1111+1212+ # NOTE: Programs must be listed here for fish completion to work!
1313+ bat.enable = true;
1414+ gpg.enable = true; # For use with git, git-crypt, etc.
1515+ git.enable = true;
1616+1717+ # Preferred shell
1818+ fish = {
1919+ enable = true;
2020+ # Need to use unstable for fish 3.1.x
2121+ package = unstable.fish;
2222+ };
2323+2424+ # Preferred editor, including nix highlighting
2525+ neovim = {
2626+ enable = true;
2727+2828+ # Create shell aliases
2929+ viAlias = true;
3030+ vimAlias = true;
3131+ vimdiffAlias = true;
3232+3333+ # TODO: can this be deduped with ~/.config/nvim/init.vim ?
3434+ extraConfig = ''
3535+ set runtimepath^=~/.vim runtimepath+=~/.vim/after
3636+ let &packpath = &runtimepath
3737+ source ~/.vimrc
3838+ '';
3939+4040+ # Nix syntax highlighting
4141+ plugins = with pkgs.vimPlugins; [
4242+ vim-nix
4343+ vim-fish
4444+ ];
4545+ };
4646+ };
4747+4848+ services = {
4949+ # For commit signing, git-crypt, etc.
5050+ gpg-agent = {
5151+ enable = true;
5252+ defaultCacheTtl = 14400;
5353+ maxCacheTtl = 14400;
5454+ pinentryFlavor = "curses";
5555+ };
5656+ };
5757+5858+ home.packages = with pkgs; [
5959+ docker-compose
6060+ git-crypt
6161+ lsb-release
6262+ pinentry-curses
6363+ tree
6464+ yadm
6565+ ];
6666+6767+ # Home Manager needs a bit of information about you and the
6868+ # paths it should manage.
6969+ home.username = "ianchamberlain";
7070+ home.homeDirectory = "/home/ianchamberlain";
7171+7272+ # This value determines the Home Manager release that your
7373+ # configuration is compatible with. This helps avoid breakage
7474+ # when a new Home Manager release introduces backwards
7575+ # incompatible changes.
7676+ #
7777+ # You can update Home Manager without changing this value. See
7878+ # the Home Manager release notes for a list of state version
7979+ # changes in each release.
8080+ home.stateVersion = "20.09";
8181+}
+18-14
.config/yadm/hooks/pre_commit
···11-#!/bin/bash
11+#!/usr/bin/env bash
2233set -o errexit
44set -o nounset
···1414# shellcheck source=utils.sh
1515source utils.sh
16161717-SHELLCHECK_SOURCES=(
1818- bootstrap
1919- utils.sh
2020- hooks/*
2121-)
1717+if command -v shellcheck >/dev/null; then
1818+ SHELLCHECK_SOURCES=(
1919+ bootstrap
2020+ utils.sh
2121+ hooks/*
2222+ )
22232323-if ! shellcheck "${SHELLCHECK_SOURCES[@]}"; then
2424- echo "Some files failed the shellcheck linter!"
2525- exit 1
2424+ if ! shellcheck "${SHELLCHECK_SOURCES[@]}"; then
2525+ echo "Some files failed the shellcheck linter!"
2626+ exit 1
2727+ fi
2628fi
27292828-if ! check_vscode_exts &>/dev/null; then
2929- list_vscode_exts >$VSCODE_EXTENSIONS
3030- echo "$VSCODE_EXTENSIONS was out-of-date."
3131- echo "It has been auto-updated, and should be committed."
3232- exit 1
3030+if command -v code >/dev/null; then
3131+ if ! check_vscode_exts &>/dev/null; then
3232+ list_vscode_exts >$VSCODE_EXTENSIONS
3333+ echo "$VSCODE_EXTENSIONS was out-of-date."
3434+ echo "It has been auto-updated, and should be committed."
3535+ exit 1
3636+ fi
3337fi
34383539# TODO: convert other scripts to fish instead of bash (except bootstrap)