From c77fde79064a521c97633e87a037df78bc1208e4 Mon Sep 17 00:00:00 2001 From: cspark Date: Fri, 15 Mar 2024 14:37:26 +0000 Subject: [PATCH] Emacs configuration also for root user, add aliases for nix desktop functions --- configurations/desktop/home.nix | 7 +++++++ global-home.nix | 6 +++++- global.nix | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/configurations/desktop/home.nix b/configurations/desktop/home.nix index f17e314b..6147a5c0 100644 --- a/configurations/desktop/home.nix +++ b/configurations/desktop/home.nix @@ -78,4 +78,11 @@ }; }; + programs.bash.shellAliases = { + sudo = "sudo "; + doas = "doas "; + edit = "$EDITOR"; + nixos-rebuild-system-flake = "sudo nixos-rebuild switch --flake /etc/nixos#desktop"; + }; + } diff --git a/global-home.nix b/global-home.nix index 7fdb3e48..a3700ad7 100644 --- a/global-home.nix +++ b/global-home.nix @@ -115,7 +115,11 @@ in systemd.user.services.emacs-config-initialiser = let script = pkgs.writeShellScript "emacs-config-initialiser-script" '' - [[ ! -d %/.emacs.d ]] && git clone https://git.cspark.dev/cspark/Emacs-Configuration $HOME/.emacs.d + if [[ ! -d $HOME/.emacs.d ]]; then + git clone https://git.cspark.dev/cspark/Emacs-Configuration $HOME/.emacs.d + else + exit 0 + fi ''; in { diff --git a/global.nix b/global.nix index b5749443..55b3a899 100644 --- a/global.nix +++ b/global.nix @@ -62,6 +62,25 @@ VST3_PATH = makePluginPath "vst3"; }; + # Emacs Config Init Service - For root user also + systemd.services.emacs-config-initialiser = { + description = "Initialises default emacs configuration if not available"; + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.coreutils pkgs.git ]; + enable = true; + serviceConfig = { + User = "root"; + Group = "root"; + }; + script = " + if [[ ! -d $HOME/.emacs.d ]]; then + git clone https://git.cspark.dev/cspark/Emacs-Configuration $HOME/.emacs.d + else + exit 0 + fi + "; + }; + # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true;