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 ];
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

View file

@ -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;
};
}

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 =
let
package = pkgs.git.override {