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.
This commit is contained in:
Evie Litherland-Smith 2024-10-05 12:38:24 +01:00
parent 4f226084d0
commit 9d401ace7f
4 changed files with 79 additions and 75 deletions

View file

@ -1,61 +1,85 @@
{ config, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ ../shell/default.nix ]; imports = [ ../shell/default.nix ];
stylix.targets.emacs.enable = false; stylix.targets.emacs.enable = false;
services.emacs = { services = {
enable = true; gpg-agent = {
package = config.programs.emacs.finalPackage; enable = true;
defaultEditor = true; pinentryPackage = lib.mkDefault pkgs.pinentry-all;
client.enable = true; };
socketActivation.enable = true; git-sync.repositories = {
startWithUserSession = false; 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 = { programs = {
# Clone emacs config from https://git.xenia.me.uk/pixelifytica/emacs.git gpg.enable = true;
enable = true; emacs = {
package = pkgs.emacs29-pgtk; # Clone emacs config from https://git.xenia.me.uk/pixelifytica/emacs.git
extraConfig = enable = true;
let package = pkgs.emacs29-pgtk;
fixed-font-family = "${config.stylix.fonts.monospace.name}"; extraConfig =
variable-font-family = "${config.stylix.fonts.sansSerif.name}"; let
font-height = builtins.toString ( fixed-font-family = "${config.stylix.fonts.monospace.name}";
builtins.floor (builtins.mul config.stylix.fonts.sizes.applications 10) variable-font-family = "${config.stylix.fonts.sansSerif.name}";
); font-height = builtins.toString (
custom-theme-name = "nix"; builtins.floor (builtins.mul config.stylix.fonts.sizes.applications 10)
custom-theme = pkgs.writeTextFile { );
name = "custom-emacs-theme"; custom-theme-name = "nix";
destination = "/${custom-theme-name}-theme.el"; custom-theme = pkgs.writeTextFile {
text = '' name = "custom-emacs-theme";
(deftheme ${custom-theme-name} destination = "/${custom-theme-name}-theme.el";
"Use Nix customised fonts for main faces") text = ''
(deftheme ${custom-theme-name}
"Use Nix customised fonts for main faces")
(custom-theme-set-variables (custom-theme-set-variables
'${custom-theme-name} '${custom-theme-name}
'(menu-bar-mode nil)) '(menu-bar-mode nil))
(custom-theme-set-faces (custom-theme-set-faces
'${custom-theme-name} '${custom-theme-name}
'(default ((t (:family "${fixed-font-family}" :height ${font-height})))) '(default ((t (:family "${fixed-font-family}" :height ${font-height}))))
'(fixed-pitch ((t (:family "${fixed-font-family}")))) '(fixed-pitch ((t (:family "${fixed-font-family}"))))
'(fixed-pitch-serif ((t (:family "${fixed-font-family}")))) '(fixed-pitch-serif ((t (:family "${fixed-font-family}"))))
'(variable-pitch ((t (:family "${variable-font-family}"))))) '(variable-pitch ((t (:family "${variable-font-family}")))))
(provide-theme '${custom-theme-name}) (provide-theme '${custom-theme-name})
''; '';
}; };
custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el"; custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el";
in in
'' ''
(add-to-list 'custom-theme-load-path "${custom-theme}") (add-to-list 'custom-theme-load-path "${custom-theme}")
(add-to-list 'custom-safe-themes "${custom-theme-hash}") (add-to-list 'custom-safe-themes "${custom-theme-hash}")
(load-theme '${custom-theme-name}) (load-theme '${custom-theme-name})
''; '';
extraPackages = extraPackages =
epkgs: with epkgs; [ epkgs: with epkgs; [
treesit-grammars.with-all-grammars treesit-grammars.with-all-grammars
mu4e mu4e
emacsql-sqlite emacsql-sqlite
]; ];
};
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
# Emacs requirements # Emacs requirements

View file

@ -5,7 +5,6 @@
... ...
}: }:
{ {
xdg.configFile."pass-git-helper/git-pass-mapping.ini".source = ./git-pass-mapping.ini;
programs = { programs = {
gpg.enable = true; gpg.enable = true;
password-store = { password-store = {
@ -22,21 +21,8 @@
}; };
}; };
}; };
services = { services.gpg-agent = {
gpg-agent = enable = true;
let pinentryPackage = lib.mkDefault pkgs.pinentry-all;
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";
};
}; };
} }

View file

@ -1,6 +0,0 @@
[DEFAULT]
username_extractor=regex_search
regex_username=^login: (.*)$
[*]
target=git/${host}

View file

@ -5,7 +5,7 @@
... ...
}: }:
{ {
services.git-sync.enable = false; # Can't find pass for some reason... services.git-sync.enable = true;
programs.git = programs.git =
let let
package = pkgs.git.override { package = pkgs.git.override {