dotfiles.pub/flake.nix

127 lines
3.7 KiB
Nix

{
description = "OSHs dotfiles";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home-manager, neovim-nightly-overlay, ... }:
let
system = builtins.currentSystem;
username = builtins.getEnv "USER";
homeDir = builtins.getEnv "HOME";
pkgs = import nixpkgs { inherit system; };
in {
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
{
nixpkgs.overlays = [
neovim-nightly-overlay.overlays.default
];
home.username = username;
home.homeDirectory = homeDir;
# Only manage what you explicitly turn on below
# (this keeps you from overriding distro-level things)
programs.git = {
enable = true;
userName = "Oshgnacknak";
userEmail = "osh@oshgnacknak.de";
};
programs.neovim = {
enable = true;
package = neovim-nightly-overlay.packages.${pkgs.system}.default;
viAlias = true;
vimAlias = true;
};
programs.home-manager.enable = true;
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
initExtra = ''
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
source ${pkgs.fzf}/share/fzf/completion.zsh
source ${pkgs.fzf-zsh}/share/zsh/plugins/fzf-zsh/fzf-zsh.plugin.zsh
[ -f "$HOME/.config/zshrc" ] && source $HOME/.config/zshrc
'';
plugins = [
{
name = "manydots-magic";
src = pkgs.fetchFromGitHub {
owner = "knu";
repo = "zsh-manydots-magic";
rev = "master";
sha256 = "sha256-lv7e7+KBR/nxC43H0uvphLcI7fALPvxPSGEmBn0g8HQ=";
};
file = "manydots-magic";
}
];
zplug = {
enable = true;
plugins = [
{ name = "zsh-users/zsh-autosuggestions"; }
];
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
# Put extra packages in the *user* profile (not system)
home.packages = with pkgs; [
ripgrep
fd
tmux
xsel
fzf
fzf-zsh
thefuck
rust-analyzer
];
# Link dotfiles without forcing overwrite (fails safely if a file already exists)
home.file.".tmux.conf".source = ./_tmux.conf;
home.file.".config/zshrc".source = ./_zshrc;
home.file.".config/bashrc".source = ./_bashrc;
home.file.".local/share/nvim/site/autoload/plug.vim".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim";
sha256 = "c2d8998469a049a51225a71128a12917b379822d16b639493e29ea02d8787306";
};
xdg.configFile."nvim" = {
source = ./_config/nvim;
recursive = true;
force = true;
};
# Environment variables only for this user/session
home.sessionVariables = {
EDITOR = "nvim";
};
# Good HM hygiene
xdg.enable = true;
home.stateVersion = "24.05";
}
];
};
};
}