These files show a simplified real-world example of how to use Home Manager to setup Neovim, Xfce, and some command-line user tools.
Last active
August 25, 2024 23:57
-
-
Save nat-418/903c8e8ef605c36c2e3ed9a8e9ed0cea to your computer and use it in GitHub Desktop.
An example Home Manager configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, ... }: | |
{ | |
home = { | |
packages = with pkgs; [ | |
abduco | |
age | |
aria2 | |
bat | |
bc | |
bottom | |
entr | |
fd | |
file | |
fossil | |
ijq | |
joshuto | |
jq | |
lazydocker | |
lazygit | |
moreutils | |
trash-cli | |
unzip | |
usbutils | |
wget | |
]; | |
sessionVariables = { | |
LESS_TERMCAP_mb = "$(tput bold; tput setaf 2)"; | |
LESS_TERMCAP_md = "$(tput bold; tput setaf 6)"; | |
LESS_TERMCAP_me = "$(tput sgr0)"; | |
LESS_TERMCAP_so = "$(tput bold; tput setaf 3; tput setab 4)"; | |
LESS_TERMCAP_se = "$(tput rmso; tput sgr0)"; | |
LESS_TERMCAP_us = "$(tput smul; tput bold; tput setaf 7)"; | |
LESS_TERMCAP_ue = "$(tput rmul; tput sgr0)"; | |
LESS_TERMCAP_mr = "$(tput rev)"; | |
LESS_TERMCAP_mh = "$(tput dim)"; | |
LESS_TERMCAP_ZN = "$(tput ssubm)"; | |
LESS_TERMCAP_ZV = "$(tput rsubm)"; | |
LESS_TERMCAP_ZO = "$(tput ssupm)"; | |
LESS_TERMCAP_ZW = "$(tput rsupm)"; | |
LESS = "--quit-if-one-screen"; | |
}; | |
}; | |
programs = { | |
exa = { | |
enable = true; | |
enableAliases = true; | |
}; | |
fish = { | |
enable = true; | |
interactiveShellInit = " | |
set fish_greeting | |
"; | |
plugins = [ | |
{ | |
name = "fzf.fish"; | |
src = pkgs.fishPlugins.fzf-fish.src; | |
} | |
]; | |
shellInit = " | |
fish_add_path ~/.local/share/bin/ | |
fzf_configure_bindings --directory=\\cf | |
fzf_configure_bindings --git_log=\\cg | |
fzf_configure_bindings --git_status=\\cs | |
fzf_configure_bindings --history=\\cr | |
fzf_configure_bindings --variables=\\cv | |
fzf_configure_bindings --processes=\\cp | |
"; | |
shellAbbrs = { | |
hms = "home-manager switch"; | |
nrs = "sudo nixos-rebuild switch"; | |
psl = "btm --expanded --default_widget_type=proc"; | |
pst = "btm --expanded --default_widget_type=proc --tree"; | |
rm = "trash"; | |
vic = "vi /etc/nixos/configuration.nix"; | |
vih = "vi ~/.config/home-manager/home.nix"; | |
vin = "vi ~/.config/nvim/init.lua"; | |
sys = "systemctl"; | |
syu = "systemctl --user"; | |
}; | |
}; | |
fzf.enable = true; | |
git = { | |
enable = true; | |
delta.enable = true; | |
signing = { | |
signByDefault = true; | |
key = null; | |
}; | |
}; | |
gpg.enable = true; | |
home-manager.enable = true; | |
ssh = { | |
enable = true; | |
}; | |
tealdeer = { | |
enable = true; | |
settings = { | |
auto_update = true; | |
}; | |
}; | |
zoxide = { | |
enable = true; | |
enableBashIntegration = true; | |
enableFishIntegration = true; | |
}; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, ... }: | |
{ | |
imports = [ | |
./cli.nix | |
./nvim.nix | |
./xfce.nix | |
]; | |
home = { | |
username = "nat"; | |
homeDirectory = "/home/nat"; | |
stateVersion = "22.11"; | |
}; | |
nixpkgs.config.allowUnfree = true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, lib, ...}: | |
let | |
fromGitHub = ref: repo: pkgs.vimUtils.buildVimPluginFrom2Nix { | |
pname = "${lib.strings.sanitizeDerivationName repo}"; | |
version = ref; | |
src = builtins.fetchGit { | |
url = "https://github.com/${repo}.git"; | |
ref = ref; | |
}; | |
}; | |
in | |
{ | |
home = { | |
packages = with pkgs; [ | |
lua-language-server | |
nil | |
]; | |
sessionVariables = { | |
EDITOR = "nvim"; | |
VISUAL = "nvim"; | |
}; | |
}; | |
programs = { | |
neovim = { | |
enable = true; | |
viAlias = true; | |
vimAlias = true; | |
vimdiffAlias = true; | |
plugins = with pkgs.vimPlugins; [ | |
gruvbox-material | |
nvim-treesitter.withAllGrammars | |
plenary-nvim | |
fzf-lua | |
gitsigns-nvim | |
lush-nvim | |
neodev-nvim | |
nvim-bqf | |
nvim-lspconfig | |
nvim-lspconfig | |
nvim-treesitter-context | |
nvim-treesitter-refactor | |
nvim-treesitter-textobjects | |
plantuml-syntax | |
vim-nix | |
which-key-nvim | |
(fromGitHub "HEAD" "echasnovski/mini.nvim") | |
(fromGitHub "HEAD" "levouh/tint.nvim") | |
(fromGitHub "HEAD" "sam4llis/nvim-lua-gf") | |
(fromGitHub "HEAD" "stevearc/oil.nvim") | |
(fromGitHub "HEAD" "nat-418/boole.nvim") | |
(fromGitHub "HEAD" "nat-418/bufala.nvim") | |
(fromGitHub "HEAD" "nat-418/scamp.nvim") | |
(fromGitHub "HEAD" "nat-418/tabbot.nvim") | |
(fromGitHub "HEAD" "nat-418/termitary.nvim") | |
]; | |
}; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, ... }: | |
{ | |
gtk = { | |
enable = true; | |
iconTheme = { | |
name = "elementary-Xfce-dark"; | |
package = pkgs.elementary-xfce-icon-theme; | |
}; | |
theme = { | |
name = "zukitre-dark"; | |
package = pkgs.zuki-themes; | |
}; | |
gtk3.extraConfig = { | |
Settings = '' | |
gtk-application-prefer-dark-theme=1 | |
''; | |
}; | |
gtk4.extraConfig = { | |
Settings = '' | |
gtk-application-prefer-dark-theme=1 | |
''; | |
}; | |
}; | |
home = { | |
packages = with pkgs; [ | |
beekeeper-studio | |
cantarell-fonts | |
gitg | |
hunspell | |
hunspellDicts.en-us | |
hunspellDicts.fr-any | |
ibm-plex | |
keepassxc | |
libreoffice | |
meld | |
(nerdfonts.override { | |
fonts = [ | |
"IBMPlexMono" | |
]; | |
}) | |
pika-backup | |
pulseaudio | |
qalculate-gtk | |
remmina | |
virt-manager | |
wmctrl | |
work-sans | |
xclip | |
xcolor | |
xdo | |
xdotool | |
xorg.xev | |
xsel | |
zeal | |
]; | |
}; | |
programs = { | |
gpg.enable = true; | |
chromium.enable = true; | |
firefox = { | |
enable = true; | |
profiles.default.search.engines = { | |
"Nix Packages" = { | |
urls = [{ | |
template = "https://search.nixos.org/packages"; | |
params = [ | |
{ name = "type"; value = "packages"; } | |
{ name = "query"; value = "{searchTerms}"; } | |
]; | |
}]; | |
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; | |
definedAliases = [ "!np" ]; | |
}; | |
"NixOS Wiki" = { | |
urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; | |
iconUpdateURL = "https://nixos.wiki/favicon.png"; | |
updateInterval = 24 * 60 * 60 * 1000; # every day | |
definedAliases = [ "!nw" ]; | |
}; | |
"Bing".metaData.hidden = true; | |
}; | |
}; | |
thunderbird = { | |
enable = true; | |
profiles.default = { | |
isDefault = true; | |
withExternalGnupg = true; | |
}; | |
}; | |
}; | |
services.gpg-agent.enable = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment