Compare commits

...

4 commits

Author SHA1 Message Date
013112f692 minor cleanup 2023-07-23 16:16:55 -05:00
936693edaf update readme 2023-07-23 16:14:48 -05:00
f99d6f8412 add vscode
also misc. formatting cleanup, groundwork for machine-specific
environments
2023-07-23 16:09:58 -05:00
38cad0c658 initial swing at a flaky home manager nix 2023-07-23 13:44:51 -05:00
9 changed files with 378 additions and 1 deletions

16
.gitignore vendored Normal file
View file

@ -0,0 +1,16 @@
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
.history/
*.vsix
.direnv
result
__pycache__
**.pyc

View file

@ -1,5 +1,10 @@
# Config files
## Nix
I've started the process of leveraging [Nix](https://nixos.org/explore.html) to manage my system configurations. This repo will (eventually?) hold files used for managing user environments with [Home Manager](https://github.com/nix-community/home-manager). The goods are in [flake.nix](./flake.nix) and the [nix](./nix/) directory.
It's very much a work-in-progress though so the legacy dotfile configs are below.
## Legacy stuff
Clone the repo:
```sh
git clone https://github.com/jbowdre/dotfiles.git ~/.dotfiles
@ -11,4 +16,4 @@ ln -s ~/.dotfiles/vim/.vimrc ~/.vimrc
ln -s ~/.dotfiles/tmux/.tmux.conf ~/.tmux.conf
ln -s ~/.dotfiles/pwsh/Microsoft.PowerShell_profile.ps1 ~/.config/powershell/Microsoft.PowerShell_profile.ps1
```
```

48
flake.lock Normal file
View file

@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1690084763,
"narHash": "sha256-Nw680m/pyVoosSgXZW415Z657mfVM2BxaxDPjEk48Z0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "fb03fa5516d4e86059d24ab35a611ffa3a359547",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1690083312,
"narHash": "sha256-I3egwgNXavad1eIjWu1kYyi0u73di/sMmlnQIuzQASk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "af8cd5ded7735ca1df1a1174864daab75feeb64a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

29
flake.nix Normal file
View file

@ -0,0 +1,29 @@
{
description = "A Very Flakey Home Manager";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {nixpkgs, home-manager, ...}:
let
system = "x86_64-linux";
in {
defaultPackage.${system} = home-manager.defaultPackage.${system};
homeConfigurations = {
"john@penguin" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "${system}";
config.allowUnfree = true;
};
modules = [ ./nix/machines/penguin/home.nix ];
};
};
};
}

83
nix/common/home.nix Normal file
View file

@ -0,0 +1,83 @@
{ pkgs, lib, config, ... }: {
imports = [
../lib/tmux.nix
../lib/vim.nix
];
# home-manager config
home.username = "john";
home.homeDirectory = "/home/john";
home.stateVersion = "23.05"; # Please read the comment before changing.
programs.home-manager.enable = true;
targets.genericLinux.enable = true;
# home files
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# env vars
home.sessionVariables = {
EDITOR = "vim";
};
# packages
home.packages = with pkgs; [
babelfish
fish
htop
hugo
libvirt
packer
powershell
terraform
tldr
vagrant
vault
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Fish shell settings
programs.fish = {
enable = true;
shellInit = "source ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish";
functions = {
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles";
};
};
# git settings
programs.git = {
enable = true;
delta.enable = true;
extraConfig = {
init.defaultBranch = "main";
pull.ff = "only";
};
};
# XDG settings
xdg.enable = true;
xdg.mime.enable = true;
}

63
nix/lib/tmux.nix Normal file
View file

@ -0,0 +1,63 @@
{ pkgs, lib, ...}: {
programs.tmux = {
enable = true;
baseIndex = 1;
clock24 = true;
escapeTime = 50;
historyLimit = 100000;
keyMode = "vi";
mouse = true;
plugins = with pkgs.tmuxPlugins; [ ];
extraConfig = ''
# navigating panes with Ctrl+{hjkl}
bind -n C-h select-pane -L
bind -n C-j select-pane -D
bind -n C-k select-pane -U
bind -n C-l select-pane -R
# synchronize panes with S
bind S set-window-option synchronize-panes \; display-message 'Synchronize-panes #{?pane_synchronized,on,off}'
# swap panes with <>
bind > swap-pane -D
bind < swap-pane -U
# window operations
unbind n
unbind w
bind n command-prompt "rename-window '%%'"
bind w new-window -c "#{pane_current_path}"
bind -n M-j previous-window # alt+j
bind -n M-k next-window # alt+k
# default statusbar colors
set-option -g status-style fg=yellow,bg=black
# default window title colors
set-window-option -g window-status-style fg=brightblue,bg=default
#set-window-option -g window-status-style dim
# active window title colors
set-window-option -g window-status-current-style fg=brightred,bg=default
#set-window-options -g window-status-current-style bright
# pane border
set-option -g pane-border-style fg=black
set-option -g pane-active-border-style fg=brightgreen
# message text
set-option -g message-style fg=brightred,bg=black
# pane number display
set-option -g display-panes-active-colour blue
set-option -g display-panes-colour brightred
# clock
set-window-option -g clock-mode-colour brightgreen
# bell
set-window-option -g window-status-bell-style fg=black,bg=red
'';
};
}

65
nix/lib/vim.nix Normal file
View file

@ -0,0 +1,65 @@
{ pkgs, lib, ... }: {
programs.vim = {
enable = true;
defaultEditor = true;
settings = {
background = "dark";
expandtab = true;
number = true;
shiftwidth = 2;
tabstop = 2;
};
plugins = with pkgs.vimPlugins; [
nerdcommenter
vim-go
vim-sensible
vim-trailing-whitespace
];
extraConfig = ''
" Tmux integration to switch panes with Ctrl+{hkjl}
if exists('$TMUX')
function! TmuxOrSplitSwitch(wincmd, tmuxdir)
let previous_winnr = winnr()
silent! execute "wincmd " . a:wincmd
if previous_winnr == winnr()
call system("tmux select-pane -" . a:tmuxdir)
redraw!
endif
endfunction
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', "", "")
let &t_ti = "\<Esc>2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>2;". previous_title . "\<Esc>\\" . &t_te
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
else
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
endif
" coding preference
filetype off
filetype plugin indent on
syntax on
set backspace=indent,eol,start
set noautoindent
set noswapfile
set ruler
set showmatch
set smarttab
set sts=2
let g:NERDSpaceDelims=1
let mapleader=","
if has("autocmd")
autocmd FileType go set ts=2 sw=2 sts=2 noet nolist autowrite
endif
'';
};
}

55
nix/lib/vscode.nix Normal file
View file

@ -0,0 +1,55 @@
{ pkgs, lib, ...}: {
programs.vscode = {
enable = true;
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
extensions = with pkgs.vscode-extensions; [
bbenoist.nix
eamodio.gitlens
github.copilot
golang.go
hashicorp.terraform
ms-kubernetes-tools.vscode-kubernetes-tools
ms-vscode-remote.remote-ssh
ms-vscode.powershell
redhat.vscode-yaml
timonwong.shellcheck
vscodevim.vim
yzhang.markdown-all-in-one
];
userSettings = {
"diffEditor.ignoreTrimWhitespace" = false;
"editor.acceptSuggestionOnCommitCharacter" = false;
"editor.acceptSuggestionOnEnter" = "off";
"editor.lineNumbers" = "relative";
"editor.renderControlCharacters" = true;
"editor.renderWhitespace" = "boundary";
"editor.tabCompletion" = "off";
"editor.tabSize" = 2;
"explorer.confirmDragAndDrop" = false;
"files.hotExit" = "onExitAndWindowClose";
"git.confirmSync" = false;
"git.ignoreLegacyWarning" = true;
"powershell.codeFormatting.useCorrectCasing" = true;
"security.workspace.trust.untrustedFiles" = "open";
"vim.statusBarColorControl" = true;
"vim.useCtrlKeys" = false;
"window.restoreWindows" = "all";
"workbench.startupEditor" = "none";
"workbench.colorCustomizations" = {
"statusBar.background" = "#005f5f";
"statusBar.debuggingBackground" = "#005f5f";
"statusBar.noFolderBackground" = "#005f5f";
};
"vim.normalModeKeyBindings" = [
{
"after" = ["@q"];
"before" = ["Q"];
}
];
};
};
services.gnome-keyring.enable = true;
}

View file

@ -0,0 +1,13 @@
{ pkgs, lib, config, ... }: {
imports = [
../../common/home.nix
../../lib/vscode.nix
];
# packages
home.packages = with pkgs; [
firefox-esr
obsidian
qFlipper
];
}