From 5fcd164ef37e2243d8ce899fe33e75b5ec45394d Mon Sep 17 00:00:00 2001 From: Xe Date: Tue, 24 Jan 2023 22:00:24 -0500 Subject: [PATCH] fix spacemacs Signed-off-by: Xe --- common/users/cadey/spacemacs/default.nix | 82 +++++++++++++----------- hardware/alrest/default.nix | 4 ++ hosts/itsuki/default.nix | 4 ++ 3 files changed, 53 insertions(+), 37 deletions(-) diff --git a/common/users/cadey/spacemacs/default.nix b/common/users/cadey/spacemacs/default.nix index 1395ef0..401193a 100644 --- a/common/users/cadey/spacemacs/default.nix +++ b/common/users/cadey/spacemacs/default.nix @@ -1,46 +1,54 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: -let e = pkgs.writeTextFile { - name = "cadey-emacs.desktop"; - destination = "/share/applications/cadey-emacs.desktop"; - text = '' -[Desktop Entry] -Exec=emacsclient -nc -Icon=emacs -Name[en_US]=Emacs Client -Name=Emacs Client -StartupNotify=true -Terminal=false -Type=Application - ''; - }; -in -{ - home.packages = with pkgs; [ anonymousPro e sqlite-interactive graphviz ]; +with lib; - programs.emacs.enable = true; - - home.file.".spacemacs".source = ./spacemacs; - - home.file."bin/e" = { +let + e = pkgs.writeTextFile { + name = "cadey-emacs.desktop"; + destination = "/share/applications/cadey-emacs.desktop"; text = '' - #!/bin/sh - emacsclient -a "" -nc $@ + [Desktop Entry] + Exec=emacsclient -nc + Icon=emacs + Name[en_US]=Emacs Client + Name=Emacs Client + StartupNotify=true + Terminal=false + Type=Application ''; - executable = true; }; - home.activation.spacemacs = '' - mkdir -p ~/.ssh + cfg = config.within.spacemacs; +in { + options.within.spacemacs.enable = mkEnableOption "emacs with spacemacs"; - if ! grep github.com ~/.ssh/known_hosts > /dev/null - then - echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts - fi + config = mkIf cfg.enable { + home.packages = with pkgs; [ anonymousPro e sqlite-interactive graphviz ]; - if [ ! -d "$HOME/.emacs.d" ]; then - GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d - systemctl --user restart emacs - fi - ''; + programs.emacs.enable = true; + + home.file.".spacemacs".source = ./spacemacs; + + home.file."bin/e" = { + text = '' + #!/bin/sh + emacsclient -a "" -nc $@ + ''; + executable = true; + }; + + home.activation.spacemacs = '' + mkdir -p ~/.ssh + + if ! grep github.com ~/.ssh/known_hosts > /dev/null + then + echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts + fi + + if [ ! -d "$HOME/.emacs.d" ]; then + GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d + systemctl --user restart emacs + fi + ''; + }; } diff --git a/hardware/alrest/default.nix b/hardware/alrest/default.nix index 3b69a13..d8181b0 100644 --- a/hardware/alrest/default.nix +++ b/hardware/alrest/default.nix @@ -48,4 +48,8 @@ }; systemd.services.tailscaled.path = with pkgs; [ mosh getent shadow ]; + + home-manager.users.cadey = { ... }: { + within.spacemacs.enable = true; + }; } diff --git a/hosts/itsuki/default.nix b/hosts/itsuki/default.nix index b190100..7ef85da 100644 --- a/hosts/itsuki/default.nix +++ b/hosts/itsuki/default.nix @@ -68,4 +68,8 @@ }; within.users.enableSystem = true; + + home-manager.users.cadey = { ... }: { + within.emacs.enable = true; + }; }