summaryrefslogtreecommitdiff
path: root/modules/home-manager
diff options
context:
space:
mode:
authorqaristote <quentin.aristote@ens.fr>2023-03-14 12:23:56 +0100
committerqaristote <quentin.aristote@ens.fr>2023-03-14 12:23:56 +0100
commit946323f0cad17e511ab0cf5052506e4f565edfe0 (patch)
treec81cfd6ab22dbd503001dfbaa6b34fad85eb0da9 /modules/home-manager
parent2dad7cf1a9e79fee2d391ee771b85b677bba8676 (diff)
home & nixos: git: add config for system flake directory
Diffstat (limited to 'modules/home-manager')
-rw-r--r--modules/home-manager/personal/programs/git.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/home-manager/personal/programs/git.nix b/modules/home-manager/personal/programs/git.nix
index 85ce0e4..a34b1b3 100644
--- a/modules/home-manager/personal/programs/git.nix
+++ b/modules/home-manager/personal/programs/git.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, ... }@extraArgs:
let
primaryEmail = let
@@ -28,5 +28,14 @@ in {
result
''
];
+
+ extraConfig = {
+ safe.directory = lib.mkIf (extraArgs ? osConfig) (
+ let
+ flake = extraArgs.osConfig.system.autoUpgrade.flake;
+ flakeIsValid = flake != null && lib.hasPrefix "git+file://" flake;
+ flakePath = lib.removePrefix "git+file://" flake;
+ in lib.optional flakeIsValid flakePath);
+ };
};
}