Reorg for multiple machines

work
Matthew Ess 2021-01-10 22:59:20 -05:00
parent ef3862cd98
commit 2bef9032fc
27 changed files with 729 additions and 619 deletions

View File

@ -43,33 +43,33 @@ autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isT
nnoremap <silent> <c-b> :NERDTreeToggle<CR> nnoremap <silent> <c-b> :NERDTreeToggle<CR>
"LSP support "LSP support
set hidden "set hidden
let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml'] "let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml']
let g:LanguageClient_serverCommands = { "let g:LanguageClient_serverCommands = {
\ 'haskell': ['ghcide', '--lsp'], " \ 'haskell': ['ghcide', '--lsp'],
\ } " \ }
let g:LanguageClient_preferredMarkupKind = ['plaintext'] "let g:LanguageClient_preferredMarkupKind = ['plaintext']
let g:LanguageClient_completionPreferTextEdit = 1 "let g:LanguageClient_completionPreferTextEdit = 1
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR> "nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> f :call LanguageClient#textDocument_rangeFormatting()<CR> "nnoremap <silent> f :call LanguageClient#textDocument_rangeFormatting()<CR>
nnoremap <silent> F :call LanguageClient#textDocument_formatting()<CR> "nnoremap <silent> F :call LanguageClient#textDocument_formatting()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR> "nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> gr :call LanguageClient#textDocument_references()<CR> "nnoremap <silent> gr :call LanguageClient#textDocument_references()<CR>
set cmdheight=2 "set cmdheight=2
set updatetime=300 "set updatetime=300
set signcolumn=yes "set signcolumn=yes
"
"NCM2 ""NCM2
autocmd bufenter * call ncm2#enable_for_buffer() "autocmd bufenter * call ncm2#enable_for_buffer()
au User Ncm2PopupOpen set completeopt=noinsert,menuone,noselect "au User Ncm2PopupOpen set completeopt=noinsert,menuone,noselect
au User Ncm2PopupClose set completeopt=menuone "au User Ncm2PopupClose set completeopt=menuone
set shortmess+=c "set shortmess+=c
" CTRL-C doesn't trigger the InsertLeave autocmd . map to <ESC> instead. "" CTRL-C doesn't trigger the InsertLeave autocmd . map to <ESC> instead.
inoremap <c-c> <ESC> "inoremap <c-c> <ESC>
" When the <Enter> key is pressed while the popup menu is visible, it only "" When the <Enter> key is pressed while the popup menu is visible, it only
" hides the menu. Use this mapping to close the menu and also start a new "" hides the menu. Use this mapping to close the menu and also start a new
" line. "" line.
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>") "inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
" Use <TAB> to select the popup menu: "" Use <TAB> to select the popup menu:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" "inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" "inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

1
assets/pijul.fish Symbolic link
View File

@ -0,0 +1 @@
/home/mat/dev/pijul-fish-completions/pijul.fish

View File

