diff options
Diffstat (limited to 'users/profiles/work.nix')
| -rw-r--r-- | users/profiles/work.nix | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/users/profiles/work.nix b/users/profiles/work.nix index 33a1e3e..feb5a46 100644 --- a/users/profiles/work.nix +++ b/users/profiles/work.nix @@ -1,4 +1,9 @@ -{ pkgs, ... }: +{ + lib, + self, + pkgs, + ... +}: let nomad-prod = pkgs.writeShellScriptBin "nomad-prod" '' set -e @@ -23,7 +28,7 @@ let in { imports = [ - ./gh.nix + "${self}/users/programs/gh.nix" ./k8s.nix ]; @@ -95,6 +100,51 @@ in envAliases // additionalAliases; }; + programs.ssh.matchBlocks = { + "github.rbx.com" = { + hostname = "github.rbx.com"; + user = "git"; + forwardAgent = false; + extraOptions = { + preferredAuthentications = "publickey"; + controlMaster = "no"; + controlPath = "none"; + }; + }; + }; + # the configuration for sapi is generated when we run `sapi jump`, there's no need to manage it with nix. programs.ssh.includes = [ "config_sapi" ]; + + programs.git = { + extraConfig = { + url = { + "ssh://git@github.rbx.com/" = { + insteadOf = "https://github.rbx.com/"; + }; + }; + }; + # https://stackoverflow.com/questions/74012449/git-includeif-hasconfigremote-url-not-working + # to test it's working as expected: + # run `git config --get-all user.email' in a repository to check that we get all the possible emails + # run `git config --get user.email' in a repository to check which email is selected + includes = [ + { + condition = "hasconfig:remote.*.url:git@github.rbx.com:*/**"; + path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; }); + } + { + condition = "hasconfig:remote.*.url:git@github.com:Roblox/**"; + path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; }); + } + { + condition = "hasconfig:remote.*.url:https://github.com/Roblox/**"; + path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; }); + } + { + condition = "hasconfig:remote.*.url:https://github.rbx.com/*/**"; + path = pkgs.writeText "username.cfg" (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; }); + } + ]; + }; } |
