Commit 881471011870
Changed files (13)
home
common
desktop
systems
common
users
home/common/desktop/default.nix
@@ -11,6 +11,9 @@
./mpv.nix
./passage.nix
./xdg.nix
+
+ ../dev/base.nix
+ ../dev/desktop.nix
];
home.packages = with pkgs; [
home/common/dev/emacs/capture.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=Emacs capture
+Exec=capture
+Type=Application
+Terminal=false
+Categories=System;
+Icon=emacs;
home/common/dev/emacs/org-protocol.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=org-protocol
+Exec=emacsclient -c -n %u
+Type=Application
+Terminal=false
+Categories=System;
+MimeType=x-scheme-handler/org-protocol;
home/common/dev/python/pythonrc
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+# This entire thing is unnecessary post v3.13.0a3
+# https://github.com/python/cpython/issues/73965
+
+def is_vanilla() -> bool:
+ """ :return: whether running "vanilla" Python <3.13 """
+ import sys
+ return not hasattr(__builtins__, '__IPYTHON__') and 'bpython' not in sys.argv[0] and sys.version_info < (3, 13)
+
+
+def setup_history():
+ """ read and write history from state file """
+ import os
+ import atexit
+ import readline
+ from pathlib import Path
+
+ # Check PYTHON_HISTORY for future-compatibility with Python 3.13
+ if history := os.environ.get('PYTHON_HISTORY'):
+ history = Path(history)
+ # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
+ elif state_home := os.environ.get('XDG_STATE_HOME'):
+ state_home = Path(state_home)
+ else:
+ state_home = Path.home() / '.local' / 'state'
+
+ history: Path = history or state_home / 'python_history'
+
+ # https://github.com/python/cpython/issues/105694
+ if not history.is_file():
+ readline.write_history_file(str(history)) # breaks on macos + python3 without this.
+ readline.read_history_file(history)
+ atexit.register(readline.write_history_file, history)
+
+ if is_vanilla():
+ setup_history()
home/common/dev/base.nix
@@ -0,0 +1,46 @@
+{ config, pkgs, ... }:
+{
+ imports = [
+ ./go.nix
+ ./nix.nix
+ ./python.nix
+ ];
+
+ home.sessionVariables = {
+ CARGO_HOME = "${config.xdg.dataHome}/cargo";
+ };
+
+ home.packages = with pkgs; [
+ jq
+ ijq # interactive jq
+ # gron # make json greppable
+
+ binutils
+ gnumake
+ moreutils
+
+ # Shell tooling
+ shellcheck
+ shfmt
+
+ # old
+ cmake
+ codespell
+ # devenv
+ difftastic
+ fswatch
+ gum
+ markdownlint-cli
+ minica
+ pre-commit
+ tldr
+ tmate
+ vale
+ yamllint
+ yamlfmt
+ yq-go
+ radicle-node
+ vscode-fhs
+ ];
+
+}
home/common/dev/default.nix
@@ -0,0 +1,9 @@
+{ lib
+, desktop
+, ...
+}:
+{
+ imports = [
+ ./base.nix
+ ] ++ lib.optional (builtins.isString desktop) ./desktop.nix;
+}
home/common/dev/desktop.nix
@@ -0,0 +1,6 @@
+{ pkgs, ... }:
+{
+ imports = [
+ ./emacs.nix
+ ];
+}
home/common/dev/emacs.nix
@@ -0,0 +1,193 @@
+{ config, lib, pkgs, ... }:
+let
+ capture = pkgs.writeScriptBin "capture" ''
+ #!${pkgs.stdenv.shell}
+ emacsclient -n -c -F '((name . "capture") (width . 150) (height . 90) (vde/window-popup-frame . t))' -e '(org-capture)'
+ '';
+ et = pkgs.writeScriptBin "et" ''
+ #!${pkgs.stdenv.shell}
+ emacsclient --tty $@
+ '';
+ ec = pkgs.writeScriptBin "ec" ''
+ #!${pkgs.stdenv.shell}
+ emacsclient --create-frame $@
+ '';
+ myExtraPackages = epkgs: with epkgs; [
+ ace-window
+ adoc-mode
+ age
+ aggressive-indent
+ aidermacs
+ alert
+ async
+ avy
+ beginend
+ cape
+ casual
+ casual-avy
+ conner
+ consult
+ consult-dir
+ consult-denote
+ consult-notes
+ consult-project-extra
+ consult-vc-modified-files
+ copilot
+ copilot-chat
+ corfu
+ corfu-candidate-overlay
+ dape
+ dash
+ denote
+ denote-menu
+ devdocs
+ dired-collapse
+ dired-narrow
+ dired-rsync
+ diredfl
+ dockerfile-mode
+ doom-modeline
+ easy-kill
+ eat
+ edit-indirect
+ editorconfig
+ eldoc-box
+ pr-review
+ embark
+ embark-consult
+ emms
+ envrc
+ eshell-atuin
+ eshell-prompt-extras
+ esup
+ flimenu
+ flymake-yamllint
+ git-gutter
+ git-gutter-fringe
+ git-modes
+ go-mode
+ gotest
+ gotest-ts
+ gptel
+ hardhat
+ helpful
+ highlight
+ highlight-indentation
+ htmlize
+ ibuffer-vc
+ indent-bars
+ jinx
+ json-mode
+ kubed
+ ligature
+ macrostep
+ magit
+ magit-popup
+ marginalia
+ markdown-mode
+ minions
+ modus-themes
+ multi-vterm
+ mu4e
+ mwim
+ nix-mode
+ nix-ts-mode
+ nixpkgs-fmt
+ no-littering
+ noether
+ # notmuch
+ ob-async
+ ob-go
+ ob-http
+ orderless # TODO configure this
+ org
+ org-contrib
+ org-download
+ org-modern
+ org-nix-shell
+ org-ql
+ org-review
+ org-rich-yank
+ org-tree-slide
+ org-web-tools
+ orgalist
+ orgit
+ outline-indent
+ ox-pandoc
+ pandoc-mode
+ # password-store
+ # pkgs.bookmatrk-plus # Do I use it ?
+ popper
+ project-rootfile
+ rg
+ run-command # Try this out instead of conner, might be even better
+ scopeline
+ scratch
+ shr-tag-pre-highlight
+ sideline
+ sideline-eglot
+ sideline-flymake
+ smartparens
+ substitute
+ surround
+ symbol-overlay
+ tempel
+ tempel-collection
+ topsy
+ trashed
+ treesit-fold
+ treesit-grammars.with-all-grammars # see how much it weight
+ try
+ typescript-mode
+ vertico
+ visual-fill-column
+ visual-regexp
+ vterm
+ vundo
+ web-mode
+ wgrep
+ with-editor
+ xterm-color
+ ];
+in
+{
+ home.file.".config/emacs" = {
+ source = config.lib.file.mkOutOfStoreSymlink "/home/vincent/src/home/tools/emacs";
+ # recursive = true;
+ };
+ home.file.".local/share/applications/org-protocol.desktop".source = ./emacs/org-protocol.desktop;
+ home.file.".local/share/applications/capture.desktop".source = ./emacs/capture.desktop;
+ home.packages = with pkgs; [
+ ditaa
+ graphviz
+ pandoc
+ sqlite
+ zip
+ ugrep
+ # See if I can hide this under an option
+ capture
+ # github-copilot-cli # for copilot.el
+ nodejs
+ ec
+ et
+ languagetool
+ asciidoctor
+ enchant
+ ];
+ programs.emacs = {
+ enable = true;
+ # FIXME: choose depending on the enabled modules
+ #package = (pkgs.emacs29.override { withTreeSitter = true; withNativeCompilation = true; withPgtk = true; withWebP = true; withGTK3 = true; withSQLite3 = true; });
+ package = (pkgs.emacs-unstable.override { withTreeSitter = true; withNativeCompilation = true; withPgtk = true; withWebP = true; withGTK3 = true; withSQLite3 = true; });
+ extraPackages = myExtraPackages;
+ };
+ # services.emacs = {
+ # enable = true;
+ # client.enable = true;
+ # #socketActivation.enable = true;
+ # };
+ home.sessionVariables = {
+ EDITOR = "emacs";
+ ALTERNATE_EDITOR = "emacs -nw";
+ };
+}
home/common/dev/go.nix
@@ -0,0 +1,29 @@
+{ config, pkgs, ... }:
+{
+ home.sessionVariables = {
+ # GOPATH = "${config.home.homeDirectory}";
+ GOPATH = "${config.xdg.dataHome}/go";
+ };
+ home.packages = with pkgs; [
+ gcc
+ go_1_24
+ gopls
+ godef
+ golangci-lint
+ golint
+ gopkgs
+ go-outline
+ go-symbols
+ delve
+ gotools
+ gotestsum
+ gofumpt
+ # misc
+ protobuf
+ my.ram
+ # not really go but still
+ gosmee
+ # cue
+ deptree
+ ];
+}
home/common/dev/nix.nix
@@ -0,0 +1,18 @@
+{ pkgs, ... }:
+{
+ home.packages = with pkgs; [
+ nh
+ nix-output-monitor
+ nix-prefetch-scripts
+ nix-update
+ nixpkgs-fmt
+ nixpkgs-review
+ nixfmt-plus
+ nixfmt-rfc-style
+ nurl
+ statix
+ deadnix
+ nix-init
+ nil
+ ];
+}
home/common/dev/python.nix
@@ -0,0 +1,18 @@
+{ config, pkgs, ... }:
+{
+ xdg.configFile."python/pythonrc".source = ./python/pythonrc;
+ home.packages = with pkgs; [
+ (pkgs.python313.withPackages (
+ p: with p; [
+ tox
+ virtualenv
+ python-lsp-server
+ ]
+ ))
+ uv
+ ruff
+ ];
+ home.sessionVariables = {
+ PYTHONSTARTUP = "${config.xdg.configHome}/python/pythonrc";
+ };
+}
home/default.nix
@@ -1,4 +1,5 @@
-{ desktop
+{ config
+, desktop
, hostname
, lib
, pkgs
systems/common/users/vincent.nix
@@ -68,7 +68,7 @@ in
# Do I user home-manager nixosModule *or* home-manager on its own
home-manager.users.vincent =
(import ../../../home/default.nix {
- inherit pkgs lib hostname desktop outputs inputs stateVersion;
+ inherit config pkgs lib hostname desktop outputs inputs stateVersion;
username = "vincent";
});
# This is a workaround for not seemingly being able to set $EDITOR in home-manager