~misterio/nix-config

bba976b3f9ca19bb8821d7560140f00327467ce6 — Gabriel Fontes 1 year, 8 months ago d8676c5 bak
bak
M flake.lock => flake.lock +67 -19
@@ 48,9 48,28 @@
        "type": "gitlab"
      }
    },
    "firefox-addons": {
    "emacs-overlay": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nixpkgs": "nixpkgs"
      },
      "locked": {
        "lastModified": 1666382611,
        "narHash": "sha256-XTT5sL+msuYcyzh3aLG3Ekip7NiRRYJkqE/PT6p38N4=",
        "owner": "nix-community",
        "repo": "emacs-overlay",
        "rev": "ffc00124f627fd5dec1d649555aa128b66ce6bc7",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "emacs-overlay",
        "type": "github"
      }
    },
    "firefox-addons": {
      "inputs": {
        "flake-utils": "flake-utils_2",
        "nixpkgs": [
          "nixpkgs"
        ]


@@ 73,6 92,21 @@
    },
    "flake-utils": {
      "locked": {
        "lastModified": 1659877975,
        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "flake-utils_2": {
      "locked": {
        "lastModified": 1629284811,
        "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
        "owner": "numtide",


@@ 124,7 158,7 @@
    },
    "hyprland": {
      "inputs": {
        "nixpkgs": "nixpkgs",
        "nixpkgs": "nixpkgs_2",
        "wlroots": "wlroots"
      },
      "locked": {


@@ 144,7 178,7 @@
    },
    "hyprwm-contrib": {
      "inputs": {
        "nixpkgs": "nixpkgs_2"
        "nixpkgs": "nixpkgs_3"
      },
      "locked": {
        "lastModified": 1666104453,


@@ 238,18 272,15 @@
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1665259268,
        "narHash": "sha256-ONFhHBLv5nZKhwV/F2GOH16197PbvpyWhoO0AOyktkU=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "c5924154f000e6306030300592f4282949b2db6c",
        "type": "github"
        "lastModified": 1666282307,
        "narHash": "sha256-O1T2HGLARLKDLfdOmjPBfn3eC4cSIaQD71wUN4I/6/s=",
        "path": "/nix/store/x20avpqcrk6my01n6h1blfslb6l4imw2-source",
        "rev": "b7d8c687782c8f9a1d425a7e486eb989654f6468",
        "type": "path"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "nixpkgs-22_05": {


@@ 315,6 346,22 @@
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1665259268,
        "narHash": "sha256-ONFhHBLv5nZKhwV/F2GOH16197PbvpyWhoO0AOyktkU=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "c5924154f000e6306030300592f4282949b2db6c",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs_3": {
      "locked": {
        "lastModified": 1658161305,
        "narHash": "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=",
        "owner": "NixOS",


@@ 329,7 376,7 @@
        "type": "github"
      }
    },
    "nixpkgs_3": {
    "nixpkgs_4": {
      "locked": {
        "lastModified": 1666282307,
        "narHash": "sha256-O1T2HGLARLKDLfdOmjPBfn3eC4cSIaQD71wUN4I/6/s=",


@@ 345,7 392,7 @@
        "type": "github"
      }
    },
    "nixpkgs_4": {
    "nixpkgs_5": {
      "locked": {
        "lastModified": 1665132027,
        "narHash": "sha256-zoHPqSQSENt96zTk6Mt1AP+dMNqQDshXKQ4I6MfjP80=",


@@ 361,7 408,7 @@
        "type": "github"
      }
    },
    "nixpkgs_5": {
    "nixpkgs_6": {
      "locked": {
        "lastModified": 1660842467,
        "narHash": "sha256-lSer61lI5X61/3zjMu4OSUqdKSCW2jM1rU6B3WLBOj4=",


@@ 379,7 426,7 @@
    },
    "paste-misterio-me": {
      "inputs": {
        "nixpkgs": "nixpkgs_4"
        "nixpkgs": "nixpkgs_5"
      },
      "locked": {
        "lastModified": 1665755500,


@@ 397,6 444,7 @@
    },
    "root": {
      "inputs": {
        "emacs-overlay": "emacs-overlay",
        "firefox-addons": "firefox-addons",
        "hardware": "hardware",
        "home-manager": "home-manager",


@@ 405,7 453,7 @@
        "impermanence": "impermanence",
        "nix-colors": "nix-colors",
        "nixos-mailserver": "nixos-mailserver",
        "nixpkgs": "nixpkgs_3",
        "nixpkgs": "nixpkgs_4",
        "paste-misterio-me": "paste-misterio-me",
        "sops-nix": "sops-nix",
        "website": "website"


@@ 465,7 513,7 @@
    "website": {
      "inputs": {
        "nix-colors": "nix-colors_2",
        "nixpkgs": "nixpkgs_5"
        "nixpkgs": "nixpkgs_6"
      },
      "locked": {
        "lastModified": 1665897427,

M flake.nix => flake.nix +1 -0
@@ 25,6 25,7 @@
      url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    emacs-overlay.url = "github:nix-community/emacs-overlay";

    # Nixified software I use
    hyprland.url = "github:hyprwm/hyprland/v0.15.2beta";

M home/misterio/atlas.nix => home/misterio/atlas.nix +0 -1
@@ 1,6 1,5 @@
{ inputs, pkgs, ... }: {
  imports = [ ./global
    ./features/cli
    ./features/desktop/hyprland
    ./features/trusted
    ./features/rgb

M home/misterio/features/cli/default.nix => home/misterio/features/cli/default.nix +0 -1
@@ 7,7 7,6 @@
    ./git.nix
    ./gpg.nix
    ./nix-index.nix
    ./nvim
    ./pfetch.nix
    ./ranger.nix
    ./screen.nix

M home/misterio/features/cli/fish.nix => home/misterio/features/cli/fish.nix +1 -0
@@ 22,6 22,7 @@
      hm = "home-manager --flake .";
      hms = "home-manager --flake . switch";

      e = "emacsclient -t";
      v = "nvim";
      vi = "nvim";
      vim = "nvim";

M home/misterio/features/desktop/common/wayland-wm/kitty.nix => home/misterio/features/desktop/common/wayland-wm/kitty.nix +0 -5
@@ 9,11 9,6 @@ in
{
  home = {
    packages = [ kitty-xterm ];
    preferredApps.terminal = {
      cmd = "kitty -1";
      # Spawn a program
      cmd-spawn = program: "kitty -1 $SHELL -i -c ${program}";
    };
    sessionVariables = {
      TERMINAL = "kitty";
    };

M home/misterio/features/desktop/common/wayland-wm/mako.nix => home/misterio/features/desktop/common/wayland-wm/mako.nix +0 -4
@@ 1,10 1,6 @@
{ config, ... }:
let inherit (config.colorscheme) colors kind;
in {
  home.preferredApps.notifier = {
    dismiss-cmd = "makoctl dismiss";
  };

  programs.mako = {
    enable = true;
    iconPath = if kind == "dark" then

M home/misterio/features/desktop/common/wayland-wm/qutebrowser.nix => home/misterio/features/desktop/common/wayland-wm/qutebrowser.nix +0 -3
@@ 4,9 4,6 @@ let inherit (config.colorscheme) colors kind;
in
{
  home = {
    preferredApps.browser = {
      cmd = "qutebrowser";
    };
    sessionVariables = {
      BROWSER = "qutebrowser";
    };

M home/misterio/features/desktop/common/wayland-wm/waybar.nix => home/misterio/features/desktop/common/wayland-wm/waybar.nix +0 -3
@@ 2,7 2,6 @@

let
  inherit (pkgs.lib) optionals optional;
  inherit (config.home.preferredApps) menu terminal;

  # Dependencies
  jq = "${pkgs.jq}/bin/jq";


@@ 161,7 160,6 @@ in
            text = "";
            tooltip = ''$(cat /etc/os-release | grep PRETTY_NAME | cut -d '"' -f2)'';
          };
          on-click = menu.drun-cmd;
        };
        "custom/hostname" = {
          exec = "echo $USER@$(hostname)";


@@ 296,7 294,6 @@ in
            "Stopped" = "栗";
          };
          on-click = "${playerctl} play-pause";
          on-click-right = terminal.cmd-spawn "${lyrics}";
        };
      };


M home/misterio/features/desktop/common/wayland-wm/wofi.nix => home/misterio/features/desktop/common/wayland-wm/wofi.nix +4 -14
@@ 5,26 5,16 @@ let
  };
in
{
  home = {
    packages = with pkgs; [
      wofi
      pass-wofi
    ];

    preferredApps.menu = {
      run-cmd = "wofi -S run";
      drun-cmd = "wofi -S drun -x 10 -y 10 -W 25% -H 60%";
      dmenu-cmd = "wofi -S dmenu";
      password-cmd = "pass-wofi";
    };
  };
  home.packages = with pkgs; [
    wofi
    pass-wofi
  ];

  xdg.configFile."wofi/config".text = ''
    image_size=48
    columns=3
    allow_images=true
    insensitive=true
    term=${config.home.preferredApps.terminal.cmd}

    run-always_parse_args=true
    run-cache_file=/dev/null

M home/misterio/features/desktop/hyprland/default.nix => home/misterio/features/desktop/hyprland/default.nix +25 -14
@@ 8,20 8,31 @@
  wayland.windowManager.hyprland =
    let
      inherit (config.colorscheme) colors;
      inherit (config.home.preferredApps)
        menu browser editor mail notifier terminal;

      grimblast = "${inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast}/bin/grimblast";

      light = "${pkgs.light}/bin/light";
      mako = "${pkgs.mako}/bin/mako";
      makoctl = "${pkgs.mako}/bin/makoctl";
      neomutt = "${pkgs.neomutt}/bin/neomutt";
      pactl = "${pkgs.pulseaudio}/bin/pactl";
      pass-wofi = "${pkgs.pass-wofi}/bin/pass-wofi";
      playerctl = "${pkgs.playerctl}/bin/playerctl";
      playerctld = "${pkgs.playerctl}/bin/playerctld";
      qutebrowser = "${pkgs.qutebrowser}/bin/qutebrowser";
      swaybg = "${pkgs.swaybg}/bin/swaybg";
      swayidle = "${pkgs.swayidle}/bin/swayidle";
      swaylock = "${pkgs.swaylock-effects}/bin/swaylock";
      systemctl = "${pkgs.systemd}/bin/systemctl";
      wofi = "${pkgs.wofi}/bin/wofi";

      terminal = "${pkgs.kitty}/bin/kitty";
      terminal-spawn = cmd: "${terminal} -c '$SHELL -i ${cmd}'";

      nvim = lib.optionalString
        config.programs.neovim.enable "${config.programs.neovim.package}/bin/nvim";
      emacs = lib.optionalString
        config.programs.emacs.enable "${config.programs.emacs.finalPackage}/bin/emacsclient -c";
    in
    {
      enable = true;


@@ 94,17 105,17 @@
          bindm=SUPER,mouse:273,resizewindow

          # Program bindings
          bind=SUPER,Return,exec,${terminal.cmd}
          bind=SUPER,w,exec,${notifier.dismiss-cmd}
          bind=SUPER,v,exec,${editor.cmd}
          bind=SUPER,m,exec,${mail.cmd}
          bind=SUPER,b,exec,${browser.cmd}

          bind=SUPER,x,exec,${menu.drun-cmd}
          bind=SUPER,d,exec,${menu.run-cmd}
          bind=,Scroll_Lock,exec,${menu.password-cmd} # fn+k
          bind=,XF86Calculator,exec,${menu.password-cmd} # fn+f12
          bind=SUPER,c,exec,${terminal.cmd-spawn "${pkgs.bc}/bin/bc -l"}
          bind=SUPER,Return,exec,${terminal}
          bind=SUPER,w,exec,${makoctl} dismiss
          bind=SUPER,e,exec,${emacs}
          bind=SUPER,v,exec,${terminal-spawn nvim}
          bind=SUPER,m,exec,${terminal-spawn neomutt}
          bind=SUPER,b,exec,${qutebrowser}

          bind=SUPER,x,exec,${wofi} -S drun -x 10 -y 10 -W 25% -H 60%
          bind=SUPER,d,exec,${wofi} -S run
          bind=,Scroll_Lock,exec,${pass-wofi} # fn+k
          bind=,XF86Calculator,exec,${pass-wofi} # fn+f12

          # Toggle waybar
          bind=,XF86Tools,exec,${pkgs.procps}/bin/pkill -USR1 waybar # profile button


@@ 131,7 142,7 @@
          bind=ALT,XF86AudioNext,exec,${playerctld} shift
          bind=ALT,XF86AudioPrev,exec,${playerctld} unshift
          bind=ALT,XF86AudioPlay,exec,${systemctl} --user restart playerctld
          bind=SUPER,XF86AudioPlay,exec,${terminal.cmd-spawn "${pkgs.lyrics}/bin/lyrics"}
          bind=SUPER,XF86AudioPlay,exec,${terminal-spawn "${pkgs.lyrics}/bin/lyrics"}

          bind=,XF86AudioRaiseVolume,exec,${pactl} set-sink-volume @DEFAULT_SINK@ +5%
          bind=,XF86AudioLowerVolume,exec,${pactl} set-sink-volume @DEFAULT_SINK@ -5%

D home/misterio/features/desktop/sway/default.nix => home/misterio/features/desktop/sway/default.nix +0 -217
@@ 1,217 0,0 @@
{ lib, pkgs, config, ... }: {
  imports = [
    ../common
    ../common/wayland-wm
  ];

  wayland.windowManager.sway =
    let
      inherit (config.colorscheme) colors;
      inherit (config.home.preferredApps) menu browser editor mail notifier terminal;

      modifier = "Mod4";
    in
    {
      enable = true;
      wrapperFeatures.gtk = true;
      config = {
        inherit modifier;
        terminal = "${terminal.cmd}";
        menu = "${menu.run-cmd}";
        fonts = {
          names = [ config.fontProfiles.regular.family ];
          size = 12.0;
        };
        output = {
          eDP-1 = {
            res = "1920x1080@60hz";
            pos = "0 15";
            bg = "${config.wallpaper} fill";
          };
          DP-3 = {
            res = "1920x1080@60hz";
            pos = "0 0";
            bg = "${config.wallpaper} fill";
          };
          DP-1 = {
            res = "2560x1080@75hz";
            pos = "1920 65";
            bg = "${config.wallpaper} fill";
          };
          DP-2 = {
            res = "1920x1080@60hz";
            pos = "4480 0";
            bg = "${config.wallpaper} fill";
          };
        };
        defaultWorkspace = "workspace number 1";
        input = {
          # Keyboards
          "6940:6985:Corsair_CORSAIR_K70_RGB_MK.2_Mechanical_Gaming_Keyboard" = {
            xkb_layout = "br";
          };
          "6940:6985:ckb1:_CORSAIR_K70_RGB_MK.2_Mechanical_Gaming_Keyboard_vKB" = {
            xkb_layout = "br";
          };
          "1:1:AT_Translated_Set_2_keyboard" = {
            xkb_layout = "br";
          };
          # Mouses
          "6940:7051:ckb2:_CORSAIR_SCIMITAR_RGB_ELITE_Gaming_Mouse_vM" = {
            pointer_accel = "1";
          };
          "1739:52781:MSFT0001:00_06CB:CE2D_Touchpad" = {
            tap = "enabled";
            dwt = "disabled";
          };
        };
        gaps = {
          horizontal = 5;
          inner = 28;
        };
        floating.criteria = [
          { app_id = "zenity"; }
          { class = "net-runelite-launcher-Launcher"; }
        ];
        colors = {
          focused = {
            border = "${colors.base0C}";
            background = "${colors.base00}";
            text = "${colors.base05}";
            indicator = "${colors.base09}";
            childBorder = "${colors.base0C}";
          };
          focusedInactive = {
            border = "${colors.base03}";
            background = "${colors.base00}";
            text = "${colors.base04}";
            indicator = "${colors.base03}";
            childBorder = "${colors.base03}";
          };
          unfocused = {
            border = "${colors.base02}";
            background = "${colors.base00}";
            text = "${colors.base03}";
            indicator = "${colors.base02}";
            childBorder = "${colors.base02}";
          };
          urgent = {
            border = "${colors.base09}";
            background = "${colors.base00}";
            text = "${colors.base03}";
            indicator = "${colors.base09}";
            childBorder = "${colors.base09}";
          };
        };
        startup = [
          # Initial lock
          { command = "${pkgs.swaylock-effects}/bin/swaylock -i ${config.wallpaper}"; }
          # Start idle daemon
          { command = "${pkgs.swayidle}/bin/swayidle -w"; }
          # Add transparency
          { command = "SWAYFADER_CON_INAC=0.85 ${pkgs.swayfader}/bin/swayfader"; }
          # Set biggest monitor as xwayland primary
          { command = "${pkgs.primary-xwayland}/bin/primary-xwayland largest"; }
          # https://github.com/NixOS/nixpkgs/issues/119445
          { command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; }
        ];
        bars = [{
          command = "waybar";
        }];
        window = {
          border = 2;
          commands = [
            {
              command = "move scratchpad";
              criteria = { title = "Wine System Tray"; };
            }
            {
              command = "move scratchpad";
              criteria = { title = "Firefox — Sharing Indicator"; };
            }
          ];
        };
        keybindings = lib.mkOptionDefault
          {
            # Focus parent or child
            "${modifier}+bracketleft" = "focus parent";
            "${modifier}+bracketright" = "focus child";

            # Layout types
            "${modifier}+s" = "layout stacking";
            "${modifier}+t" = "layout tabbed";
            "${modifier}+e" = "layout toggle split";

            # Splits
            "${modifier}+minus" = "split v";
            "${modifier}+backslash" = "split h";

            # Scratchpad
            "${modifier}+u" = "scratchpad show";
            "${modifier}+Shift+u" = "move scratchpad";

            # Move entire workspace
            "${modifier}+Mod1+h" = "move workspace to output left";
            "${modifier}+Mod1+Left" = "move workspace to output left";
            "${modifier}+Mod1+l" = "move workspace to output right";
            "${modifier}+Mod1+Right" = "move workspace to output right";

            # Toggle monitors
            "${modifier}+Control+Left" = "output DP-3 toggle";
            "${modifier}+Control+Down" = "output DP-1 toggle";
            "${modifier}+Control+Right" = "output DP-2 toggle";

            # Lock screen
            "XF86Launch5" = "exec swaylock -S"; # lock icon on k70
            "XF86Launch4" = "exec swaylock -S"; # fn+q

            # Volume
            "XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
            "XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
            "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
            "Shift+XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
            "XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";

            # Brightness
            "XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 10";
            "XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 10";

            # Media
            "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
            "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
            "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
            "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";

            # Notifications
            "${modifier}+w" = "exec ${notifier.dismiss-cmd}";

            # Programs
            "${modifier}+v" = "exec ${editor.cmd}";
            "${modifier}+m" = "exec ${mail.cmd}";
            "${modifier}+b" = "exec ${browser.cmd}";

            # Screenshot
            # Current monitor
            "Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy output";
            # Current window
            "Shift+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy active";
            # Entire screen
            "Control+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy screen";
            # Pick area
            "Mod1+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy area";
            # Pick window
            "${modifier}+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy window";

            # Application menu
            "${modifier}+x" = "exec ${menu.drun-cmd}";

            # Pass menu
            "Scroll_Lock" = "exec ${menu.password-cmd}"; # fn+k
            "XF86Calculator" = "exec ${menu.password-cmd}"; # fn+f12

            # Full screen across monitors
            "${modifier}+shift+f" = "fullscreen toggle global";
          };
      };
    };
}

A home/misterio/features/emacs/default.nix => home/misterio/features/emacs/default.nix +67 -0
@@ 0,0 1,67 @@
{ inputs, pkgs, config, ... }:
let emacs-overlay = inputs.emacs-overlay.packages.${pkgs.system};
in
{
  programs.emacs = {
    enable = true;
    package = emacs-overlay.emacsPgtkNativeComp;

    overrides = final: _prev: {
      nix-theme = final.callPackage ./theme.nix { inherit config; };
    };
    extraPackages = epkgs: with epkgs; [
      nix-theme
      nix-mode
      magit

      evil
      evil-org
      evil-collection
      evil-surround
    ];

    extraConfig = /* lisp */ ''
      (scroll-bar-mode -1)
      (tool-bar-mode -1)
      (tooltip-mode -1)
      (set-fringe-mode 10)
      (menu-bar-mode -1)
      (set-face-attribute 'default nil :font "FiraCode Nerd Font" :height 120)
      (setq visible-bell t)

      (setq base16-theme-256-color-source "base16-shell")
      (load-theme 'base16-${config.colorscheme.slug} t)

      (require 'nix-mode)
      (add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-mode))

      (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
      (global-set-key "\C-cl" 'org-store-link)
      (global-set-key "\C-ca" 'org-agenda)
      (setq org-directory "~/Documents/Org")
      (setq org-agenda-files (directory-files-recursively org-directory "\\.org$"))


      (setq evil-want-keybinding nil)
      (require 'evil)
      (evil-mode 1)

      (require 'evil-org)
      (add-hook 'org-mode-hook 'evil-org-mode)
      (evil-org-set-key-theme '(navigation insert textobjects additional calendar))
      (require 'evil-org-agenda)
      (evil-org-agenda-set-keys)

      (evil-collection-init)

      (global-evil-surround-mode 1)
    '';
  };
  services.emacs = {
    enable = true;
    client.enable = true;
    defaultEditor = true;
    socketActivation.enable = true;
    startWithUserSession = true;
  };
}

A home/misterio/features/emacs/theme.nix => home/misterio/features/emacs/theme.nix +42 -0
@@ 0,0 1,42 @@
{ emacsPackagesFor, writeText, config, ... }:
let
  emacsPackages = emacsPackagesFor config.programs.emacs.package;
  scheme = config.colorscheme;
in
emacsPackages.trivialBuild {
  pname = "theme";
  src = writeText "nix-${scheme.slug}.el" ''
    (require 'base16-theme)

    (defvar base16-${scheme.slug}-theme-colors
      '(:base00 "#${scheme.colors.base00}"
        :base01 "#${scheme.colors.base01}"
        :base02 "#${scheme.colors.base02}"
        :base03 "#${scheme.colors.base03}"
        :base04 "#${scheme.colors.base04}"
        :base05 "#${scheme.colors.base05}"
        :base06 "#${scheme.colors.base06}"
        :base07 "#${scheme.colors.base07}"
        :base08 "#${scheme.colors.base08}"
        :base09 "#${scheme.colors.base09}"
        :base0A "#${scheme.colors.base0A}"
        :base0B "#${scheme.colors.base0B}"
        :base0C "#${scheme.colors.base0C}"
        :base0D "#${scheme.colors.base0D}"
        :base0E "#${scheme.colors.base0E}"
        :base0F "#${scheme.colors.base0F}")
      "All colors for Base16 ${scheme.name} are defined here.")

    ;; Define the theme
    (deftheme base16-${scheme.slug})

    ;; Add all the faces to the theme
    (base16-theme-define 'base16-${scheme.slug} base16-${scheme.slug}-theme-colors)

    ;; Mark the theme as provided
    (provide-theme 'base16-${scheme.slug})

    (provide 'base16-${scheme.slug}-theme)
  '';
  packageRequires = [ emacsPackages.base16-theme ];
}

R home/misterio/features/cli/nvim/default.nix => home/misterio/features/nvim/default.nix +1 -6
@@ 1,10 1,5 @@
{ config, pkgs, lib, ... }: {
  home = {
    sessionVariables.EDITOR = "nvim";
    preferredApps.editor = {
      cmd = config.home.preferredApps.terminal.cmd-spawn "nvim";
    };
  };
  home.sessionVariables.EDITOR = "nvim";

  programs.neovim = {
    enable = true;

R home/misterio/features/cli/nvim/theme.nix => home/misterio/features/nvim/theme.nix +0 -0
A home/misterio/features/profile-dotemacs.el => home/misterio/features/profile-dotemacs.el +200 -0
@@ 0,0 1,200 @@
;;; profile-dotemacs.el --- Profile your Emacs init file

;; Copyright (C) 2010, 2012  David Engster

;; Author: David Engster <dengste@eml.cc>

;; This file is NOT part of GNU Emacs.

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This is to easily profile your Emacs init file (or any other
;; script-like Emacs Lisp file, for that matter).

;; It will go over all sexp's (balanced expressions) in the file and
;; run them through `benchmark-run'.  It will then show the file with
;; overlays applied in a way that let you easily find out which sexp's
;; take the most time.  Since time is relative, it's not the absolute
;; value that counts but the percentage of the total running time.
;;
;; * All other sexp's with a percentage greater than
;;   `profile-dotemacs-low-percentage' will be preceded by a
;;   highlighted line, showing the results from `benchmark-run'.
;;   Also, the more 'reddish' the background of the sexp, the more
;;   time it needs.

;; * All other sexp's will be grayed out to indicate that their
;;   running time is miniscule.  You can still see the benchmark
;;   results in the minibuffer by hovering over the sexp with the
;;   mouse.

;; You can only benchmark full sexp's, so if you wrapped large parts
;; of your init file in some conditional clause, you'll have to remove
;; that for getting finer granularity.

;;; Usage:

;; Start emacs as follows:
;;
;;    emacs -Q -l <PATH>/profile-dotemacs.el -f profile-dotemacs
;;
;; with <PATH> being the path to where this file resides.

;;; Caveats (thanks to Raffaele Ricciardi for reporting those):

;; - The usual `--debug-init' for debugging your init file won't work
;;   with profile-dotemacs, so you'll have to call
;;   `toggle-debug-on-error', either on the commandline or at the
;;   beginning of your init file.
;; - `load-file-name' is nil when the init file is being loaded
;;   by the profiler.  This might matter if you perform the
;;   bulk of initializations in a different file.
;; - Starting external shells like IELM or eshell in your init file
;;   might mess with overlay creation, so this must not be done.

;;; Download:

;;  You can always get the latest version from
;;       http://randomsample.de/profile-dotemacs.el

;;; Code:

(require 'thingatpt)
(require 'benchmark)

;; User variables

(defvar profile-dotemacs-file "~/.emacs"
  "File to be profiled.")

(defvar profile-dotemacs-low-percentage 3
  "Percentage which should be considered low.
All sexp's with a running time below this percentage will be
grayed out.")

(defface profile-dotemacs-time-face
  '((((background dark)) (:background "OrangeRed1"))
    (t (:background "red3")))
  "Background color to indicate percentage of total time.")

(defface profile-dotemacs-low-percentage-face
  '((((background dark)) (:foreground "gray25"))
    (t (:foreground "gray75")))
  "Face for sexps below `profile-dotemacs-low-percentage'.")

(defface profile-dotemacs-highlight-face
  '((((background dark)) (:background "blue"))
    (t (:background "yellow")))
  "Highlight face for benchmark results.")

;; Main function

(defun profile-dotemacs ()
  "Load `profile-dotemacs-file' and benchmark its sexps."
  (interactive)
  (with-current-buffer (find-file-noselect profile-dotemacs-file t)
    (setq buffer-read-only t) ;; just to be sure
    (goto-char (point-min))
    (let (start end results)
      (while
	  (< (point)
	     (setq end (progn
			 (forward-sexp 1)
			 (point))))
	(forward-sexp -1)
	(setq start (point))
	(add-to-list
	 'results
	 `(,start ,end
		  ,(benchmark-run
		    (eval (sexp-at-point)))))
	(goto-char end))
      (profile-dotemacs-show-results results)
      (switch-to-buffer (current-buffer)))))

;; Helper functions

(defun profile-dotemacs-show-results (results)
  "Show timings from RESULTS in current buffer."
  (let ((totaltime (profile-dotemacs-totaltime results))
	current percentage ov)
    (while results
      (let* ((current (pop results))
	     (ov (make-overlay (car current) (cadr current)))
	     (current (car (last current)))
	     (percentage (/ (+ (car current) (nth 2 current))
			    totaltime))
	     col benchstr lowface)
	(setq col
	      (profile-dotemacs-percentage-color
	       percentage
	       (face-background 'default)
	       (face-background 'profile-dotemacs-time-face)))
	(setq percentage (round (* 100 percentage)))
	(setq benchstr (profile-dotemacs-make-benchstr current))
	(overlay-put ov 'help-echo benchstr)
	(if (and (numberp profile-dotemacs-low-percentage)
		 (< percentage profile-dotemacs-low-percentage))
	    (overlay-put ov 'face 'profile-dotemacs-low-percentage-face)
	  (overlay-put ov 'before-string
		       (propertize benchstr
				   'face 'profile-dotemacs-highlight-face))
	  (overlay-put ov 'face
		       `(:background ,col)))))
    (setq ov (make-overlay (1- (point-max)) (point-max)))
    (overlay-put ov 'after-string
		 (propertize
		  (format "\n-----------------\nTotal time: %.2fs\n"
			  totaltime)
		  'face 'profile-dotemacs-highlight-face))))

(defun profile-dotemacs-totaltime (results)
  "Calculate total time of RESULTS."
  (let ((totaltime 0))
    (mapc (lambda (x)
	    (let ((cur (car (last x))))
	      (setq totaltime (+ totaltime (car cur) (nth 2 cur)))))
	  results)
    totaltime))

(defun profile-dotemacs-percentage-color (percent col-begin col-end)
  "Calculate color according to PERCENT between COL-BEGIN and COL-END."
  (let* ((col1 (color-values col-begin))
	 (col2 (color-values col-end))
	 (col
	  (mapcar (lambda (c)
		    (round
		     (+ (* (- 1 percent) (nth c col1))
			(* percent (nth c col2)))))
		  '(0 1 2))))
    (format "RGB:%04x/%04x/%04x"
	    (car col)
	    (nth 1 col)
	    (nth 2 col))))

(defun profile-dotemacs-make-benchstr (timings)
  "Create descriptive benchmark string from TIMINGS."
  (format
   (concat
    "<Percentage: %d ; "
    "Time: %.2f ; "
    "Number of GC: %d ; "
    "Time for GC: %.2f>\n")
   percentage
   (car timings) (nth 1 timings) (nth 2 timings)))


;; profile-dotemacs.el ends here

M home/misterio/features/trusted/neomutt.nix => home/misterio/features/trusted/neomutt.nix +0 -6
@@ 1,10 1,4 @@
{ config, pkgs, ... }: {
  home = {
    preferredApps.mail = {
      cmd = config.home.preferredApps.terminal.cmd-spawn "neomutt";
    };
  };

  xdg = {
    desktopEntries = {
      neomutt = {

M home/misterio/global/default.nix => home/misterio/global/default.nix +2 -0
@@ 8,6 8,8 @@ in
    inputs.impermanence.nixosModules.home-manager.impermanence
    inputs.nix-colors.homeManagerModule
    ../features/cli
    ../features/nvim
    ../features/emacs
  ] ++ (builtins.attrValues outputs.homeManagerModules);

  colorscheme = lib.mkDefault colorSchemes.dracula;

M home/misterio/pleione.nix => home/misterio/pleione.nix +0 -1
@@ 1,7 1,6 @@
{ inputs, pkgs, ... }: {
  imports = [
    ./global
    ./features/cli
    ./features/desktop/hyprland
    ./features/desktop/wireless
    ./features/trusted

M hosts/common/global/nix.nix => hosts/common/global/nix.nix +2 -0
@@ 5,10 5,12 @@
      substituters = [
        "https://cache.m7.rs"
        "https://hyprland.cachix.org"
        "https://nix-community.cachix.org"
      ];
      trusted-public-keys = [
        "cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg="
        "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
      trusted-users = [ "root" "@wheel" ];
      auto-optimise-store = lib.mkDefault true;

M modules/home-manager/default.nix => modules/home-manager/default.nix +0 -1
@@ 4,7 4,6 @@
  fonts = import ./fonts.nix;
  monitors = import ./monitors.nix;
  neovim = import ./neovim.nix;
  preferred-apps = import ./preferred-apps.nix;
  rgbdaemon = import ./rgbdaemon.nix;
  shellcolor = import ./shellcolor.nix;
  swaylock = import ./swaylock.nix;

D modules/home-manager/preferred-apps.nix => modules/home-manager/preferred-apps.nix +0 -10
@@ 1,10 0,0 @@
{ lib, ... }:
let inherit (lib) types mkOption;
in
{
  options.home.preferredApps = mkOption {
    type = types.attrsOf (types.attrsOf (types.either types.str (types.functionTo types.str)));
    default = { };
  };
}