@ -1,222 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
# Cachix caches
./cachix.nix
# Overlays
<home-manager/nixos>
];
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 64;
boot.loader.efi.canTouchEfiVariables = true;
console.earlySetup = true;
console.keyMap = "us";
system.autoUpgrade.enable = true;
networking = {
hostName = "nixpad"; # Define your hostname.
networkmanager = {
enable = true;
wifi.scanRandMacAddress = false;
};
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
useDHCP = false;
interfaces = {
enp0s25.useDHCP = true;
wlp3s0.useDHCP = true;
wwp0s20u4c2i12.useDHCP = true;
};
wireguard.enable = true;
firewall = let
ports = [
32400 # Plex local
57955 # Plex VPN
57430 # Deluge
];
in {
allowedTCPPorts = ports;
allowedUDPPorts = ports;
};
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
fonts = {
enableDefaultFonts = true;
fonts = with pkgs; [
source-code-pro
fira-code
fira-code-symbols
font-awesome_4
aileron
gohufont
spleen
tamsyn
siji
unscii
];
fontconfig = {
enable = true;
defaultFonts = { monospace = [ "Fira Code" ]; };
};
};
# Select internationalisation properties.
i18n = { defaultLocale = "en_US.UTF-8"; };
# Set your time zone.
time.timeZone = "America/New_York";
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# System utilities
git
tmux
tree
vim
wget
# Interfacing with HFS+ drives
hfsprogs
];
# 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; };
programs = {
fish.enable = false;
light.enable = true;
nm-applet.enable = true;
seahorse.enable = true;
ssh = { startAgent = true; };
};
# List services that you want to enable:
services = {
fprintd = {
enable = true;
# package = pkgs.fprintd-thinkpad;
};
openssh.enable = true;
clipmenu.enable = true;
geoclue2.enable = true;
gvfs.enable = true;
printing.enable = true;
gnome3.gnome-keyring.enable = true;
upower.enable = true;
mullvad-vpn.enable = true;
plex = {
enable = true;
# user = "mat";
};
xserver = {
enable = true;
layout = "us";
videoDrivers = [ "intel" ];
deviceSection = ''
Option "DRI" "3"
Option "TearFree" "true"
'';
useGlamor = true;
# Enable touchpad support.
libinput = {
enable = true;
naturalScrolling = true;
disableWhileTyping = true;
};
desktopManager = {
session = [{
name = "home-manager";
start = ''
${pkgs.runtimeShell} $HOME/.hm-xsession &
waitPID=$!
'';
}];
};
displayManager = {
defaultSession = "home-manager";
autoLogin = {
enable = true;
user = "mat";
};
};
};
};
# Enable sound.
sound.enable = true;
# Hardware switches
hardware = {
logitech.wireless = {
enable = true;
# enableGraphical = true;
};
opengl = {
driSupport32Bit = true;
extraPackages32 = [ pkgs.pkgsi686Linux.libva ];
};
pulseaudio = {
enable = true;
support32Bit = true;
};
};
nixpkgs.config.allowUnfree = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.mat = {
isNormalUser = true;
shell = pkgs.fish;
extraGroups = [
"wheel" # Enable sudo for the user.
"networkmanager"
"audio"
"video"
];
};
home-manager.users.mat = import ./home.nix;
fileSystems = {
"/mnt/passport".device = "/dev/sdb";
};
# Don't ask for my password *quite* as often.
security.sudo.extraConfig = "Defaults timestamp_timeout=60";
nix = {
binaryCaches = [ "https://hydra.iohk.io" ];
binaryCachePublicKeys =
[ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "19.09"; # Did you read the comment?
}

View File

@ -1,30 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/3aad55c2-899f-4af7-a0b4-5aa1c11685a7";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/4A83-BBDF";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/d1bbcef9-0948-4618-ba61-06c5cb98c1d7"; }];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

43
hm-configs/dunst.nix Normal file
View File

@ -0,0 +1,43 @@
{
enable = true;
settings = {
global = {
geometry = "0x5-30+20";
notification_height = 25;
indicate_hidden = "yes";
corner_radius = 5;
padding = 10;
horizontal_padding = 10;
idle_threshold = 60;
font = "Fira Code 16";
markup = "full";
format = ''
<b>%s<b> %a
%b'';
alignment = "center";
horizontal_alignment = "center";
icon_position = "left";
max_icon_size = 100;
separator_color = "#383838";
frame_color = "#383838";
frame_width = 2;
};
shortcuts = {
close = "ctrl+space";
history = "ctrl+shift+grave";
};
urgency_low = {
background = "#282828";
foreground = "#5882FA";
};
urgency_normal = {
background = "#282828";
foreground = "#5882FA";
};
urgency_critical = {
background = "#282828";
foreground = "#FF0040";
timeout = 0;
};
};
}

59
hm-configs/files.nix Normal file
View File

@ -0,0 +1,59 @@
{
".background-image".source = ../assets/background-image;
".lockscreen-image".source = ../assets/lockscreen-image;
".config/fish/fishfile".text = ''
laughedelic/pisces
joehillen/to-fish
jethrokuan/z
decors/fish-colored-man
franciscolourenco/done
haslersn/fish-nix-completions
gyakovlev/fish-fzy
joseluisq/gitnow
edc/bass
fishpkg/fish-get
fishpkg/fish-spin
oh-my-fish/plugin-bang-bang
fishpkg/fish-humanize-duration
jorgebucaran/fish-getopts
matthewess/fish-autovenv
'';
".config/fish/completions/pijul.fish".source = ../assets/pijul.fish;
".config/fish/completions/systemctl.fish".source = ../assets/systemctl.fish;
".config/fish/functions/colortest.fish".source = ../assets/colortest.fish;
".config/fish/functions/kbl.fish".text = ''
function kbl -a level
set -l initial (cat /sys/class/leds/tpacpi\:\:kbd_backlight/brightness)
test -z "$level"; and set -l level $initial
echo $level > /sys/class/leds/tpacpi\:\:kbd_backlight/brightness
end
'';
".config/fish/functions/mkdcd.fish".text = ''
function mkdcd -a target
mkdir $target
cd $target
end
'';
".config/fish/functions/unz.fish".text = ''
function unz -a target
# strip extensions
string match \*.zip $target; and set target (string split -r -m1 . $target)[1]
unzip -d $target $target
end
'';
".config/i3status.toml".source = ../assets/i3status.toml;
".config/kitty/kitty.conf".text = ''
font_family Fira Code Regular
bold_font Fira Code Bold
font_size 15.0
include ./theme.conf
'';
".config/kitty/theme.conf".source = ../assets/kitty-theme.conf;
".config/rofi/theme.rasi".source = ../assets/sidetab.rasi;
".config/pijul/config.toml".text = ''
[author]
name = "mat"
full_name = "mat"
email = "mat@mat.services"
'';
}

72
hm-configs/fish.nix Normal file
View File

@ -0,0 +1,72 @@
{ pkgs, ... }: {
enable = true;
package = pkgs.fish;
interactiveShellInit = ''
echo '(´) welcome (´)'
if not functions -q fisher
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
curl https://git.io/fisher --create-dirs -sLo $XDG_CONFIG_HOME/fish/functions/fisher.fish
fish -c fisher
end
fish_vi_key_bindings
set VIRTUAL_ENV_DISABLE_PROMPT true
alias cat=bat
alias br=broot
alias tree=br
alias ack=rg
alias ag=rg
alias grep=rg
alias sys="sudo systemctl"
alias rebuild="sudo nixos-rebuild switch"
alias rebuildd="sudo nixos-rebuild switch; and systemctl restart display-manager"
alias upgrade="sudo rm -rf /root/.cache/nix/tarballs; and sudo nix-channel --update; and sudo nixos-rebuild switch --upgrade"
alias clip="xclip -selection c"
alias cxuse="sudo cachix use -d ~/dotfiles.nix"
alias cxpsh="nix-shell --command exit; nix-store -qR --include-outputs (nix-instantiate shell.nix) | cachix push"
alias cxpush=cxpsh
function config -a file
if test -z "$file"
set file configuration
end
vim ~/dotfiles.nix/$file.nix +'cd %:p:h'
end
alias vims="vim -S Session.vim"
alias bigscreen="xrandr --output eDP1 --off --output HDMI2 --auto"
alias smallscreen="xrandr --output eDP1 --auto --output HDMI2 --off"
function tmux-ssh -a user -a host
set target "$user@$host"
set session "$user-$host"
env TERM=tmux-256color ssh $target -t "tmux -2 attach -t $session || tmux -2 new -s $session"
end
alias pi="tmux-ssh pi pi"
alias mir="tmux-ssh mat mir"
alias drop=mir
alias soviet="tmux-ssh mat soviet"
alias gagarin="tmux-ssh mat gagarin"
alias yuri=gagarin
alias gaga=gagarin
alias wifi="nmcli r w off; nmcli r w on"
alias nixops=~/dev/nixops/result/bin/nixops
bind \cr 'fzy_select_history (commandline -b)'
bind -M insert \cr 'fzy_select_history (commandline -b)'
bind \cf 'fzy_select_directory'
bind -M insert \cf 'fzy_select_directory'
bind -M insert ! __history_previous_command
bind -M insert '$' __history_previous_command_arguments
'';
}

View File

@ -1,4 +1,4 @@
{ lib, lockCmd, statusCmd, ... }: { { lib, statusCmd, ... }: {
enable = true; enable = true;
config = rec { config = rec {
fonts = [ "Aileron" "FontAwesome 14" ]; fonts = [ "Aileron" "FontAwesome 14" ];
@ -92,6 +92,7 @@
# "${modifier}+Shift+Right" = "workspace next"; # "${modifier}+Shift+Right" = "workspace next";
# "${modifier}+Shift+Left" = "workspace prev"; # "${modifier}+Shift+Left" = "workspace prev";
"${modifier}+d" = "exec --no-startup-id rofi -show run"; "${modifier}+d" = "exec --no-startup-id rofi -show run";
"${modifier}+g" = "exec --no-startup-id /home/mat/.bin/lagrange";
"XF86AudioRaiseVolume" = "exec --no-startup-id amixer sset Master 5%+"; "XF86AudioRaiseVolume" = "exec --no-startup-id amixer sset Master 5%+";
"XF86AudioLowerVolume" = "exec --no-startup-id amixer sset Master 5%-"; "XF86AudioLowerVolume" = "exec --no-startup-id amixer sset Master 5%-";
"XF86MonBrightnessUp" = "exec --no-startup-id light -A 10"; "XF86MonBrightnessUp" = "exec --no-startup-id light -A 10";
@ -99,7 +100,11 @@
}; };
workspaceLayout = "tabbed"; workspaceLayout = "tabbed";
assigns = { assigns = {
"1: web" = [{ class = "Firefox"; }]; "1: web" = [
{ class = "Firefox"; }
{ class = "(?i)castor"; }
{ class = "(?i)lagrange"; }
];
"2: devel" = [ "2: devel" = [
{ class = "(?i)kitty"; } { class = "(?i)kitty"; }
{ class = "(?i)(vsc|c)odium"; } { class = "(?i)(vsc|c)odium"; }
@ -111,7 +116,6 @@
{ class = "discord"; } { class = "discord"; }
{ class = "(?i)signal(-desktop)?"; } { class = "(?i)signal(-desktop)?"; }
{ class = "(?i)fractal"; } { class = "(?i)fractal"; }
{ class = "(?i)castor"; }
]; ];
"4: other" = [{ class = ".*"; }]; "4: other" = [{ class = ".*"; }];
}; };

23
hm-configs/neovim.nix Normal file
View File

@ -0,0 +1,23 @@
{ pkgs, ... }: {
enable = true;
viAlias = true;
vimAlias = true;
withNodeJs = true;
extraPython3Packages = ps: with ps; [ pynvim ];
plugins = with pkgs.vimPlugins; [
neovim-sensible
vim-fugitive
vim-surround
nerdtree
nerdtree-git-plugin
vim-colorschemes
vim-nix
lightline-vim
haskell-vim
auto-pairs
vim-fish
ctrlp
dhall-vim
];
extraConfig = builtins.readFile ../assets/init.vim;
}

18
hm-configs/vscode.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs, ... }: {
enable = true;
package = pkgs.vscodium.overrideAttrs (_: {
preFixupPhases = [ "preFixup" ];
preFixup = ''
sed -i "s#open-vsx.org/vscode/gallery#marketplace.visualstudio.com/_apis/public/gallery#" $out/lib/vscode/resources/app/product.json
sed -i "s#open-vsx.org/vscode/item#marketplace.visualstudio.com/items#" $out/lib/vscode/resources/app/product.json
sed -i "s#open-vsx.org#marketplace.visualstudio.com#" $out/lib/vscode/resources/app/product.json
'';
});
extensions = with pkgs.vscode-extensions; [
matklad.rust-analyzer
# ms-python.python
skyapps.fish-vscode
# TODO: reenable
# vadimcn.vscode-lldb
];
}

331
home.nix
View File

@ -1,331 +0,0 @@
{ pkgs, lib, ... }:
let
name = "Matthew Ess";
email = "daringseal@gmail.com";
workEmail = "mess@yelp.com";
lockCmd = "i3lock -i ~/.lockscreen-image";
statusCmd = "i3status-rs ~/.config/i3status.toml";
in {
nixpkgs = { config = { allowUnfree = true; }; };
home = {
sessionVariables = {
EDITOR = "vim";
BROWSER = "firefox";
TERMINAL = "kitty";
};
packages = with pkgs; [
# nix utilities
cachix
niv
nixfmt
nix-prefetch-git
# command line utilities
ag
bottom
du-dust
exercism
fzy
httpie
imagemagick
jq
pijul
procs
rlwrap
tealdeer
unzip
unrar
wireguard
# graphical applications
castor
deluge
discord
(dunst.override { dunstify = true; })
enpass
fractal
firefox
kitty
mullvad-vpn
signal-desktop
slack
steam
vlc
xfce.thunar
xfce.thunar-archive-plugin
# graphical utilities
clipmenu
clipnotify
dmenu
gnome3.gnome-disk-utility
i3lock
i3status-rust
libappindicator
libnotify
lxappearance
rofi
xclip
];
file = {
".background-image".source = ./assets/background-image;
".lockscreen-image".source = ./assets/lockscreen-image;
".config/fish/fishfile".text = ''
laughedelic/pisces
joehillen/to-fish
jethrokuan/z
decors/fish-colored-man
franciscolourenco/done
haslersn/fish-nix-completions
gyakovlev/fish-fzy
joseluisq/gitnow
edc/bass
fishpkg/fish-get
fishpkg/fish-spin
oh-my-fish/plugin-bang-bang
fishpkg/fish-humanize-duration
jorgebucaran/fish-getopts
matthewess/fish-autovenv
'';
".config/fish/completions/systemctl.fish".source =
./assets/systemctl.fish;
".config/fish/functions/colortest.fish".source = ./assets/colortest.fish;
".config/fish/functions/kbl.fish".text = ''
function kbl -a level
set -l initial (cat /sys/class/leds/tpacpi\:\:kbd_backlight/brightness)
test -z "$level"; and set -l level $initial
echo $level > /sys/class/leds/tpacpi\:\:kbd_backlight/brightness
end
'';
".config/fish/functions/mkdcd.fish".text = ''
function mkdcd -a target
mkdir $target
cd $target
end
'';
".config/fish/functions/unz.fish".text = ''
function unz -a target
# strip extensions
string match \*.zip $target; and set target (string split -r -m1 . $target)[1]
unzip -d $target $target
end
'';
".config/i3status.toml".source = ./assets/i3status.toml;
".config/kitty/kitty.conf".text = ''
font_family Fira Code Regular
bold_font Fira Code Bold
font_size 15.0
include ./theme.conf
'';
".config/kitty/theme.conf".source = ./assets/kitty-theme.conf;
# ".config/nvim/init.vim".source = ./assets/init.vim;
".config/rofi/theme.rasi".source = ./assets/sidetab.rasi;
};
};
programs = {
alacritty = {
enable = false;
settings = {
font = {
normal.family = "Fira Code";
size = 10.5;
};
};
};
bat.enable = true;
broot.enable = true;
command-not-found.enable = true;
direnv.enable = true;
feh.enable = true;
firefox.enable = true;
fish = {
enable = true;
package = pkgs.fish;
interactiveShellInit = ''
echo '(´) welcome (´)'
if not functions -q fisher
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
curl https://git.io/fisher --create-dirs -sLo $XDG_CONFIG_HOME/fish/functions/fisher.fish
fish -c fisher
end
fish_vi_key_bindings
set VIRTUAL_ENV_DISABLE_PROMPT true
alias cat=bat
alias br=broot
alias tree=br
alias ack=ag
alias grep=ag
alias sys="sudo systemctl"
alias rebuild="sudo nixos-rebuild switch"
alias rebuildd="sudo nixos-rebuild switch; and systemctl restart display-manager"
alias upgrade="sudo rm -rf /root/.cache/nix/tarballs; and sudo nix-channel --upgrade; and sudo nixos-rebuild switch --upgrade"
alias clip="xclip -selection c"
alias cxuse="sudo cachix use -d ~/dotfiles.nix"
alias cxpsh="nix-shell --command exit; nix-store -qR --include-outputs (nix-instantiate shell.nix) | cachix push"
alias cxpush=cxpsh
alias home="vim ~/dotfiles.nix/home.nix +'cd %:p:h'"
alias i3="vim ~/dotfiles.nix/i3.nix +'cd %:p:h'"
alias config="vim ~/dotfiles.nix/configuration.nix +'cd %:p:h'"
alias vims="vim -S Session.vim"
alias bigscreen="xrandr --output eDP1 --off --output HDMI2 --auto"
alias smallscreen="xrandr --output eDP1 --auto --output HDMI2 --off"
alias pi="env TERM=xterm ssh pi@pi"
alias drop="env TERM=xterm ssh mat@drop"
alias wgup="wg-quick up wg0"
alias wgdn="wg-quick down wg0"
alias wifi="nmcli r w off; nmcli r w on"
bind \cr 'fzy_select_history (commandline -b)'
bind -M insert \cr 'fzy_select_history (commandline -b)'
bind \cf 'fzy_select_directory'
bind -M insert \cf 'fzy_select_directory'
bind -M insert ! __history_previous_command
bind -M insert '$' __history_previous_command_arguments
'';
};
git = {
enable = true;
userName = "${name}";
userEmail = "${email}";
ignores = [ ".*.sw[a-z]" "tags" ];
extraConfig = {
color.ui = true;
core.editor = "vim";
push.default = "simple";
init.defaultBranch = "main";
};
};
htop = {
enable = true;
highlightBaseName = true;
};
jq.enable = true;
man.enable = true;
neovim = {
enable = true;
viAlias = true;
vimAlias = true;
withNodeJs = true;
extraPython3Packages = ps: with ps; [ pynvim ];
plugins = with pkgs.vimPlugins; [
neovim-sensible
vim-fugitive
vim-surround
nerdtree
nerdtree-git-plugin
vim-colorschemes
vim-nix
lightline-vim
haskell-vim
auto-pairs
vim-fish
LanguageClient-neovim
ncm2
ncm2-path
nvim-yarp
ctrlp
dhall-vim
];
extraConfig = builtins.readFile ./assets/init.vim;
};
rofi = {
enable = true;
font = "Fira Code 14";
lines = 10;
location = "center";
theme = "~/.config/rofi/theme.rasi";
};
ssh = {
enable = true;
extraOptionOverrides = { "AddKeysToAgent" = "true"; };
matchBlocks = {
"drop".hostname = "104.131.174.193";
"pi".hostname = "192.168.1.165";
};
};
starship.enable = true;
vscode = {
enable = true;
package = pkgs.vscodium.overrideAttrs (_: {
preFixupPhases = [ "preFixup" ];
preFixup = ''
sed -i "s#open-vsx.org/vscode/gallery#marketplace.visualstudio.com/_apis/public/gallery#" $out/lib/vscode/resources/app/product.json
sed -i "s#open-vsx.org/vscode/item#marketplace.visualstudio.com/items#" $out/lib/vscode/resources/app/product.json
sed -i "s#open-vsx.org#marketplace.visualstudio.com#" $out/lib/vscode/resources/app/product.json
'';
});
extensions = with pkgs.vscode-extensions; [
matklad.rust-analyzer
# ms-python.python
skyapps.fish-vscode
vadimcn.vscode-lldb
];
};
};
services = {
dunst = {
enable = true;
settings = {
global = {
geometry = "0x5-30+20";
notification_height = 25;
indicate_hidden = "yes";
corner_radius = 5;
padding = 10;
horizontal_padding = 10;
idle_threshold = 60;
font = "Fira Code 16";
markup = "full";
format = ''
<b>%s<b> %a
%b'';
alignment = "center";
horizontal_alignment = "center";
icon_position = "left";
separator_color = "#383838";
frame_color = "#383838";
frame_width = 2;
};
shortcuts = {
close = "ctrl+space";
history = "ctrl+shift+grave";
};
urgency_low = {
background = "#282828";
foreground = "#5882FA";
};
urgency_normal = {
background = "#282828";
foreground = "#5882FA";
};
urgency_critical = {
background = "#282828";
foreground = "#FF0040";
timeout = 0;
};
};
};
gnome-keyring.enable = true;
lorri.enable = true;
redshift = {
enable = true;
provider = "geoclue2";
};
screen-locker = {
enable = false;
lockCmd = "${lockCmd}";
};
};
xsession = {
enable = true;
scriptPath = ".hm-xsession";
windowManager = {
i3 = import ./i3.nix { inherit lib lockCmd statusCmd; };
awesome = {
enable = false;
};
};
};
}

17
install.sh Normal file → Executable file
View File

@ -1,5 +1,16 @@
#!/bin/bash #!/usr/bin/env bash
sudo ln -s $PWD/configuration.nix /etc/nixos/configuration.nix machine=$1
sudo ln -s $PWD/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
if [[ -z "$machine" ]]; then
machine=$(hostname)
fi
if [[ ! -d "machines/$machine" ]]; then
echo "$machine is not a known machine"
exit
else
echo "Linking ./machines/$machine/configuration.nix to /etc/nixos/configuration.nix"
fi
sudo ln -sf $PWD/machines/$machine/configuration.nix /etc/nixos/configuration.nix

View File

@ -0,0 +1,37 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports = [ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 64;
boot.loader.efi.canTouchEfiVariables = true;
console.earlySetup = true;
networking.hostName = "gagarin"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp0s31f6.useDHCP = true;
# 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. Its 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.09"; # Did you read the comment?
}

View File

@ -0,0 +1,41 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports = [
# Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
../../profiles/laptop.nix
];
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 64;
boot.loader.efi.canTouchEfiVariables = true;
console.earlySetup = true;
networking = {
hostName = "nixpad"; # Define your hostname.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
useDHCP = false;
interfaces = {
enp0s25.useDHCP = true;
wlp3s0.useDHCP = true;
# wwp0s20u4c2i12.useDHCP = true;
};
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "19.09"; # Did you read the comment?
}

10
profiles/caches.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, ... }: {
imports = [ # Cachix caches
../cachix.nix
];
nix = {
binaryCaches = [ "https://hydra.iohk.io" ];
binaryCachePublicKeys =
[ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
};
}

37
profiles/common.nix Normal file
View File

@ -0,0 +1,37 @@
{ config, pkgs, lib, ... }: {
imports = [
# basic services
../services/ssh.nix
../services/vpn.nix
../services/l10n.nix
./caches.nix
./quicksudo.nix
../users/mat.nix
../users/mat-hm.nix
];
system.autoUpgrade.enable = true;
system.copySystemConfiguration = true;
environment.systemPackages = with pkgs; [
fish
git
htop
tmux
tree
unzip
vim
wget
zip
];
environment.variables = {
"EDITOR" = "vim";
"VISUAL" = "vim";
};
programs = {
fish.enable = false;
ssh = { startAgent = true; };
};
}

16
profiles/fonts.nix Normal file
View File

@ -0,0 +1,16 @@
{ config, pkgs, ... }: {
fonts = {
enableDefaultFonts = true;
fonts = with pkgs; [
source-code-pro
fira-code
fira-code-symbols
font-awesome_4
aileron
];
fontconfig = {
enable = true;
defaultFonts = { monospace = [ "Fira Code" ]; };
};
};
}

49
profiles/graphical.nix Normal file
View File

@ -0,0 +1,49 @@
{ config, pkgs, lib, ... }: {
imports = [ ./fonts.nix ];
programs = {
light.enable = true;
nm-applet.enable = true;
};
networking = {
networkmanager = {
enable = true;
wifi.scanRandMacAddress = false;
};
};
services = {
clipmenu.enable = true;
geoclue2.enable = true;
gvfs.enable = true;
xserver = {
enable = true;
videoDrivers = [ "intel" ];
deviceSection = ''
Option "DRI" "3"
Option "TearFree" "true"
'';
useGlamor = true;
desktopManager = {
session = [{
name = "home-manager";
start = ''
${pkgs.runtimeShell} $HOME/.hm-xsession &
waitPID=$!
'';
}];
};
displayManager = {
defaultSession = "home-manager";
autoLogin = {
enable = true;
user = "mat";
};
};
};
};
}

42
profiles/laptop.nix Normal file
View File

@ -0,0 +1,42 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ./graphical.nix ../users/mat-hm-laptop.nix ];
# enable power management
powerManagement.enable = true;
services = {
upower.enable = true;
xserver = {
# Enable touchpad support.
libinput = {
enable = true;
naturalScrolling = true;
disableWhileTyping = true;
};
};
};
# Enable sound.
sound.enable = true;
# Hardware switches
hardware = {
logitech.wireless = {
enable = true;
# enableGraphical = true;
};
opengl = {
driSupport32Bit = true;
extraPackages32 = [ pkgs.pkgsi686Linux.libva ];
};
pulseaudio = {
enable = true;
support32Bit = true;
};
};
nixpkgs.config.allowUnfree = true;
}

