{ 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"; home.stateVersion = "25.05"; home.packages = with pkgs; [ fish neofetch rust-analyzer starship tree ]; home.shellAliases = { hms = "home-manager switch --flake ~/.config/nix-configs#irl" + (if cfg.gui-packages then "-gui" else "") + "-${pkgs.system}"; }; 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 = { force = true; packages = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden kagi-search privacy-badger ]; }; settings = { "extensions.autoDisableScope" = 0; }; }; }; 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 nvim-lspconfig nvim-treesitter.withAllGrammars ]; 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, }) ''; }; programs.starship = { enable = true; enableFishIntegration = true; enableInteractive = true; enableTransience = true; }; programs.zellij.enable = true; }; }