home.nix/home.nix
2024-09-18 13:10:44 +08:00

152 lines
3.5 KiB
Nix

{ config, pkgs, ... }:
let
unstableTarball =
fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
basicPackages = with pkgs; [
# Zsh packages
zsh
zsh-powerlevel10k
oh-my-zsh
thefuck
fzf
zsh-fzf-tab
git
eza
fuzzel
hyfetch
btop
vlc
];
nixosOnlyPackages = with pkgs; [
kitty # On other platforms this cause OpenGL Error
# Dev tools
rustup
clang-tools
pkg-config
openssl
zlib
# Other GUI Applications
telegram-desktop
vscode
jetbrains-toolbox
jadx
];
otherOnlyPackages = with pkgs; [
helix
];
in
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "kagura";
home.homeDirectory = "/home/kagura";
# 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 should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "24.05"; # Please read the comment before changing.
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: with pkgs; {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
};
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = if (builtins.pathExists /etc/NIXOS) then
(basicPackages) ++ (nixosOnlyPackages) ++ (with pkgs; [
# Unstable packages here
unstable.android-studio
])
else (basicPackages) ++ (otherOnlyPackages);
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
".config/fuzzel/fuzzel.ini".source = ./config/fuzzel.ini;
".config/kitty/kitty.conf".source = ./config/kitty.conf;
};
home.sessionVariables = {
EDITOR = "hx";
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
INPUT_METHOD = "fcitx";
QT_IM_MODULE = "fcitx";
GTK_IM_MODULE = "fcitx";
XIM_SERVERS = "fcitx";
};
programs.home-manager.enable = true;
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
shellAliases = {
ls = "eza";
ll = "eza --icons -l";
la = "eza --icons -al";
vi = "hx";
vim = "hx";
nixos-update = "cd /etc/nixos; sudo nix flake update; sudo nixos-rebuild switch --flake .";
home-update = "home-manager switch";
home-edit = "hx ~/.config/home-manager";
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
zplug = {
enable = true;
plugins = [{ name = "zsh-users/zsh-autosuggestions"; }];
};
plugins = [{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}];
oh-my-zsh = {
enable = true;
plugins = [ "git" "thefuck" ];
theme = "agnoster";
};
initExtra = ''
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
[[ ! -f ~/.scripts/github.sh ]] || source ~/.scripts/github.sh
'';
};
}