From 9d401ace7f95a7a9e4d3b84dd59ac71bcb9e1f31 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sat, 5 Oct 2024 12:38:24 +0100 Subject: [PATCH] Re-enable git-sync service to sync org and library directories git-sync service works now that I'm using libsecret for git auth. Remove password-store from service, manage manually. Considering switch to proton pass anyway. Copy gpg and gpg-agent config to emacs/default.nix in case I switch away from password-store. --- system/home/emacs/default.nix | 126 +++++++++++------- .../home/services/password-store/default.nix | 20 +-- .../password-store/git-pass-mapping.ini | 6 - system/home/shell/git.nix | 2 +- 4 files changed, 79 insertions(+), 75 deletions(-) delete mode 100644 system/home/services/password-store/git-pass-mapping.ini diff --git a/system/home/emacs/default.nix b/system/home/emacs/default.nix index 3e8a2e0b..c9e2c689 100644 --- a/system/home/emacs/default.nix +++ b/system/home/emacs/default.nix @@ -1,61 +1,85 @@ -{ config, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../shell/default.nix ]; stylix.targets.emacs.enable = false; - services.emacs = { - enable = true; - package = config.programs.emacs.finalPackage; - defaultEditor = true; - client.enable = true; - socketActivation.enable = true; - startWithUserSession = false; + services = { + gpg-agent = { + enable = true; + pinentryPackage = lib.mkDefault pkgs.pinentry-all; + }; + git-sync.repositories = { + org = { + path = "${config.xdg.userDirs.documents}/org"; + uri = "git+https://git.xenia.me.uk/pixelifytica/org.git"; + }; + library = { + path = "${config.xdg.userDirs.documents}/org"; + uri = "git+https://git.xenia.me.uk/pixelifytica/library.git"; + }; + }; + emacs = { + enable = true; + package = config.programs.emacs.finalPackage; + defaultEditor = true; + client.enable = true; + socketActivation.enable = true; + startWithUserSession = false; + }; }; - programs.emacs = { - # Clone emacs config from https://git.xenia.me.uk/pixelifytica/emacs.git - enable = true; - package = pkgs.emacs29-pgtk; - extraConfig = - let - fixed-font-family = "${config.stylix.fonts.monospace.name}"; - variable-font-family = "${config.stylix.fonts.sansSerif.name}"; - font-height = builtins.toString ( - builtins.floor (builtins.mul config.stylix.fonts.sizes.applications 10) - ); - custom-theme-name = "nix"; - custom-theme = pkgs.writeTextFile { - name = "custom-emacs-theme"; - destination = "/${custom-theme-name}-theme.el"; - text = '' - (deftheme ${custom-theme-name} - "Use Nix customised fonts for main faces") + programs = { + gpg.enable = true; + emacs = { + # Clone emacs config from https://git.xenia.me.uk/pixelifytica/emacs.git + enable = true; + package = pkgs.emacs29-pgtk; + extraConfig = + let + fixed-font-family = "${config.stylix.fonts.monospace.name}"; + variable-font-family = "${config.stylix.fonts.sansSerif.name}"; + font-height = builtins.toString ( + builtins.floor (builtins.mul config.stylix.fonts.sizes.applications 10) + ); + custom-theme-name = "nix"; + custom-theme = pkgs.writeTextFile { + name = "custom-emacs-theme"; + destination = "/${custom-theme-name}-theme.el"; + text = '' + (deftheme ${custom-theme-name} + "Use Nix customised fonts for main faces") - (custom-theme-set-variables - '${custom-theme-name} - '(menu-bar-mode nil)) + (custom-theme-set-variables + '${custom-theme-name} + '(menu-bar-mode nil)) - (custom-theme-set-faces - '${custom-theme-name} - '(default ((t (:family "${fixed-font-family}" :height ${font-height})))) - '(fixed-pitch ((t (:family "${fixed-font-family}")))) - '(fixed-pitch-serif ((t (:family "${fixed-font-family}")))) - '(variable-pitch ((t (:family "${variable-font-family}"))))) + (custom-theme-set-faces + '${custom-theme-name} + '(default ((t (:family "${fixed-font-family}" :height ${font-height})))) + '(fixed-pitch ((t (:family "${fixed-font-family}")))) + '(fixed-pitch-serif ((t (:family "${fixed-font-family}")))) + '(variable-pitch ((t (:family "${variable-font-family}"))))) - (provide-theme '${custom-theme-name}) - ''; - }; - custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el"; - in - '' - (add-to-list 'custom-theme-load-path "${custom-theme}") - (add-to-list 'custom-safe-themes "${custom-theme-hash}") - (load-theme '${custom-theme-name}) - ''; - extraPackages = - epkgs: with epkgs; [ - treesit-grammars.with-all-grammars - mu4e - emacsql-sqlite - ]; + (provide-theme '${custom-theme-name}) + ''; + }; + custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el"; + in + '' + (add-to-list 'custom-theme-load-path "${custom-theme}") + (add-to-list 'custom-safe-themes "${custom-theme-hash}") + (load-theme '${custom-theme-name}) + ''; + extraPackages = + epkgs: with epkgs; [ + treesit-grammars.with-all-grammars + mu4e + emacsql-sqlite + ]; + }; }; home.packages = with pkgs; [ # Emacs requirements diff --git a/system/home/services/password-store/default.nix b/system/home/services/password-store/default.nix index 653bf831..d2d7cbdb 100644 --- a/system/home/services/password-store/default.nix +++ b/system/home/services/password-store/default.nix @@ -5,7 +5,6 @@ ... }: { - xdg.configFile."pass-git-helper/git-pass-mapping.ini".source = ./git-pass-mapping.ini; programs = { gpg.enable = true; password-store = { @@ -22,21 +21,8 @@ }; }; }; - services = { - gpg-agent = - let - ttl = 86400; - in - { - enable = true; - maxCacheTtl = ttl; - defaultCacheTtl = ttl; - defaultCacheTtlSsh = ttl; - pinentryPackage = lib.mkDefault pkgs.pinentry-all; - }; - git-sync.repositories.password-store = { - path = "${config.home.homeDirectory}/.password-store"; - uri = "git+https://git.xenia.me.uk/xenia/pass.git"; - }; + services.gpg-agent = { + enable = true; + pinentryPackage = lib.mkDefault pkgs.pinentry-all; }; } diff --git a/system/home/services/password-store/git-pass-mapping.ini b/system/home/services/password-store/git-pass-mapping.ini deleted file mode 100644 index 23e62394..00000000 --- a/system/home/services/password-store/git-pass-mapping.ini +++ /dev/null @@ -1,6 +0,0 @@ -[DEFAULT] -username_extractor=regex_search -regex_username=^login: (.*)$ - -[*] -target=git/${host} \ No newline at end of file diff --git a/system/home/shell/git.nix b/system/home/shell/git.nix index 32c1d426..a9897081 100644 --- a/system/home/shell/git.nix +++ b/system/home/shell/git.nix @@ -5,7 +5,7 @@ ... }: { - services.git-sync.enable = false; # Can't find pass for some reason... + services.git-sync.enable = true; programs.git = let package = pkgs.git.override {