{ config, pkgs, lib, home-manager, llm-agents, ... }: let user = "olaf"; # Define the content of your file as a derivation myEmacsLauncher = pkgs.writeScript "emacs-launcher.command" '' #!/bin/sh emacs & ''; additionalFiles = import ./files.nix { inherit user config pkgs; }; in { imports = [ ./dock ]; # It me users.users.${user} = { name = "${user}"; home = "/Users/${user}"; isHidden = false; shell = pkgs.zsh; }; homebrew = { enable = true; casks = pkgs.callPackage ./casks.nix { }; onActivation = { cleanup = "uninstall"; autoUpdate = true; upgrade = true; }; # These app IDs are from using the mas CLI app # mas = mac app store # https://github.com/mas-cli/mas # # $ nix shell nixpkgs#mas # $ mas search # # If you have previously added these apps to your Mac App Store profile (but not installed them on this system), # you may receive an error message "Redownload Unavailable with This Apple ID". # This message is safe to ignore. masApps = { "1Password for Safari" = 1569813296; # (8.10.82) "Affinity Designer 2" = 1616831348; "Affinity Photo 2: Image Editor" = 1616822987; "Affinity Publisher 2" = 1606941598; # "DaisyDisk" = 409907375; # (4.32) # Don't use this, we need the official version that is not sandboxed "Fantastical - Calendar" = 975937182; " Fedistar" = 6445863996; # (1.13.1) "Home Assistant" = 1099568401; # (2025.7.1) "Ice Cubes for Mastodon" = 6444915884; # (1.11.3) "LibreOffice" = 1630474372; "Monal - XMPP Chatting " = 1637078500; "MQTT Explorer" = 1455214828; # (0.3.5) "Night Sky" = 475772902; # 475772902 "Native SQLite Manager" = 1416282836; # (1.31.0) "Remarkable Desktop" = 1276493162; # (3.19.0) "Slack for Desktop" = 803453959; # (4.45.60) "WiFi Explorer: Scanner" = 494803304; # (3.5.6) "Wireguard" = 1451685025; # (1.0.16) ### "1Password: Password Manager" = 1511601750; # (8.11.0) Does not seem to insta }; }; # Enable home-manager home-manager = { useGlobalPkgs = true; users.${user} = { pkgs, config, lib, ... }: { home = { enableNixpkgsReleaseCheck = false; packages = pkgs.callPackage ./packages.nix { inherit llm-agents; }; file = additionalFiles // { "emacs-launcher.command".source = myEmacsLauncher; }; stateVersion = "23.11"; }; programs = { gpg.enable = true; zsh = { enable = true; autocd = false; cdpath = [ "~/.local/share/src" ]; oh-my-zsh = { enable = true; plugins = [ ]; theme = "mrtazz"; }; initContent = let zshConfigEarlyInit = lib.mkOrder 500 '' if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh . /nix/var/nix/profiles/default/etc/profile.d/nix.sh fi # GPGAgent for SSH export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) # Define variables for directories export PATH=$HOME/.pnpm-packages/bin:$HOME/.pnpm-packages:$PATH export PATH=$HOME/.npm-packages/bin:$HOME/bin:$PATH export PATH=$HOME/.local/share/bin:$PATH export PATH=$HOME/.cargo/bin:$PATH # Remove history data we don't want to see export HISTIGNORE="pwd:ls:cd" # Ripgrep alias alias search=rg -p --glob '!node_modules/*' $@ # Emacs is my editor export ALTERNATE_EDITOR="vim" export EDITOR="emacs -nw" export VISUAL="emacs" # RMAPI remarkable RMAPI_CONFIG=/Users/olaf/.config/rmapi e() { emacs -nw "$@" } # nix shortcuts shell() { nix-shell '' -A "$1" } # pnpm is a javascript package manager alias pn=pnpm alias px=pnpx ''; zshConfigLastInit = lib.mkOrder 1500 '' # Always color ls and group directories alias ls='ls --color=auto' ''; in lib.mkMerge [ zshConfigEarlyInit zshConfigLastInit ]; }; git = { enable = true; ignores = [ "*.swp" ]; lfs = { enable = true; }; settings = { init.defaultBranch = "main"; core = { editor = "vim"; autocrlf = "input"; }; commit.gpgsign = false; pull.rebase = true; rebase.autoStash = true; user = { name = "olaf"; email = "olaf@xolx.nl"; }; }; signing = { format = "openpgp"; key = null; signByDefault = true; }; }; vim = { enable = true; plugins = with pkgs.vimPlugins; [ vim-airline vim-airline-themes vim-startify vim-tmux-navigator ]; settings = { ignorecase = true; }; extraConfig = '' "" General set number set history=1000 set nocompatible set modelines=0 set encoding=utf-8 set scrolloff=3 set showmode set showcmd set hidden set wildmenu set wildmode=list:longest set cursorline set ttyfast set nowrap set ruler set backspace=indent,eol,start set laststatus=2 set clipboard=autoselect " Dir stuff set nobackup set nowritebackup set noswapfile set backupdir=~/.config/vim/backups set directory=~/.config/vim/swap " Relative line numbers for easy movement set relativenumber set rnu "" Whitespace rules set tabstop=8 set shiftwidth=2 set softtabstop=2 set expandtab "" Searching set incsearch set gdefault "" Statusbar set nocompatible " Disable vi-compatibility set laststatus=2 " Always show the statusline let g:airline_theme='bubblegum' let g:airline_powerline_fonts = 1 "" Local keys and such let mapleader="," let maplocalleader=" " "" Change cursor on mode :autocmd InsertEnter * set cul :autocmd InsertLeave * set nocul "" File-type highlighting and configuration syntax on filetype on filetype plugin on filetype indent on "" Paste from clipboard nnoremap , "+gP "" Copy from clipboard xnoremap . "+y "" Move cursor by display lines when wrapping nnoremap j gj nnoremap k gk "" Map leader-q to quit out of window nnoremap q :q "" Move around split nnoremap h nnoremap j nnoremap k nnoremap l ''; }; }; catppuccin = { autoEnable = true; enable = true; flavor = "mocha"; }; services = { gpg-agent = { enable = true; enableSshSupport = true; extraConfig = '' default-cache-ttl 600 max-cache-ttl 7200 pinentry-program /Users/olaf/.nix-profile/bin/pinentry-mac ''; }; }; # Marked broken Oct 20, 2022 check later to remove this # https://github.com/nix-community/home-manager/issues/3344 manual.manpages.enable = false; }; }; # Fully declarative dock using the latest from Nix Store local = { dock = { enable = true; entries = [ { path = "/System/Applications/Launchpad.app/"; } { path = "/System/Applications/Mail.app/"; } { path = "/Applications/MailMate.app/"; } { path = "/Applications/1Password.app/"; } { path = "/Applications/Bitwarden.app"; } { path = "/Applications/Calendar.app/"; } { path = "/Applications/Notes.app/"; } { path = "/Applications/Firefox.app/"; } { path = "/Applications/Slack.app/"; } { path = "/Applications/zoom.us.app/"; options = " -l Zoom"; } { path = "/System/Applications/Messages.app/"; } { path = "/Applications/iTerm.app/"; } { path = "/Applications/Fantastical.app/"; } { path = "${pkgs.alacritty}/Applications/Alacritty.app/"; } # { path = "/Applications/Spotify.app/"; } { path = "/Applications/Qobuz.app/"; } { path = "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/"; } { path = "/Applications/Brave Browser.app/"; options = "-l Brave"; } { path = "/System/Applications/Photos.app/"; } { path = "/System/Applications/System Settings.app/"; } { path = "/Applications/Signal.app/"; } { path = "/Applications/WhatsApp.app/"; } { path = "/Applications/Ice\ Cubes.app/"; } { path = "/Applications/Jellyfin Media Player.app/"; options = "-l Jellyfin"; } { path = "/Applications/Visual Studio Code.app/"; } { path = "/Applications/Home Assistant.app/"; } { path = "/Applications/reMarkable.app/"; } { path = "/Applications/LibreOffice.app/"; } { path = "/Applications/Microsoft Word.app/"; } { path = "/Applications/Microsoft PowerPoint.app/"; } { path = "/Applications/Microsoft Teams.app/"; } { path = "/Applications/Monal.app/"; } { path = "/System/Applications/Utilities/Screen Sharing.app/"; } { path = "/run/current-system/Applications/Emacs.app/"; } { path = "/run/current-system/Applications/Zotero.app"; } { path = "/Applications/"; section = "others"; options = "--sort name --view grid --display stack"; } { path = toString myEmacsLauncher; section = "others"; options = "-l EmacsLauncher"; } { path = "${config.users.users.${user}.home}/.local/share/"; section = "others"; options = "--sort name --view grid --display folder"; } { # path = "${config.users.users.${user}.home}/.local/share/downloads"; path = "${config.users.users.${user}.home}/Downloads/"; section = "others"; options = "--sort name --view grid --display stack"; } ]; }; }; }