4
profiles/quicksudo.nix Normal file
View File

@ -0,0 +1,4 @@
{ config, ... }: {
# Don't ask for my password *quite* as often.
security.sudo.extraConfig = "Defaults timestamp_timeout=60";
}

13
services/l10n.nix Normal file
View File

@ -0,0 +1,13 @@
{ config, ... }: {
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
services.xserver.layout = "us";
# Set your time zone.
time.timeZone = "America/New_York";
}

4
services/pubkey.nix Normal file
View File

@ -0,0 +1,4 @@
{
mat =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDrPN7A8SFsP9P+jwYGAr3elsVabXaiLhb20YYxhCSS0wPiYXv1Ko2ucPQTOY9Skx3EiYPGBqEeh5o11cPwPowfiRL6fq7YTxMZDJLPtEHxPpWY+/f3my6hscSsH00M02ZQ+iebu1VXA1YHGma9v5MOSDqic4R+ic6lGK+H/Efi8M8z8nT5+nI0+f8sEhG/8D4VVcmNnb/AW1tHYqdInU28A0kboA4N3ED/7Tb2GyVCWmYEryKxTa8Z9f2Bp9TRn9TPX7Wwo2op+EfxBe30XTHqWnb/vk5GBjd9OCJhBSVun4ecfmT2iTsLr9zVuCL6KVcSq849I+EE0Qaase1SNFd6J2zAe6IEQ7ePwwWZVmncQFsvzAwQ40X2AmHbY6zTAxQenQHPpG3yuDCcyov425c7QAnTkJGQl6uFGAb++tgryfCMVj5rri14FaAk2VPz6tX3Xivvi0g4fTeDrPEyYRadko4/RVw8p04Dbefod7sjUOlfyKA5cDDWJVmVE3C3dfp7ykrZRKFYzg5xij4ClRYyUN2ZmmtCnTO5ktH7qeZ8K3Sx1IPZ29+whSEpCl5lfC6Tv9Mx7v5rRV+SIq4D49FVbhR+rNCDApyYnyK3r2ybHz46zmMiRXaHzFmRVfd59nII37qA/d157YHYc/s5ec0IsI6Sc8TNeMtMyUiKdqJrDQ== matthewess";
}

