diff --git a/flake.nix b/flake.nix index c02ecd9..6c88df6 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ]; + }; + }; + }; + } diff --git a/nix/common/home.nix b/nix/common/home.nix index a278d07..fe34be8 100644 --- a/nix/common/home.nix +++ b/nix/common/home.nix @@ -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"; }; }; diff --git a/nix/lib/tmux.nix b/nix/lib/tmux.nix index d6372ff..94b3828 100644 --- a/nix/lib/tmux.nix +++ b/nix/lib/tmux.nix @@ -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} diff --git a/nix/lib/vim.nix b/nix/lib/vim.nix index 2a069e5..fb37202 100644 --- a/nix/lib/vim.nix +++ b/nix/lib/vim.nix @@ -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 = "\2;vim\\\" . &t_ti - let &t_te = "\2;". previous_title . "\\\" . &t_te + let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', "", "") + let &t_ti = "\2;vim\\\" . &t_ti + let &t_te = "\2;". previous_title . "\\\" . &t_te - nnoremap :call TmuxOrSplitSwitch('h', 'L') - nnoremap :call TmuxOrSplitSwitch('j', 'D') - nnoremap :call TmuxOrSplitSwitch('k', 'U') - nnoremap :call TmuxOrSplitSwitch('l', 'R') - else - map h - map j - map k - map l - endif + nnoremap :call TmuxOrSplitSwitch('h', 'L') + nnoremap :call TmuxOrSplitSwitch('j', 'D') + nnoremap :call TmuxOrSplitSwitch('k', 'U') + nnoremap :call TmuxOrSplitSwitch('l', 'R') + else + map h + map j + map k + map 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 + ''; + }; } diff --git a/nix/lib/vscode.nix b/nix/lib/vscode.nix new file mode 100644 index 0000000..3d5eaeb --- /dev/null +++ b/nix/lib/vscode.nix @@ -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; +} + diff --git a/nix/machines/penguin/home.nix b/nix/machines/penguin/home.nix new file mode 100644 index 0000000..1bc6cb7 --- /dev/null +++ b/nix/machines/penguin/home.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, config, ... }: { + imports = [ + ../../common/home.nix + ../../lib/vscode.nix + ]; + + # packages + home.packages = with pkgs; [ + firefox-esr + obsidian + qFlipper + ]; +}