From 9e3ab4d17e1081f61ba4633f21a0f6b97d13f17f Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sat, 28 Mar 2026 20:03:07 +0000 Subject: [PATCH] Make git config nix-darwin-aware --- modules/futureware.nix | 43 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/modules/futureware.nix b/modules/futureware.nix index 551532c..dea3136 100644 --- a/modules/futureware.nix +++ b/modules/futureware.nix @@ -1,23 +1,38 @@ # This module is supposed to be used on internal FutureWare servers. -{ - programs.git.enable = true; - programs.git.config = { +{ lib, options, ... }: + +let + gitConfig = { url."https://git.sheremet.ch/futureware-tech/nix.git".insteadOf = "https://github.com/futureware-tech/nix.git"; url."https://git.sheremet.ch/artem/dotfiles.git".insteadOf = "https://github.com/dotdoom/dotfiles.git"; url."https://git.sheremet.ch/home/esphome.git".insteadOf = "https://github.com/dotdoom/esphome.git"; }; + hasGitOption = options ? programs.git; +in +lib.mkMerge [ + { + nix.settings = { + substituters = [ + "http://nix-cache.home.arpa" + # nix-community cachix server + # TODO: this, but through our cache -- "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + # "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + } - nix.settings = { - substituters = [ - "http://nix-cache.home.arpa" - # nix-community cachix server - # TODO: this, but through our cache -- "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - # "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; -} + (lib.mkIf hasGitOption { + programs.git.enable = true; + programs.git.config = gitConfig; + }) + + (lib.mkIf (!hasGitOption) { + # nix-darwin + environment.etc."gitconfig".text = lib.generators.toGitINI gitConfig; + }) +]