12
services/ssh.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
let pubkey = import ./pubkey.nix;
in {
services.openssh = {
enable = true;
permitRootLogin = "yes";
passwordAuthentication = lib.mkDefault false;
};
users.users.root.openssh.authorizedKeys.keys = lib.mkDefault [ pubkey.mat ];
}

4
services/vpn.nix Normal file
View File

@ -0,0 +1,4 @@
{ config, pkgs, lib, ... }: {
networking.wireguard.enable = true;
services.mullvad-vpn.enable = true;
}

103
users/mat-hm-laptop.nix Normal file
View File

@ -0,0 +1,103 @@
{ config, ... }:
let
statusCmd = "i3status-rs ~/.config/i3status.toml";
in {
home-manager.users.mat = { pkgs, lib, ... }: {
home = {
sessionVariables = {
BROWSER = "firefox";
TERMINAL = "kitty";
};
packages = with pkgs; [
# command line utilities
asuka
bottom
du-dust
fzy
httpie
imagemagick
jq
pijul
procs
# graphical applications
deluge
discord
(dunst.override { dunstify = true; })
enpass
fractal
firefox
kitty
signal-desktop
slack
# steam
vlc
xfce.thunar
xfce.thunar-archive-plugin
# graphical utilities
clipmenu
clipnotify
dmenu # needed for clipmenu
gnome3.gnome-disk-utility
i3status-rust
libappindicator
libnotify
lxappearance
rofi
xclip
];
file = import ../hm-configs/files.nix;
};
programs = {
alacritty = {
enable = false;
settings = {
font = {
normal.family = "Fira Code";
size = 10.5;
};
};
};
feh.enable = true;
firefox.enable = true;
fish = import ../hm-configs/fish.nix { inherit pkgs; };
jq.enable = true;
neovim = import ../hm-configs/neovim.nix { inherit pkgs; };
rofi = {
enable = true;
font = "Fira Code 14";
lines = 10;
location = "center";
theme = "~/.config/rofi/theme.rasi";
};
ssh = {
enable = true;
extraOptionOverrides = { "AddKeysToAgent" = "true"; };
matchBlocks = {
"pi".hostname = "192.168.1.165";
"gagarin".hostname = "192.168.1.246";
"mir".hostname = "138.197.58.58";
"soviet".hostname = "soviet.circumlunar.space";
};
};
vscode = import ../hm-configs/vscode.nix { inherit pkgs; };
};
services = {
redshift = {
enable = true;
provider = "geoclue2";
};
};
xsession = {
enable = true;
scriptPath = ".hm-xsession";
windowManager = {
i3 = import ../hm-configs/i3.nix { inherit lib statusCmd; };
awesome = { enable = false; };
};
};
};
}

