From 44eee99af9551ab52aa09b7ee23c567bccc13b9e Mon Sep 17 00:00:00 2001 From: Mark Nipper Date: Thu, 14 Mar 2024 01:21:25 -0700 Subject: Add initial Home Manager configuration --- ginaz/flake.lock | 21 ++++ ginaz/flake.nix | 15 ++- ginaz/home.nix | 284 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 317 insertions(+), 3 deletions(-) create mode 100644 ginaz/home.nix diff --git a/ginaz/flake.lock b/ginaz/flake.lock index fa62f4a..c050cef 100644 --- a/ginaz/flake.lock +++ b/ginaz/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710349883, + "narHash": "sha256-bjbdS2mC76xNJwt1d/uZa+JdHR8CCyYbF4Ey/NgOJus=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2f0db7d418e781354d8a3c50e611e3b1cd413087", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1710272261, @@ -18,6 +38,7 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "nixpkgs": "nixpkgs" } } diff --git a/ginaz/flake.nix b/ginaz/flake.nix index 03a0b27..b60a38a 100644 --- a/ginaz/flake.nix +++ b/ginaz/flake.nix @@ -2,13 +2,22 @@ description = "nipsy's NixOS configuration"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs }: { + outputs = inputs@{ nixpkgs, home-manager, ... }: { nixosConfigurations.ginaz = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - modules = [ ./configuration.nix ]; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + #home-manager.useUserPackages = true; + home-manager.users.nipsy = import ./home.nix; + } + ]; }; }; } diff --git a/ginaz/home.nix b/ginaz/home.nix new file mode 100644 index 0000000..2b3d461 --- /dev/null +++ b/ginaz/home.nix @@ -0,0 +1,284 @@ +{ config, pkgs, ... }: + +{ + home.username = "nipsy"; + home.homeDirectory = "/home/nipsy"; + home.stateVersion = "23.11"; + + programs.git = { + enable = true; + userName = "Mark Nipper"; + userEmail = "nipsy@bitgnome.net"; + extraConfig.pull.rebase = true; + }; + + programs.home-manager.enable = true; + + programs.tmux = { + enable = true; + extraConfig = '' + #set-option -ga terminal-overrides ",st-256color:Tc" + set -as terminal-features ",foot*:RGB" + set -as terminal-features ",st-256color:RGB" + set -ga monitor-bell on + set -g history-limit 100000 + set -g bell-action any + #set -g bell-on-alert on + + set -s escape-time 0 + + setw -g aggressive-resize on + setw -g wrap-search off + + bind-key a send-prefix + bind-key k kill-session + bind-key H pipe-pane -o 'cat >> ~/.tmux.log.#h-#S-#I-#P' + + #bind-key m \ + # set -g mouse on \;\ + # display 'Mouse: ON' + #bind M \ + # set -g mouse off \;\ + # display 'Mouse: OFF' + + # vim-like copypaste mode + set-window-option -g mode-keys vi + bind-key -T copy-mode-vi v send -X begin-selection + bind-key -T copy-mode-vi y send -X copy-pipe "xclip -selection clipboard" + bind-key -T copy-mode-vi C-v send -X rectangle-toggle + bind-key P run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux paste-buffer" + + # don't exit copy mode after selection + #set -s mouse on + #bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection -x + ''; + }; + + programs.vim = { + enable = true; + extraConfig = '' + " Handling of big files - William Natter, Tony Mechelynck and others + " fairly certain that BufSizeThreshold is in bytes + let g:SaveUndoLevels = &undolevels + let g:BufSizeThreshold = 5242880 + if has("autocmd") + au VimEnter * let g:SaveUndoLevels = &undolevels + au BufReadPre * if getfsize(expand("%")) >= g:BufSizeThreshold | setlocal noswapfile | endif + au BufEnter * if getfsize(expand("%")) < g:BufSizeThreshold | let &undolevels=g:SaveUndoLevels | else | setlocal undolevels=-1 | endif + au BufEnter * if getfsize(expand("%")) < g:BufSizeThreshold | syntax on | else | syntax off | endif + endif + + set mouse& + set noautoindent " always set autoindenting off + + " enable better 24-bit color support + "let &t_8f = "\[38;2;%lu;%lu;%lum" + "let &t_8b = "\[48;2;%lu;%lu;%lum" + set termguicolors + + " If using a dark background within the editing area and syntax highlighting + " turn on this option as well + set background=dark + + if has("autocmd") + " Enabled file type detection + " Use the default filetype settings. If you also want to load indent files + " to automatically do language-dependent indenting add 'indent' as well. + filetype plugin on + "filetype indent on + endif " has ("autocmd") + + " The following are commented out as they cause vim to behave a lot + " different from regular vi. They are highly recommended though. + set showcmd " Show (partial) command in status line. + set showmatch " Show matching brackets. + set ignorecase " Do case insensitive matching + set incsearch " Incremental search + "set expandtab " replace tabs with spaces + set smarttab " use shiftwidth instead of tabstop at start of line + set spell spelllang=en_us " turn on the spell check + + set laststatus=2 + set statusline=%<%f%h%m%r%=%{&ff}\ %Y\ %b\ 0x%B\ \ %l,%c%V\ %P + + map :w:!clear;go run % + map :w:%! gofmt + ''; + }; + + programs.zsh = { + enable = true; + initExtra = '' +umask 022 + +#export GOROOT="''${HOME}/.local/go" +#export GOPATH="''${HOME}/go" + +#export PATH="$HOME/bin:$GOROOT/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin" +#export PATH="$HOME/bin:$GOROOT/bin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin" +#export PATH=~/bin::~/.local/rust/cargo/bin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin +export PATH=~/bin:''${PATH} + +#export PS1="%B%n%b@%U%m%u/%l:%~> " +export PAGER=less +export EDITOR=vim +export BROWSER=firefox + +export LC_COLLATE="C" +eval $(dircolors) +export QUOTING_STYLE="literal" + +export IRCNICK="nipsy" +export IRCNAME="Mark Nipper" + +export NNTPSERVER="news.giganews.com" + +#export HISTFILE="$HOME/.zsh_hist" +export HISTSIZE=100000 +export SAVEHIST=''${HISTSIZE} + +#export COLORTERM=truecolor +export COLORFGBG="green;blue" + +# fix stupid broken Java shit +export _JAVA_AWT_WM_NONREPARENTING=1 + +# enable pass extensions +export PASSWORD_STORE_ENABLE_EXTENSIONS=true + +# set SWAYSOCK correctly +if pgrep -U nipsy -x sway >/dev/null; then + export SWAYSOCK=/run/user/$(id -u)/sway-ipc.$(id -u).$(pgrep -x sway).sock +fi + +# start sway by default if logging into tty1 +if [[ -z "''${DISPLAY}" ]] && [[ $(tty) == "/dev/tty1" ]]; then + + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + + # set some Wayland specific variables + export MOZ_ENABLE_WAYLAND=1 + export GDK_BACKEND=wayland + export QT_QPA_PLATFORM=wayland + export SDL_VIDEODRIVER=wayland + export XDG_SESSION_TYPE=wayland + + exec sway > ~/.sway.log + +fi + +# if already in Wayland, update the GPG TTY so ssh-askpass will work correctly +if [[ -n "''${WAYLAND_DISPLAY}" ]]; then + gpg-connect-agent updatestartuptty /bye >/dev/null +fi + +# completion options +setopt LIST_PACKED MENU_COMPLETE +# expansion and globbing options +setopt NO_NOMATCH +# history options +setopt SHARE_HISTORY EXTENDED_HISTORY HIST_FCNTL_LOCK HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS HIST_SAVE_NO_DUPS +# input/output options +setopt PRINT_EXIT_VALUE RM_STAR_SILENT +# job control options +setopt LONG_LIST_JOBS NO_HUP +# zle options +setopt NO_BEEP + +lsopt='--color=auto' +alias ll="ls -alFh $lsopt" +alias la="ls -aF $lsopt" +alias cal="ncal -b" +#alias grep='grep --color=always' # cannot do this as it breaks shell pipelines +alias talk='gnutalk --curses' +alias manage="tmux new-window ssh root@darkstar\; split-window -d ssh root@king\; new-window ssh root@black-sheep\; split-window -d ssh root@treebeard\; new-window ssh root@casey\; split-window -d ssh root@homer\; new-window ssh root@lilnasx\; split-window -d ssh root@trent" +alias manage-mac="tmux new-session \; source ~/.tmux/manage-mac" +alias win7="xfreerdp -x l -g 1680x1050 -u nipsy -d la-its841279wd kaitain" +alias win7-la="xfreerdp -x l -g 1680x1050 -u la-mrn447 -d austin kaitain" +#alias kubectl="~/k3s/k3s kubectl" +#alias helm="~/k3s/linux-amd64/helm" +alias lock="xscreensaver-command -lock" +alias fixkeyboard="setxkbmap -layout us -option caps:super -option compose:ralt" +alias zigup="zigup --install-dir ~/.local/zig --path-link ~/bin/zig" + +#autoload -U compinit +#compinit +zstyle ':completion:*' menu select=5 + +bindkey -v +export KEYTIMEOUT=1 + +autoload -U edit-command-line +zle -N edit-command-line +bindkey -M vicmd v edit-command-line + +# nix +#if [ -e /home/nipsy/.nix-profile/etc/profile.d/nix.sh ]; then . /home/nipsy/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer + +# The next line updates PATH for the Google Cloud SDK. +#source /home/nipsy/google-cloud-sdk/path.zsh.inc + +# The next line enables bash completion for gcloud. +#source /home/nipsy/google-cloud-sdk/completion.zsh.inc + +# always open tmux if interactive +[[ $- != *i* ]] && return +#[[ -z "$TMUX" ]] && (tmux -2 new-session -t default \; new-window || tmux -2 new-session -s default) +[[ -z "$TMUX" ]] && (tmux -2 attach -t default || tmux -2 new-session -s default) + +# prompt/theme shit +function precmd { + + local RC=''${?} + #local RC=''${(%)RC-%?} + + print -nP '\n' + + # current user + if [[ ''${EUID} -eq 0 ]]; then + print -nP '%{%S%F{red}%}%n%{%f%s%}' + else + print -nP '%{%F{magenta}%}%n%{%f%}' + fi + + print -nP '@' + + # current host + if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then + print -nP '%{%F{yellow}%}%m%{%f%}' + else + print -nP '%{%F{green}%}%m%{%f%}' + fi + + # connected terminal + print -nP '/%{%U%}%l%{%u%} ' + + # cwd + print -nP '%{%F{cyan}%}%~%{%f%} ' + + # job count + JOBCOUNT='%j' + if [[ ''${(%)JOBCOUNT} -gt 0 ]]; then + print -nP 'j=%{%F{yellow}%}%j%{%f%} ' + fi + + # previous return code + if [[ ''${RC} -ne 0 ]]; then + print -nP 'rc=%{%F{red}%}' + echo -n "''${RC}" + print -nP '%{%f%} ' + else + print -nP 'rc=%{%F{green}%}' + echo -n "''${RC}" + print -nP '%{%f%} ' + fi + + # time stamp + print -P '%{%F{cyan}%}%D{%FT%T%z}%{%f%}' + +} + +PS1='%# ' + ''; + }; +} -- cgit v1.2.3