From f431d24f81349a0e6e91981f7e0f25620adf7e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Wed, 11 Jun 2025 02:31:01 +0200 Subject: [PATCH] feat: make zsh startup more performant --- SwarselSystems.org | 7 +- index.html | 240 +++++++++++++++++------------------ modules/home/common/zsh.nix | 6 +- modules/nixos/common/zsh.nix | 5 +- 4 files changed, 126 insertions(+), 132 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index e48c727..ee7621d 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -5778,14 +5778,17 @@ Some programs profit from being installed through dedicated NixOS settings on sy :PROPERTIES: :CUSTOM_ID: h:7daa06ff-d3b0-4491-97ce-770b749c52f9 :END: -Do not touch this. +Here I disable global completion to prevent redundant compinit calls and cache invalidation that slow down shell startup (enabled on the home-manager side). #+begin_src nix :tangle modules/nixos/common/zsh.nix { lib, config, pkgs, ... }: { options.swarselsystems.modules.zsh = lib.mkEnableOption "zsh base config"; config = lib.mkIf config.swarselsystems.modules.zsh { - programs.zsh.enable = true; + programs.zsh = { + enable = true; + enableCompletion = false; + }; users.defaultUserShell = pkgs.zsh; environment.shells = with pkgs; [ zsh ]; environment.pathsToLink = [ "/share/zsh" ]; diff --git a/index.html b/index.html index 07d4104..55c79ec 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + SwarselSystems: NixOS + Emacs Configuration @@ -263,9 +263,9 @@
  • 3.1.4.3. Home-manager only (default non-NixOS)
  • 3.1.4.4. ChaosTheatre (Demo Physical/VM)
  • @@ -305,8 +305,8 @@
  • 3.2.1.27. fhs
  • 3.2.1.28. swarsel-displaypower
  • 3.2.1.29. swarsel-mgba
  • -
  • 3.2.1.30. swarsel-deploy
  • -
  • 3.2.1.31. sshrm
  • +
  • 3.2.1.30. swarsel-deploy
  • +
  • 3.2.1.31. sshrm
  • 3.2.2. Overlays (additions, overrides, nixpkgs-stable)
  • @@ -314,37 +314,37 @@
  • 3.2.4. Library functions
  • -
  • 3.2.5. Auxiliary files +
  • 3.2.5. Auxiliary files
  • @@ -384,7 +384,7 @@
  • 3.3.1.20.3. enable GVfs
  • 3.3.1.20.4. interception-tools: Make CAPS work as ESC/CTRL
  • 3.3.1.20.5. power-profiles-daemon
  • -
  • 3.3.1.20.6. SwayOSD
  • +
  • 3.3.1.20.6. SwayOSD
  • 3.3.1.21. Hardware compatibility settings (Yubikey, Ledger, Keyboards) - udev rules @@ -436,7 +436,7 @@
  • 3.3.2.24. FreshRSS
  • 3.3.2.25. forgejo (git server)
  • 3.3.2.26. Anki Sync Server
  • -
  • 3.3.2.27. IDM (kanidm + oauth2-proxy)
  • +
  • 3.3.2.27. IDM (kanidm + oauth2-proxy)
  • 3.3.3. Darwin @@ -451,11 +451,11 @@
  • 3.3.4.3. VmWare
  • 3.3.4.4. Auto-login
  • 3.3.4.5. nswitch-rcm
  • -
  • 3.3.4.6. Framework
  • -
  • 3.3.4.7. AMD CPU
  • -
  • 3.3.4.8. AMD GPU
  • -
  • 3.3.4.9. Hibernation
  • -
  • 3.3.4.10. BTRFS
  • +
  • 3.3.4.6. Framework
  • +
  • 3.3.4.7. AMD CPU
  • +
  • 3.3.4.8. AMD GPU
  • +
  • 3.3.4.9. Hibernation
  • +
  • 3.3.4.10. BTRFS
  • 3.3.4.11. work
  • 3.3.4.12. Minimal Install
  • @@ -504,7 +504,7 @@
  • 3.4.1.29.1. gnome-keyring
  • 3.4.1.29.2. KDE Connect
  • 3.4.1.29.3. Mako
  • -
  • 3.4.1.29.4. SwayOSD
  • +
  • 3.4.1.29.4. SwayOSD
  • 3.4.1.29.5. yubikey-touch-detector
  • @@ -529,7 +529,7 @@ @@ -707,7 +707,7 @@ @@ -716,7 +716,7 @@

    -This file has 66145 words spanning 17412 lines and was last revised on 2025-06-11 02:27:48 +0200. +This file has 66113 words spanning 17398 lines and was last revised on 2025-06-11 02:30:06 +0200.

    @@ -769,7 +769,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry

    -My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2025-06-11 02:27:48 +0200) +My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2025-06-11 02:30:06 +0200)

    @@ -2906,8 +2906,8 @@ This is just a demo host. It applies all the configuration found in the common p I also set the WLR_RENDERER_ALLOW_SOFTWARE=1 to allow this configuration to run in a virtualized environment. I also enable qemuGuest for a smoother experience when testing on QEMU.

    -
    -
    3.1.4.4.1. Main configuration
    +
    +
    3.1.4.4.1. Main configuration
    { self, inputs, config, pkgs, lib, primaryUser, ... }:
    @@ -2986,8 +2986,8 @@ in
     
    -
    -
    3.1.4.4.2. NixOS dummy options configuration
    +
    +
    3.1.4.4.2. NixOS dummy options configuration
    _:
    @@ -2997,8 +2997,8 @@ in
     
    -
    -
    3.1.4.4.3. home-manager dummy options configuration
    +
    +
    3.1.4.4.3. home-manager dummy options configuration
    _:
    @@ -4779,8 +4779,8 @@ appimageTools.wrapType2 {
     
    -
    -
    3.2.1.30. swarsel-deploy
    +
    +
    3.2.1.30. swarsel-deploy
    # heavily inspired from https://github.com/oddlama/nix-config/blob/d42cbde676001a7ad8a3cace156e050933a4dcc3/pkgs/deploy.nix
    @@ -4912,8 +4912,8 @@ writeShellApplication {
     
    -
    -
    3.2.1.31. sshrm
    +
    +
    3.2.1.31. sshrm

    This programs simply runs ssh-keygen on the last host that I tried to ssh into. I need this frequently when working with cloud-init usually. @@ -5070,8 +5070,8 @@ in

    -
    -
    3.2.3.1.1. Personal
    +
    +
    3.2.3.1.1. Personal
    { lib, config, ... }:
    @@ -5140,8 +5140,8 @@ in
     
    -
    -
    3.2.3.1.2. Chaostheatre
    +
    +
    3.2.3.1.2. Chaostheatre
    { lib, config, ... }:
    @@ -5203,8 +5203,8 @@ in
     
    -
    -
    3.2.3.1.3. toto
    +
    +
    3.2.3.1.3. toto
    { lib, config, ... }:
    @@ -5236,8 +5236,8 @@ in
     
    -
    -
    3.2.3.1.4. Work
    +
    +
    3.2.3.1.4. Work
    { lib, config, ... }:
    @@ -5258,8 +5258,8 @@ in
     
    -
    -
    3.2.3.1.5. Framework
    +
    +
    3.2.3.1.5. Framework
    { lib, config, ... }:
    @@ -5280,8 +5280,8 @@ in
     
    -
    -
    3.2.3.1.6. AMD CPU
    +
    +
    3.2.3.1.6. AMD CPU
    { lib, config, ... }:
    @@ -5302,8 +5302,8 @@ in
     
    -
    -
    3.2.3.1.7. AMD GPU
    +
    +
    3.2.3.1.7. AMD GPU
    { lib, config, ... }:
    @@ -5324,8 +5324,8 @@ in
     
    -
    -
    3.2.3.1.8. Hibernation
    +
    +
    3.2.3.1.8. Hibernation
    { lib, config, ... }:
    @@ -5346,8 +5346,8 @@ in
     
    -
    -
    3.2.3.1.9. BTRFS
    +
    +
    3.2.3.1.9. BTRFS
    { lib, config, ... }:
    @@ -5368,8 +5368,8 @@ in
     
    -
    -
    3.2.3.1.10. Local Server
    +
    +
    3.2.3.1.10. Local Server
    { lib, config, ... }:
    @@ -5420,8 +5420,8 @@ in
     
    -
    -
    3.2.3.1.11. OCI Sync Server
    +
    +
    3.2.3.1.11. OCI Sync Server
    { lib, config, ... }:
    @@ -5476,8 +5476,8 @@ in
     
    -
    -
    3.2.3.2.1. Personal
    +
    +
    3.2.3.2.1. Personal
    { lib, config, ... }:
    @@ -5534,8 +5534,8 @@ in
     
    -
    -
    3.2.3.2.2. Chaostheatre
    +
    +
    3.2.3.2.2. Chaostheatre
    { lib, config, ... }:
    @@ -5587,8 +5587,8 @@ in
     
    -
    -
    3.2.3.2.3. toto
    +
    +
    3.2.3.2.3. toto
    { lib, config, ... }:
    @@ -5608,8 +5608,8 @@ in
     
    -
    -
    3.2.3.2.4. Work
    +
    +
    3.2.3.2.4. Work
    { lib, config, ... }:
    @@ -5629,8 +5629,8 @@ in
     
    -
    -
    3.2.3.2.5. Framework
    +
    +
    3.2.3.2.5. Framework
    { lib, config, ... }:
    @@ -5651,8 +5651,8 @@ in
     
    -
    -
    3.2.3.2.6. Darwin
    +
    +
    3.2.3.2.6. Darwin
    { lib, config, ... }:
    @@ -5670,8 +5670,8 @@ in
     
    -
    -
    3.2.3.2.7. Local Server
    +
    +
    3.2.3.2.7. Local Server
    { lib, config, ... }:
    @@ -5902,12 +5902,12 @@ in
     
    -
    -

    3.2.5. Auxiliary files

    +
    +

    3.2.5. Auxiliary files

    -
    -
    3.2.5.1. extra-builtins
    +
    +
    3.2.5.1. extra-builtins
    @@ -5942,8 +5942,8 @@ in
     
    -
    -
    3.2.5.2. sops-decrypt-and-cache
    +
    +
    3.2.5.2. sops-decrypt-and-cache
    #!/usr/bin/env bash
    @@ -6139,7 +6139,7 @@ A breakdown of the flags being set:
     
     
     
    -
    { self, lib, pkgs, config, outputs, inputs, ... }:
    +
    { lib, pkgs, config, outputs, inputs, ... }:
     {
       options.swarselsystems.modules.general = lib.mkEnableOption "general nix settings";
       config = lib.mkIf config.swarselsystems.modules.general {
    @@ -7301,8 +7301,8 @@ Most of the time I am using power-saver, however, it is good to be
     
    -
    -
    3.3.1.20.6. SwayOSD
    +
    +
    3.3.1.20.6. SwayOSD
    { lib, pkgs, config, ... }:
    @@ -7436,16 +7436,6 @@ This section houses the greetd related settings. I do not really want to use a d
     {
       options.swarselsystems.modules.login = lib.mkEnableOption "login config";
       config = lib.mkIf config.swarselsystems.modules.login {
    -
    -    # services.displayManager.enable = true;
    -    # programs.uwsm = {
    -    #   enable = true;
    -    #   waylandCompositors.sway = {
    -    #     prettyName = "Sway";
    -    #     comment = "Sway";
    -    #     binPath = lib.getExe pkgs.sway;
    -    #   };
    -    # };
         services.greetd = {
           enable = true;
           settings = {
    @@ -10147,8 +10137,8 @@ in
     
    -
    -
    3.3.2.27. IDM (kanidm + oauth2-proxy)
    +
    +
    3.3.2.27. IDM (kanidm + oauth2-proxy)

    The forgejo configuration is a little broken and will show a 500 error when signing in through kanidm. However, when pressing back and refreshing the page, I am logged in. Currently I cannot be bothered to fix this. @@ -10672,10 +10662,6 @@ in config = lib.mkIf config.swarselsystems.modules.optional.autologin { services = { getty.autologinUser = mainUser; - # displayManager.autoLogin = lib.mkIf config.swarselsystems.modules.login { - # enable = true; - # user = mainUser; - # }; greetd.settings.initial_session.user = mainUser; }; }; @@ -10709,8 +10695,8 @@ This smashes Atmosphere 1.3.2 on the switch, which is what I am currenty using.

    -
    -
    3.3.4.6. Framework
    +
    +
    3.3.4.6. Framework

    This holds configuration that is specific to framework laptops. @@ -10748,8 +10734,8 @@ This holds configuration that is specific to framework laptops.

    -
    -
    3.3.4.7. AMD CPU
    +
    +
    3.3.4.7. AMD CPU
    { lib, config, ... }:
    @@ -10765,8 +10751,8 @@ This holds configuration that is specific to framework laptops.
     
    -
    -
    3.3.4.8. AMD GPU
    +
    +
    3.3.4.8. AMD GPU
    { lib, config, ... }:
    @@ -10788,8 +10774,8 @@ This holds configuration that is specific to framework laptops.
     
    -
    -
    3.3.4.9. Hibernation
    +
    +
    3.3.4.9. Hibernation
    { lib, config, ... }:
    @@ -10820,8 +10806,8 @@ This holds configuration that is specific to framework laptops.
     
    -
    -
    3.3.4.10. BTRFS
    +
    +
    3.3.4.10. BTRFS
    { lib, config, ... }:
    @@ -13773,8 +13759,8 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi
     
    -
    -
    3.4.1.29.4. SwayOSD
    +
    +
    3.4.1.29.4. SwayOSD
    { lib, config, ... }:
    @@ -15023,8 +15009,8 @@ in
     
    -
    -
    3.4.4.3. Framework
    +
    +
    3.4.4.3. Framework

    This holds configuration that is specific to framework laptops. @@ -18864,8 +18850,8 @@ autocmd DocStart vc-impimba-1.m.imp.ac.at/ui/webconsole mode ignore

    -
    -

    6.3. tridactyl theme

    +
    +

    6.3. tridactyl theme

    @@ -19362,7 +19348,7 @@ sync USER HOST:
     

    Author: Leon Schwarzäugl

    -

    Created: 2025-06-11 Mi 02:27

    +

    Created: 2025-06-11 Mi 02:30

    Validate

    diff --git a/modules/home/common/zsh.nix b/modules/home/common/zsh.nix index ead444b..600dfa4 100644 --- a/modules/home/common/zsh.nix +++ b/modules/home/common/zsh.nix @@ -17,8 +17,10 @@ in { hg = "history | grep"; hmswitch = "home-manager --flake ${flakePath}#$(whoami)@$(hostname) switch |& nom"; - nswitch = "sudo nixos-rebuild --flake ${flakePath}#$(hostname) --show-trace --log-format internal-json -v switch |& nom --json"; - nboot = "sudo nixos-rebuild --flake ${flakePath}#$(hostname) --show-trace --log-format internal-json -v boot |& nom --json"; + # nswitch = "sudo nixos-rebuild --flake ${flakePath}#$(hostname) --show-trace --log-format internal-json -v switch |& nom --json"; + nswitch = "swarsel-deploy $(hostname) switch"; + # nboot = "sudo nixos-rebuild --flake ${flakePath}#$(hostname) --show-trace --log-format internal-json -v boot |& nom --json"; + nboot = "swarsel-deploy $(hostname) boot"; magit = "emacsclient -nc -e \"(magit-status)\""; config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME"; g = "git"; diff --git a/modules/nixos/common/zsh.nix b/modules/nixos/common/zsh.nix index fd9ffd5..e1eaaf6 100644 --- a/modules/nixos/common/zsh.nix +++ b/modules/nixos/common/zsh.nix @@ -2,7 +2,10 @@ { options.swarselsystems.modules.zsh = lib.mkEnableOption "zsh base config"; config = lib.mkIf config.swarselsystems.modules.zsh { - programs.zsh.enable = true; + programs.zsh = { + enable = true; + enableCompletion = false; + }; users.defaultUserShell = pkgs.zsh; environment.shells = with pkgs; [ zsh ]; environment.pathsToLink = [ "/share/zsh" ];