75
users/mat-hm.nix Normal file
View File

@ -0,0 +1,75 @@
{ config, ... }:
let
name = "Matthew Ess";
email = "mat@mat.services";
in {
imports = [ <home-manager/nixos> ];
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.users.mat = { pkgs, ... }: {
home = {
sessionVariables = { EDITOR = "vim"; };
packages = with pkgs; [
# nix utilities
cachix
niv
nixfmt
nix-prefetch-git
fish-foreign-env
# command line utils
ripgrep
rlwrap
tealdeer
unrar
mullvad-vpn
];
};
programs = {
bat.enable = true;
broot.enable = true;
command-not-found.enable = true;
direnv.enable = true;
fish.enable = true;
git = {
enable = true;
userName = "${name}";
userEmail = "${email}";
ignores = [ ".*.sw[a-z]" "tags" ];
extraConfig = {
color.ui = true;
core.editor = "vim";
push.default = "simple";
init.defaultBranch = "main";
};
};
htop = {
enable = true;
highlightBaseName = true;
};
man.enable = true;
ssh = {
enable = true;
serverAliveInterval = 60;
};
starship.enable = true;
tmux = {
enable = true;
keyMode = "vi";
newSession = true;
shortcut = "a";
baseIndex = 1;
};
};
services = { lorri.enable = true; };
};
}

15
users/mat.nix Normal file
View File

@ -0,0 +1,15 @@
{ config, pkgs, lib, ... }:
{
users.users.mat = {
isNormalUser = true;
shell = pkgs.fish;
extraGroups = lib.mkDefault [
"wheel" # enable sudo
"networkmanager"
"audio"
"video"
];
};
}