From 659cdd28049fcc5c955d30e44094eefd73e577e3 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Mon, 19 Dec 2022 15:45:59 +0100 Subject: [PATCH] initial working home manager setup --- flake.lock | 6 +- flake.nix | 2 +- hosts/thinkpad/configuration.nix | 8 +- users/rouven/.default.nix.swp | Bin 0 -> 12288 bytes users/rouven/default.nix | 19 +++ users/rouven/modules/default.nix | 283 +++++++++++++++++++++++++++++++ 6 files changed, 308 insertions(+), 10 deletions(-) create mode 100644 users/rouven/.default.nix.swp create mode 100644 users/rouven/default.nix create mode 100644 users/rouven/modules/default.nix diff --git a/flake.lock b/flake.lock index 30c1d31..0a14654 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1671215800, - "narHash": "sha256-2W54K41A7MefEaWzgL/TsaWlhKRK/RhWUybyOW4i0K8=", + "lastModified": 1671313200, + "narHash": "sha256-itZTrtHeDJjV696+ur0/TzkTqb5y3Eb57WRLRPK3rwA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9d692a724e74d2a49f7c985132972f991d144254", + "rev": "0938d73bb143f4ae037143572f11f4338c7b2d1c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c13f504..e8d2028 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "My hardware setup"; + description = "My nix setup"; inputs = { nixpkgs.url = github:nixos/nixpkgs/nixos-22.11; home-manager.url = github:nix-community/home-manager; diff --git a/hosts/thinkpad/configuration.nix b/hosts/thinkpad/configuration.nix index 18acfec..36e5889 100755 --- a/hosts/thinkpad/configuration.nix +++ b/hosts/thinkpad/configuration.nix @@ -5,6 +5,7 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../../users/rouven ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -73,11 +74,6 @@ # enable polkit security.polkit.enable = true; - # Define a user account. - users.users.rouven = { - isNormalUser = true; - extraGroups = [ "wheel" "video" "network" "libvirtd" ]; - }; # List packages installed in system profile. To search, run: # $ nix search wget @@ -195,7 +191,7 @@ # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you # accidentally delete configuration.nix. - system.copySystemConfiguration = true; + # system.copySystemConfiguration = true; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/users/rouven/.default.nix.swp b/users/rouven/.default.nix.swp new file mode 100644 index 0000000000000000000000000000000000000000..f2cc536fadad19858a0c28e3727f52c93c604eef GIT binary patch literal 12288 zcmeI2&1w`u5XXDHN5u$U%gHtAiF)w^y=Vx6hJb7iib(HF&u+6l)5CPnW@TA?1Mv;a z&8NsE2cIMmJn9ozvonTdkqEg({tf>vcI%_7ez1pOYOuNY@-;n@n}W|xA%@d~zKtvBDJ8DR%uxD|KIr_MvrTUO95@q;VkR$L6+Hj& zj%1v>w6@yQ`zE+4zmcm#4Rs|KOXad%DsQsMn!!4iqe{En+~ zWt+NZu5D*no`fe|qZc|eg(gLfmsFCtx(Je8yf@zrDLbypTDRXXvP$dI!ZR`Ju%8Da Fegm)7w;})l literal 0 HcmV?d00001 diff --git a/users/rouven/default.nix b/users/rouven/default.nix new file mode 100644 index 0000000..dedd15f --- /dev/null +++ b/users/rouven/default.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: +{ + nixpkgs.config.allowUnfree = true; + # Define a user account. + users.users.rouven = { + isNormalUser = true; + extraGroups = [ "wheel" "video" "libvirtd" ]; + }; + home-manager.useUserPackages = true; + home-manager.useGlobalPkgs = true; + + home-manager.users.rouven = { lib, pkgs, ... }: { + imports = [ ./modules ]; + + config = { + home.stateVersion = config.system.stateVersion; + }; + }; +} diff --git a/users/rouven/modules/default.nix b/users/rouven/modules/default.nix new file mode 100644 index 0000000..c6ca9b6 --- /dev/null +++ b/users/rouven/modules/default.nix @@ -0,0 +1,283 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "rouven"; + home.homeDirectory = "/home/rouven"; + + home.packages = with pkgs; [ + # essentials + alacritty + networkmanagerapplet + pcmanfm + vifm + xsel + lightlocker + vlc + + # graphics + lxappearance + feh + flameshot + picom + okular + gimp + + # editing + fzf + powerline-fonts + + # sound + pavucontrol + yadm + + # bluetooth + blueman + + # internet + thunderbird + discord + google-chrome + nextcloud-client + zoom-us + + # messaging + tdesktop + element-desktop + whatsapp-for-linux + + # games + minecraft + superTuxKart + extremetuxracer + wine + + # yubikey and password stuff + yubikey-manager + yubikey-manager-qt + yubioath-desktop + pass + + # misc + neofetch + trash-cli + spotify + plover.dev + nixpkgs-fmt + ]; + + programs.git = { + enable = true; + userName = "Rouven Seifert"; + userEmail = "rouven@rfive.de"; + extraConfig = { + user.signingkey = "B95E8FE6B11C4D09"; + pull.rebase = false; + init.defaultBranch = "main"; + commit.gpgsign = true; + }; + + }; + + programs.zsh = { + enable = true; + shellAliases = { + rm = "trash"; + vifm = "vifm ."; + }; + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + + oh-my-zsh = { + enable = true; + # plugins = [ "zsh-autosuggestions" "fzf-tab" ]; + theme="agnoster"; + }; + + plugins = [ + { + name = "zsh-autosuggestions"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-autosuggestions"; + rev = "v0.7.0"; + sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w="; + }; + } + { + name = "fzf-tab"; + src = pkgs.fetchFromGitHub { + owner = "Aloxaf"; + repo = "fzf-tab"; + rev = "14f66e4d3d0b366552c0412eb08ca9e0f7c797bd"; + sha256 = "YkfHPSuSKParz7JidR924CJSuXO6Rk0RZTlxPOBwLJk="; + }; + } + ]; + + localVariables = { + COMPLETION_WAITING_DOTS="true"; + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#00bbbb,bold"; + # ZSH_AUTOSUGGEST_STRATEGY="(history completion)"; + }; + + initExtra = + '' + function c() { + cd + if [ $# -eq 0 ]; then + cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview 'tree -C {}') + else + $1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview 'tree -C {}') + fi + } + + function sn() { + nmcli connection up $(nmcli connection show | tail -n +2 | cut -d " " -f1 | fzf --preview 'nmcli connection show {}') + } + + prompt_dir() { + prompt_segment blue $CURRENT_FG '%c' + } + ''; + }; + + programs.tmux = { + enable = true; + keyMode = "vi"; + terminal = "tmux-256color"; + clock24 = true; + extraConfig = + '' + set -g default-shell /home/rouven/.nix-profile/bin/zsh + bind P display-popup + ''; + plugins = with pkgs.tmuxPlugins; [ + { + plugin = dracula; + extraConfig = '' + set -g @dracula-show-fahrenheit false + set -g @dracula-plugins "weather time" + set -g @dracula-show-left-icon session + set -g @dracula-show-powerline true + ''; + } + ]; + }; + + programs.neovim = { + enable = true; + # defaultEditor = true; why the hell doesn't this work :( + # vimAlias = true; + plugins = with pkgs.vimPlugins; [ + nerdtree + nerdcommenter + fugitive-gitlab-vim + vim-repeat vim-airline + fzf-vim dracula-vim + vim-nix # this destroys my tab settings, ffs + ]; + extraConfig = + '' + " basic commands bound to uppercase key + command Q q + command W w + command Wq wq + command WQ wq + + set shiftwidth=4 + set noexpandtab + set preserveindent + set number relativenumber + set tabstop=4 + set smartcase + set colorcolumn=120 + set nowrap + highlight ColorColumn ctermbg=darkgray + + + " beautify indents + :set list lcs=tab:\|\ + + nnoremap ; : + nnoremap : ; + vnoremap ; : + vnoremap : ; + + " set space as leader + nnoremap + let mapleader = " " + + " air-line + let g:airline_powerline_fonts = 1 + + " NERDTree + nnoremap n :NERDTreeFocus :NERDTreeRefreshRoot + " NERDTree autostart" + autocmd VimEnter * NERDTree | wincmd p + + " Close the tab if NERDTree is the only window remaining in it. + autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif + + "remove ex-mode shortcut + nmap Q + + " trigger the fuzzy finder (fzf) + nnoremap f :Files + nnoremap g :GFiles + nnoremap b :Buffers + nnoremap r :Rg + + " keybinds for coc + nnoremap d :CocDiagnostics + + " quickfixlist binds + nnoremap :cnext + nnoremap :cprev + + " locallist binds + nnoremap :lnext + nnoremap :lprev + + " split keybinds + nnoremap s :sp + nnoremap v :vs + + nnoremap h h + nnoremap j j + nnoremap k k + nnoremap l l + + " coloring stuff + let g:dracula_colorterm = 0 + colorscheme dracula + + " better autocompletion menu colors + highlight Pmenu ctermbg=darkgray ctermfg=black + highlight PmenuSel ctermbg=gray ctermfg=black + + ''; + }; + + + services.picom = { + enable = true; + }; + + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "22.11"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +}