mirror of
https://github.com/jbowdre/dotfiles.git
synced 2024-11-22 01:12:19 +00:00
initial swing at a flaky home manager nix
This commit is contained in:
parent
590f2a54fc
commit
38cad0c658
6 changed files with 304 additions and 0 deletions
16
.gitignore
vendored
Normal file
16
.gitignore
vendored
Normal 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
|
||||
|
48
flake.lock
Normal file
48
flake.lock
Normal 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
|
||||
}
|
26
flake.nix
Normal file
26
flake.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
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" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = import nixpkgs { system = "${system}"; };
|
||||
|
||||
modules = [ ./nix/common/home.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
86
nix/common/home.nix
Normal file
86
nix/common/home.nix
Normal file
|
@ -0,0 +1,86 @@
|
|||
{ 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;
|
||||
nixpkgs.config.allowUnfree = 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;
|
||||
# ".vimrc".source = .dotfiles/vim/.vimrc;
|
||||
|
||||
# # 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
|
||||
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;
|
||||
userEmail = "john@bowdre.net";
|
||||
userName = "John Bowdre";
|
||||
extraConfig = {
|
||||
pull.ff = "only";
|
||||
init.defaultBranch = "main";
|
||||
};
|
||||
};
|
||||
|
||||
# XDG settings
|
||||
xdg.enable = true;
|
||||
xdg.mime.enable = true;
|
||||
|
||||
}
|
63
nix/lib/tmux.nix
Normal file
63
nix/lib/tmux.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ pkgs, lib, ...}: {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
baseIndex = 1;
|
||||
clock24 = true;
|
||||
mouse = true;
|
||||
historyLimit = 100000;
|
||||
keyMode = "vi";
|
||||
escapeTime = 50;
|
||||
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
65
nix/lib/vim.nix
Normal 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; [
|
||||
vim-trailing-whitespace
|
||||
nerdcommenter
|
||||
vim-go
|
||||
vim-sensible
|
||||
];
|
||||
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
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue