add vscode

also misc. formatting cleanup, groundwork for machine-specific
environments
This commit is contained in:
John Bowdre 2023-07-23 16:09:58 -05:00
parent 38cad0c658
commit f99d6f8412
6 changed files with 137 additions and 67 deletions

View file

@ -1,26 +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";
};
};
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};
outputs = {nixpkgs, home-manager, ...}:
let
system = "x86_64-linux";
in {
defaultPackage.${system} = home-manager.defaultPackage.${system};
homeConfigurations = {
"john" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "${system}"; };
homeConfigurations = {
"john@penguin" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "${system}";
config.allowUnfree = true;
};
modules = [ ./nix/common/home.nix ];
};
};
};
}
modules = [ ./nix/machines/penguin/home.nix ];
};
};
};
}

View file

@ -8,7 +8,6 @@
home.homeDirectory = "/home/john";
home.stateVersion = "23.05"; # Please read the comment before changing.
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
targets.genericLinux.enable = true;
# home files
@ -17,7 +16,6 @@
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# ".vimrc".source = .dotfiles/vim/.vimrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
@ -39,6 +37,7 @@
hugo
libvirt
packer
powershell
terraform
tldr
vagrant
@ -74,8 +73,8 @@
userEmail = "john@bowdre.net";
userName = "John Bowdre";
extraConfig = {
pull.ff = "only";
init.defaultBranch = "main";
pull.ff = "only";
};
};

View file

@ -3,10 +3,10 @@
enable = true;
baseIndex = 1;
clock24 = true;
mouse = true;
escapeTime = 50;
historyLimit = 100000;
keyMode = "vi";
escapeTime = 50;
mouse = true;
plugins = with pkgs.tmuxPlugins; [ ];
extraConfig = ''
# navigating panes with Ctrl+{hjkl}

View file

@ -10,56 +10,56 @@
tabstop = 2;
};
plugins = with pkgs.vimPlugins; [
vim-trailing-whitespace
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
" 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
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
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
" 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
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
'';
};
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
];
}