1
0
Fork 0
forked from irl/nix-configs
irl-nix-configs/home/irl.nix

148 lines
4.3 KiB
Nix
Raw Normal View History

2025-06-06 06:46:08 +01:00
{
config,
pkgs,
lib,
...
}:
let
cfg = config.irl;
in
{
options.irl.gui-packages = lib.mkEnableOption "GUI packages managed by home-manager";
config = {
home.username = "irl";
home.homeDirectory =
if lib.strings.hasSuffix "darwin" pkgs.system then "/Users/irl" else "/home/irl";
2025-06-06 06:46:08 +01:00
home.stateVersion = "25.05";
home.packages = with pkgs; [
fish
neofetch
2025-06-07 15:44:01 +01:00
rust-analyzer
2025-06-06 06:46:08 +01:00
starship
tree
];
home.shellAliases = {
hms =
"home-manager switch --flake ~/.config/nix-configs#irl"
+ (if cfg.gui-packages then "-gui" else "")
+ "-${pkgs.system}";
2025-06-06 06:46:08 +01:00
};
programs.bash = {
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
programs.firefox = lib.mkIf cfg.gui-packages {
enable = true;
profiles.irl = {
extensions = {
2025-06-06 11:09:23 +01:00
force = true;
packages = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
kagi-search
privacy-badger
];
};
settings = {
"extensions.autoDisableScope" = 0;
2025-06-06 06:46:08 +01:00
};
};
};
programs.fish.enable = true;
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
programs.git = {
delta.enable = true;
enable = true;
extraConfig = {
diff = {
algorithm = "histogram";
};
init = {
defaultBranch = "main";
};
rebase = {
autosquash = true;
autostash = true;
};
url = {
"git@github.com:".pushInsteadOf = "https://github.com/";
"git@gitlab.com:".pushInsteadOf = "https://gitlab.com/";
"git@guardianproject.dev:".pushInsteadOf = "https://guardianproject.dev/";
};
user = {
name = "irl";
email = "iain@learmonth.me";
};
};
};
programs.home-manager.enable = true;
programs.neovim = {
defaultEditor = true;
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
bufferline-nvim
2025-06-07 15:44:01 +01:00
nvim-lspconfig
2025-06-06 06:46:08 +01:00
nvim-treesitter.withAllGrammars
];
2025-06-07 15:44:01 +01:00
extraLuaConfig = ''
vim.lsp.config('rust_analyzer', {
settings = {
['rust-analyzer'] = {},
},
})
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('my.lsp', {}),
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client:supports_method('textDocument/implementation') then
-- Create a keymap for vim.lsp.buf.implementation ...
end
-- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y|
if client:supports_method('textDocument/completion') then
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
-- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
-- client.server_capabilities.completionProvider.triggerCharacters = chars
vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = true})
end
-- Auto-format ("lint") on save.
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
if not client:supports_method('textDocument/willSaveWaitUntil')
and client:supports_method('textDocument/formatting') then
vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('my.lsp', {clear=false}),
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
end,
})
end
end,
})
'';
2025-06-06 06:46:08 +01:00
};
programs.starship = {
enable = true;
enableFishIntegration = true;
enableInteractive = true;
enableTransience = true;
};
programs.zellij.enable = true;
};
}