diff --git a/flake.nix b/flake.nix index 6ec676c..3746a5b 100644 --- a/flake.nix +++ b/flake.nix @@ -42,15 +42,16 @@ in home-manager.lib.homeManagerConfiguration { inherit pkgs; - modules = [ - "${modules}/home.nix" - { + modules = + (pkgs.lib.filter + (n: pkgs.lib.strings.hasSuffix ".nix" n) + (pkgs.lib.filesystem.listFilesRecursive modules)) ++ + [{ home.stateVersion = "22.05"; home.username = "jfrikker"; home.homeDirectory = "/Users/jfrikker"; home.packages = [ pkgs.pinentry_mac ]; - } - ]; + }]; extraSpecialArgs = { kube = kube.packages.aarch64-darwin.default; }; }; diff --git a/home.org b/home.org index 7d0e31f..6f991ac 100644 --- a/home.org +++ b/home.org @@ -28,10 +28,6 @@ This is the basic structure of the home.nix file. Individual sections are define } #+END_SRC * Packages -:PROPERTIES: -:header-args: :noweb-ref packages -:END: - Home-manager "packages" are simply binaries that are placed on the path, without any attached configuration. The code blocks in this section contain package lists that go under the packages section above. @@ -42,42 +38,47 @@ in a ~nix~ devshell I think I'd also like to use it for scripting / exploratory so I'm installing it globally with a useful set of libraries. I should curate this somewhat carefully so it doesn't get carried away... -#+BEGIN_SRC nix - rlwrap - (sbcl.withPackages (ps: with ps; [ - alexandria - cl-markup - cl-mock - cl-rdkafka - clack - clack-handler-woo - dbd-mysql - dbi - dexador - fare-csv - group-by - lack-request - lack-response - local-time - log4cl - mito - myway - prove - prove-asdf - replic - serapeum - shasht - slynk - smug - split-sequence - str - sxql-composer - trivia - trivial-ws - trivial-open-browser - trivial-timeout - uuid - ])) +#+BEGIN_SRC nix :tangle target/common-lisp.nix + {pkgs, ...}: + { + home.packages = with pkgs; [ + rlwrap + (sbcl.withPackages (ps: with ps; [ + alexandria + cl-markup + cl-mock + cl-rdkafka + clack + clack-handler-woo + dbd-mysql + dbi + dexador + fare-csv + group-by + lack-request + lack-response + local-time + log4cl + mito + myway + prove + prove-asdf + replic + serapeum + shasht + slynk + smug + split-sequence + str + sxql-composer + trivia + trivial-ws + trivial-open-browser + trivial-timeout + uuid + ])) + ]; + } #+END_SRC [[https://github.com/str4d/rage][~rage~]] is a rust implementation of [[https://pkg.go.dev/filippo.io/age][~age~]]. It implements a simple system for generating public / @@ -86,9 +87,15 @@ the name implies, allows generating and storing ~age~ keys on a Yubikey. ~rage~ ~age~ when using ~age.el~, because it supports ~pinentry~. That allows it to prompt for yubikey pins using a dialog, rather than a command line prompt. -#+BEGIN_SRC nix - rage - age-plugin-yubikey +#+BEGIN_SRC nix :tangle target/crypto.nix + {pkgs, ...}: + { + home.packages = with pkgs; [ + rage + age-plugin-yubikey + yubikey-manager + ]; + } #+END_SRC ~dust~, ~fd~, ~ripgrep~, and ~xh~ are rust re-implementations of a few longtime Linux command-line @@ -100,54 +107,74 @@ tools. They boost better speed, or simply more streamlined features. | ~ripgrep~ | ~grep~ | | ~xh~ | ~curl~ | -#+BEGIN_SRC nix - dust - fd - ripgrep - xh +#+BEGIN_SRC nix :tangle target/rust-reimpls.nix + {pkgs, ...}: + { + home.packages = with pkgs; [ + dust + fd + ripgrep + xh + ]; + } #+END_SRC [[https://ledger-cli.org/][~ledger~]] is how I manage my budget. It's a plain-text accounting tool that's really awesome. -#+BEGIN_SRC nix - ledger +#+BEGIN_SRC nix :tangle target/ledger.nix + {pkgs, ...}: + { + home.packages = with pkgs; [ + ledger + ]; + } #+END_SRC ~nil~ is an LSP server for nix files. -#+BEGIN_SRC nix - nil +#+BEGIN_SRC nix :tangle target/nil.nix + {pkgs, ...}: + { + home.packages = with pkgs; [ + nil + ]; + } #+END_SRC [[https://github.com/magic-wormhole/magic-wormhole][Magic Wormhole]] is a quick-and-easy way to securely transfer a file or directory between any two computers in the world, assuming that you have an out-of-band way to communicate a passphrase between them. Once installed, the actual command is ~wormhole~. -#+begin_src nix - magic-wormhole +#+begin_src nix :tangle target/magic-wormhole.nix + {pkgs, ...}: + { + home.packages = with pkgs; [ + magic-wormhole + ]; + } #+end_src These are the other programs I have installed globally. A few (like ~awscli~, ~mysql-client~, etc.) are still Shibumi-specific; ideally I'd find another way to install them. - #+BEGIN_SRC nix - aws-iam-authenticator - awscli2 - iosevka - kube - kubectl - mariadb.client - nerd-fonts.jetbrains-mono - openssh - tokei - yubikey-manager + #+BEGIN_SRC nix :tangle target/other-packages.nix + {pkgs, kube, ...}: + { + home.packages = with pkgs; [ + aws-iam-authenticator + awscli2 + iosevka + kube + kubectl + mariadb.client + nerd-fonts.jetbrains-mono + openssh + tokei + ]; + } #+END_SRC * Program Configurations -:PROPERTIES: -:header-args:nix: :noweb-ref programs :noweb no-export -:END: - This section contains applications whose config files will be generated by Home Manager. Home Manager calls these "programs" (as opposed to "packages", which are just binaries to put on the path). @@ -158,13 +185,17 @@ Although Home-Manager generates config files for these programs, they don't need configuration. I'm not sure what benefit there is to enabling ~jq~ as a Home Manager program, rather than just as an available package, but there doesn't seem to be a downside. -#+BEGIN_SRC nix - bash.enable = true; - gh.enable = true; - home-manager.enable = true; - jq.enable = true; - lazygit.enable = true; - zoxide.enable = true; +#+BEGIN_SRC nix :tangle target/simple-programs.nix + { + programs = { + bash.enable = true; + gh.enable = true; + home-manager.enable = true; + jq.enable = true; + lazygit.enable = true; + zoxide.enable = true; + }; + } #+END_SRC ** Bat @@ -173,9 +204,13 @@ than just as an available package, but there doesn't seem to be a downside. provides syntax-highlighting versions of a few other commands. It's honestly not incredibly useful, but still nice to have. -#+BEGIN_SRC nix - bat.enable = true; - bat.config.style = "numbers"; +#+BEGIN_SRC nix :tangle target/bat.nix + { + programs.bat = { + enable = true; + config.style = "numbers"; + }; + } #+END_SRC ** Direnv @@ -183,20 +218,28 @@ but still nice to have. ~direnv~ allows loading per-project paths as I navigate to their directories on the command line. I leverage this with the emacs ~envrc~ package. -#+BEGIN_SRC nix - direnv.enable = true; - direnv.nix-direnv.enable = true; +#+BEGIN_SRC nix :tangle target/direnv.nix + { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + } #+END_SRC ** Eza ~eza~ is an ~ls~ replacement that offers icons, colors, and some easier command-line options. -#+BEGIN_SRC nix - eza.enable = true; - eza.enableBashIntegration = true; - eza.enableZshIntegration = true; - eza.icons = "auto"; +#+BEGIN_SRC nix :tangle target/eza.nix + { + programs.eza = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + icons = "auto"; + }; + } #+END_SRC ** Fzf @@ -204,97 +247,112 @@ leverage this with the emacs ~envrc~ package. ~fzf~ offers a variety of fuzzy finders right from the shell. I haven't been using this, so I'll turn it off for now. -#+BEGIN_SRC nix - fzf.defaultCommand = "fd --type f"; - fzf.fileWidgetCommand = "fd --type f"; - fzf.fileWidgetOptions = ["--preview" "'bat --color=always --style=numbers --line-range=:500 {}'"]; - fzf.changeDirWidgetCommand = "fd --type d"; - fzf.tmux.enableShellIntegration = true; +#+BEGIN_SRC nix :tangle target/fzf.nix + { + programs.fzf = { + defaultCommand = "fd --type f"; + fileWidgetCommand = "fd --type f"; + fileWidgetOptions = ["--preview" "'bat --color=always --style=numbers --line-range=:500 {}'"]; + changeDirWidgetCommand = "fd --type d"; + tmux.enableShellIntegration = true; + }; + } #+END_SRC ** Git We all know what ~git~ does. -#+BEGIN_SRC nix - git.enable = true; - git.settings.user.name = "Joe Frikker"; - git.settings.user.email = "joe.frikker@shibumi.com"; - delta.enable = true; - delta.enableGitIntegration = true; +#+BEGIN_SRC nix :tangle target/git.nix + { + programs.git = { + enable = true; + settings.user.name = "Joe Frikker"; + settings.user.email = "joe.frikker@shibumi.com"; + }; + + programs.delta = { + enable = true; + enableGitIntegration = true; + }; + } #+END_SRC ** Helix The best text editor ever? Heresy! -#+BEGIN_SRC nix - helix.enable = true; - helix.defaultEditor = true; +#+BEGIN_SRC nix :tangle target/helix.nix + { + programs.helix = { + enable = true; + defaultEditor = true; - helix.settings.editor = { - auto-format = false; - auto-pairs = false; - auto-save.after-delay.enable = true; - auto-save.after-delay.timeout = 1000; - cursorline = true; - idle-timeout = 0; - rulers = [100]; - text-width = 100; - lsp.goto-reference-include-declaration = false; - cursor-shape.insert = "bar"; - smart-tab.supersede-menu = true; - whitespace.render.newline = "all"; - }; + settings.editor = { + auto-format = false; + auto-pairs = false; + auto-save.after-delay.enable = true; + auto-save.after-delay.timeout = 1000; + cursorline = true; + idle-timeout = 0; + rulers = [100]; + text-width = 100; + lsp.goto-reference-include-declaration = false; + cursor-shape.insert = "bar"; + smart-tab.supersede-menu = true; + whitespace.render.newline = "all"; + }; - helix.settings.keys.normal.space = { - space = "file_picker"; - "," = "buffer_picker"; - # b = "@:sh wezterm cli spawn --cwd . -- tig blame %"; - }; + settings.keys.normal.space = { + space = "file_picker"; + "," = "buffer_picker"; + # b = "@:sh wezterm cli spawn --cwd . -- tig blame %"; + }; - helix.languages.language-server.eslint = { - args = ["--stdio"]; - command = "vscode-eslint-language-server"; - config.nodePath = ""; - config.quiet = false; - config.rulesCustomizations = []; - config.run = "onType"; - config.validate = "on"; - config.codeAction.disableRuleComment.enable = true; - config.codeAction.disableRuleComment.location = "separateLine"; - config.codeAction.showDocumentation.enable = true; - config.problems.shortenToSingleLine = false; - }; + languages.language-server.eslint = { + args = ["--stdio"]; + command = "vscode-eslint-language-server"; + config.nodePath = ""; + config.quiet = false; + config.rulesCustomizations = []; + config.run = "onType"; + config.validate = "on"; + config.codeAction.disableRuleComment.enable = true; + config.codeAction.disableRuleComment.location = "separateLine"; + config.codeAction.showDocumentation.enable = true; + config.problems.shortenToSingleLine = false; + }; - helix.languages.language-server.jdtls.config.java = { - autobuild.enabled = true; - completion.maxResults = 1000; - format.settings.url = "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml"; - }; + languages.language-server.jdtls.config.java = { + autobuild.enabled = true; + completion.maxResults = 1000; + format.settings.url = "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml"; + }; - helix.languages.language-server.rust-analyzer.config.files.watcher = "client"; + languages.language-server.rust-analyzer.config.files.watcher = "client"; - helix.languages.language = [ - { + languages.language = [ + { name = "typescript"; language-servers = [ "typescript-language-server" "vscode-eslint-language-server" ]; indent.tab-width = 4; indent.unit = " "; - } - { + } + { name = "tsx"; language-servers = [ "typescript-language-server" "vscode-eslint-language-server" ]; indent.tab-width = 4; indent.unit = " "; - } - { + } + { name = "java"; indent.tab-width = 4; indent.unit = " "; - } - ]; + } + ]; + }; + } #+END_SRC ** Starship @@ -302,30 +360,32 @@ The best text editor ever? Heresy! ~starship~ gives me a nice shell prompt, mostly showing the versions of relevant software I have installed. It's shell-agnostic, so it works with both bash and zsh. -#+BEGIN_SRC nix :noweb no-export - starship.enable = true; - starship.settings = { - add_newline = false; - container.disabled = true; - git_branch.symbol = " "; - git_status.ahead = "⇡\${count}"; - git_status.behind = "⇣\${count}"; - git_status.diverged = "⇕⇡\${ahead_count}⇣\${behind_count}"; - git_status.format = "([\\[\$conflicted\$staged\$ahead_behind\\]](\$style) )"; - java.symbol = " "; - line_break.disabled = true; - nix_shell.symbol = " "; - nodejs.symbol = " "; - package.disabled = true; - palette = "catppuccin_frappe"; - python.symbol = " "; - package.symbol = " "; - rust.symbol = " "; - docker_context.disabled = true; - shell.disabled = false; - } // - <> - ; +#+BEGIN_SRC nix :tangle target/starship.nix + { + programs.starship = { + enable = true; + settings = { + add_newline = false; + container.disabled = true; + git_branch.symbol = " "; + git_status.ahead = "⇡\${count}"; + git_status.behind = "⇣\${count}"; + git_status.diverged = "⇕⇡\${ahead_count}⇣\${behind_count}"; + git_status.format = "([\\[\$conflicted\$staged\$ahead_behind\\]](\$style) )"; + java.symbol = " "; + line_break.disabled = true; + nix_shell.symbol = " "; + nodejs.symbol = " "; + package.disabled = true; + palette = "catppuccin_frappe"; + python.symbol = " "; + package.symbol = " "; + rust.symbol = " "; + docker_context.disabled = true; + shell.disabled = false; + }; + }; + } #+END_SRC ** Tmux @@ -333,27 +393,32 @@ installed. It's shell-agnostic, so it works with both bash and zsh. I'm using ~wezterm~ instead of ~tmux~ for now, so this is disabled, but I'm keeping the config here in case I need it later. -#+BEGIN_SRC nix - tmux.baseIndex = 1; - tmux.clock24 = true; - tmux.customPaneNavigationAndResize = true; - tmux.historyLimit = 50000; - tmux.enable = true; - tmux.escapeTime = 0; - tmux.keyMode = "vi"; - tmux.mouse = true; - tmux.shell = pkgs.zsh + "/bin/zsh"; - tmux.shortcut = "Space"; - tmux.tmuxinator.enable = true; - tmux.terminal = "xterm-256color"; - tmux.extraConfig = '' -bind-key -T copy-mode-vi 'v' send -X begin-selection -bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel +#+BEGIN_SRC nix :tangle target/tmux.nix + {pkgs, ...}: + { + programs.tmux = { + baseIndex = 1; + clock24 = true; + customPaneNavigationAndResize = true; + historyLimit = 50000; + enable = true; + escapeTime = 0; + keyMode = "vi"; + mouse = true; + shell = pkgs.zsh + "/bin/zsh"; + shortcut = "Space"; + tmuxinator.enable = true; + terminal = "xterm-256color"; + extraConfig = '' + bind-key -T copy-mode-vi 'v' send -X begin-selection + bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel -bind-key -T launcher g popup -h 100% -w 100% -E lazygit -bind-key g switch-client -Tlauncher -set -g default-command "" - ''; + bind-key -T launcher g popup -h 100% -w 100% -E lazygit + bind-key g switch-client -Tlauncher + set -g default-command "" + ''; + }; + } #+END_SRC ** Wezterm :PROPERTIES: @@ -363,9 +428,13 @@ set -g default-command "" ~wezterm~ is a fast terminal emulator and multiplexer. It is configured using lua. We'll define its config in two blocks, so we can get lua syntax highlighting in org. First, the nix configuration: -#+BEGIN_SRC nix - wezterm.enable = true; - wezterm.extraConfig = builtins.readFile ./wezterm.lua; +#+BEGIN_SRC nix :tangle target/wezterm.nix + { + programs.wezterm = { + enable = true; + extraConfig = builtins.readFile ./wezterm.lua; + }; + } #+END_SRC Then the real lua config: @@ -565,31 +634,38 @@ Now we'll set up some keybindings: This is my default shell for now. Unfortunately, nix requires a posix-compliant shell, so bash or zsh it is. -#+BEGIN_SRC nix - zsh.enable = true; - zsh.oh-my-zsh.enable = true; - zsh.syntaxHighlighting.enable = true; - zsh.autosuggestion.enable = true; - zsh.historySubstringSearch.enable = true; - zsh.history.share = false; - zsh.cdpath = ["~/source"]; +#+BEGIN_SRC nix :tangle target/zsh.nix + { + programs.zsh = { + enable = true; + oh-my-zsh.enable = true; + syntaxHighlighting.enable = true; + autosuggestion.enable = true; + historySubstringSearch.enable = true; + history.share = false; + cdpath = ["~/source"]; + }; + } #+END_SRC Actually, nix *really* requires ~bash~. This is a plugin that allows using zsh from nix-shell. -#+BEGIN_SRC nix - zsh.plugins = [ - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.7.0"; - sha256 = "149zh2rm59blr2q458a5irkfh82y3dwdich60s9670kl3cl5h2m1"; - }; - } - ]; +#+BEGIN_SRC nix :tangle target/zsh-nix-shell.nix + {pkgs, ...}: + { + programs.zsh.plugins = [ + { + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.7.0"; + sha256 = "149zh2rm59blr2q458a5irkfh82y3dwdich60s9670kl3cl5h2m1"; + }; + } + ]; + } #+END_SRC * Emacs @@ -603,12 +679,16 @@ breaking it out into its own top-level section. Many of the sections here have t nix code block listing the emacs packages to include, and an elisp code block to configure them in emacs. -#+BEGIN_SRC nix :noweb-ref programs - emacs.enable = true; - emacs.extraPackages = epkgs: with epkgs; [ - <> - ]; - emacs.extraConfig = builtins.readFile ./emacs.el; +#+BEGIN_SRC nix :tangle target/emacs.nix :noweb-ref + { + programs.emacs = { + enable = true; + extraPackages = epkgs: with epkgs; [ + <> + ]; + extraConfig = builtins.readFile ./emacs.el; + }; + } #+END_SRC We'll put the actual emacs config into a separate file, rather than into a nix string literal. This @@ -1635,77 +1715,88 @@ age #+END_SRC * Theme - I like Catppuccin Frappe as my theme. Let's use it in as many places as we can. ** Bat - -#+BEGIN_SRC nix :noweb-ref programs - bat.config.theme = "catppuccin-frappe"; - bat.themes = { - catppuccin-frappe = { - src = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "sublime-text"; # Bat uses sublime syntax for its themes - rev = "3d8625d937d89869476e94bc100192aa220ce44a"; - sha256 = "3ABUsfJpb6RO6AiuuSL5gwDofJIwC5tlEMzBrlY9/s0="; - }; - file = "Frappe.tmTheme"; +#+BEGIN_SRC nix :tangle target/bat-theme.nix + {pkgs, ...}: + { + programs.bat = { + config.theme = "catppuccin-frappe"; + themes = { + catppuccin-frappe = { + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "sublime-text"; # Bat uses sublime syntax for its themes + rev = "3d8625d937d89869476e94bc100192aa220ce44a"; + sha256 = "3ABUsfJpb6RO6AiuuSL5gwDofJIwC5tlEMzBrlY9/s0="; + }; + file = "Frappe.tmTheme"; + }; + }; }; - }; + } #+END_SRC ** Helix - -#+BEGIN_SRC nix :noweb-ref programs - helix.settings.theme = "catppuccin_frappe"; +#+BEGIN_SRC nix :tangle target/helix-theme.nix + { + programs.helix.settings.theme = "catppuccin_frappe"; + } #+END_SRC ** Tmux - -#+BEGIN_SRC nix :noweb-ref programs - tmux.plugins = [ - { - plugin = pkgs.tmuxPlugins.catppuccin; - extraConfig = ''set -g @catppuccin_window_tabs_enabled on +#+BEGIN_SRC nix :tangle target/tmux-theme.nix + {pkgs, ...}: + { + programs.tmux.plugins = [ + { + plugin = pkgs.tmuxPlugins.catppuccin; + extraConfig = ''set -g @catppuccin_window_tabs_enabled on set -g @catppuccin_window_default_text "#W" set -g @catppuccin_window_current_text "#W"''; - } - ]; + } + ]; + } #+END_SRC ** Lazygit - -#+BEGIN_SRC nix :noweb-ref extra_xdg - configFile."lazygit/config.yml" = { - enable = true; - source = pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "lazygit"; - rev = "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf"; # Replace with the latest commit hash - sha256 = "9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw="; - } + /themes/frappe.yml; - }; +#+BEGIN_SRC nix :tangle target/lazygit.nix + {pkgs, ...}: + { + xdg = { + enable = true; + configFile."lazygit/config.yml" = { + enable = true; + source = pkgs.fetchFromGitHub + { + owner = "catppuccin"; + repo = "lazygit"; + rev = "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf"; # Replace with the latest commit hash + sha256 = "9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw="; + } + /themes/frappe.yml; + }; + }; + } #+END_SRC ** Starship - -#+NAME: starship_colors -#+BEGIN_SRC nix - builtins.fromTOML (builtins.readFile - (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "starship"; - rev = "3e3e54410c3189053f4da7a7043261361a1ed1bc"; # Replace with the latest commit hash - sha256 = "soEBVlq3ULeiZFAdQYMRFuswIIhI9bclIU8WXjxd7oY="; - } + /palettes/frappe.toml)) +#+BEGIN_SRC nix :tangle target/starship_colors.nix + {pkgs, ...}: + { + programs.starship.settings = builtins.fromTOML (builtins.readFile + (pkgs.fetchFromGitHub + { + owner = "catppuccin"; + repo = "starship + "; + rev = "3e3e54410c3189053f4da7a7043261361a1ed1bc"; # Replace with the latest commit hash + sha256 = "soEBVlq3ULeiZFAdQYMRFuswIIhI9bclIU8WXjxd7oY="; + } + /palettes/frappe.toml)); + } #+END_SRC ** Wezterm - -#+NAME: wezterm_colors #+BEGIN_SRC lua :tangle target/wezterm.lua config.color_scheme = 'Catppuccin Frappe' @@ -1713,7 +1804,6 @@ I like Catppuccin Frappe as my theme. Let's use it in as many places as we can. #+END_SRC ** Emacs - #+BEGIN_SRC nix :noweb-ref "emacs_packages" catppuccin-theme #+END_SRC