From 4d356b3a067f4824c9f19d090d6cf55f1bd9ce9d Mon Sep 17 00:00:00 2001
From: Andrea Ciceri <andrea.ciceri@beatdata.it>
Date: Wed, 3 Nov 2021 18:29:40 +0100
Subject: [PATCH] Several changes:

- gpg working in darwin
- new git full package
- git settings for darwin (using different account)
- updaded techinque to detect host platform
---
 users/andreaciceri/default.nix   |  7 +++++++
 users/profiles/emacs/default.nix |  2 +-
 users/profiles/git/default.nix   | 22 ++++++++++++++++++----
 users/profiles/zsh/default.nix   |  2 +-
 4 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/users/andreaciceri/default.nix b/users/andreaciceri/default.nix
index 7eb3fd9..e96697c 100644
--- a/users/andreaciceri/default.nix
+++ b/users/andreaciceri/default.nix
@@ -4,12 +4,19 @@
       ../profiles/bat
       ../profiles/fzf
       ../profiles/zsh
+      ../profiles/git
       ../profiles/direnv
       ../profiles/exa
       ../profiles/emacs
     ];
     home.packages = with pkgs; [
       yarn
+      pinentry_mac
     ];
+
+    programs.gpg = {
+      homedir = "/Users/andreaciceri/.gnupg";
+      enable = true;
+    };
   };
 }
diff --git a/users/profiles/emacs/default.nix b/users/profiles/emacs/default.nix
index 0a6b3b5..455d0a7 100644
--- a/users/profiles/emacs/default.nix
+++ b/users/profiles/emacs/default.nix
@@ -13,7 +13,7 @@
 
   # For some reason Hunspell dictionaries paths must be specified on Darwin
   home.sessionVariables =
-    if pkgs.system == "x86_64-darwin" then {
+    if pkgs.stdenv.hostPlatform.isDarwin then {
       DICPATH = "${pkgs.hunspellDicts.it_IT}/share/hunspell:${pkgs.hunspellDicts.en_US}/share/hunspell";
     } else { };
 
diff --git a/users/profiles/git/default.nix b/users/profiles/git/default.nix
index afec170..59b6bb6 100644
--- a/users/profiles/git/default.nix
+++ b/users/profiles/git/default.nix
@@ -1,19 +1,33 @@
+{ pkgs, ... }:
+
+let
+  config =
+    if pkgs.stdenv.hostPlatform.isDarwin then {
+      name = "Andrea Ciceri";
+      email = "andrea.ciceri@beatdata.it";
+    } else {
+      name = "Andrea Ciceri";
+      email = "andrea.ciceri@autistici.org";
+    };
+in
 {
   programs.git = {
     enable = true;
+    package = pkgs.gitAndTools.gitFull;
 
     extraConfig = {
       pull.rebase = false;
     };
 
-    userName = "aciceri";
-    userEmail = "andrea.ciceri@autistici.org";
+    userName = config.name;
+    userEmail = config.email;
     signing = {
       signByDefault = true;
-      key = "andrea.ciceri@autistici.org";
+      key = config.email;
     };
+
     extraConfig = {
-      url = {
+      url = if pkgs.stdenv.hostPlatform.isDarwin then { } else {
         "ssh://git@github.com/" = { insteadOf = https://github.com/; };
       };
     };
diff --git a/users/profiles/zsh/default.nix b/users/profiles/zsh/default.nix
index 2b38e29..f541ff4 100644
--- a/users/profiles/zsh/default.nix
+++ b/users/profiles/zsh/default.nix
@@ -55,7 +55,7 @@
     };
     loginExtra = "[[ -z $DISPLAY && $TTY = /dev/tty1 ]] && exec sway";
     initExtra =
-      if pkgs.system == "x86_64-darwin"
+      if pkgs.stdenv.hostPlatform.isDarwin
       then "if test -e /etc/static/bashrc; then source /etc/static/bashrc > /dev/null 2>&1; fi"
       else "";
   };