added ssh config for local git pushes

This commit is contained in:
Leyla Becker 2025-03-14 20:21:18 -05:00
parent 44d6b4827d
commit da78b208cd
4 changed files with 42 additions and 5 deletions

View file

@ -1,10 +1,12 @@
{ {
lib, lib,
config, config,
osConfig,
... ...
}: let }: let
users = config.host.users; users = config.host.users;
in { in {
leyla = lib.mkIf users.leyla.isNormalUser (import ./leyla); leyla = lib.mkIf users.leyla.isNormalUser (import ./leyla);
eve = lib.mkIf users.eve.isNormalUser (import ./eve); eve = lib.mkIf users.eve.isNormalUser (import ./eve);
git = lib.mkIf (osConfig.services.forgejo.enable or false) (import ./git);
} }

View file

@ -0,0 +1,20 @@
{osConfig, ...}: {
home = {
username = osConfig.users.users.git.name;
homeDirectory = osConfig.users.users.git.home;
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
stateVersion = "23.11"; # Please read the comment before changing.
};
programs.ssh.extraConfig = ''
AuthorizedKeysFile
/var/lib/forgejo/.ssh/authorized_keys
'';
}

View file

@ -114,7 +114,12 @@
nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: ( nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: (
nixpkgs.lib.attrsets.mapAttrs' (user: _: { nixpkgs.lib.attrsets.mapAttrs' (user: _: {
name = "${user}@${hostname}"; name = "${user}@${hostname}";
value = mkHome user hostname system.pkgs.hostPlatform.system system.config; value = mkHome {
user = user;
host = hostname;
system = system.pkgs.hostPlatform.system;
osConfig = system.config;
};
}) })
system.config.home-manager.users system.config.home-manager.users
)) ))

View file

@ -36,8 +36,13 @@
home-manager-config = nixpkgs: { home-manager-config = nixpkgs: {
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup"; home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = {inherit inputs outputs util;}; home-manager.extraSpecialArgs = {
home-manager.users = import ../configurations/home-manager nixpkgs; inherit inputs outputs util;
};
home-manager.users = import ../configurations/home-manager (nixpkgs
// {
osConfig = nixpkgs.config;
});
home-manager.sharedModules = home-manager-modules; home-manager.sharedModules = home-manager-modules;
}; };
@ -61,7 +66,7 @@ in {
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
modules = [ modules = [
{ {
# TODO: authorized keys for all users # TODO: authorized keys for all users and hosts
} }
../configurations/nixos/${host} ../configurations/nixos/${host}
]; ];
@ -97,7 +102,12 @@ in {
]; ];
}; };
mkHome = user: host: system: osConfig: mkHome = {
user,
host,
system,
osConfig,
}:
home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor system; pkgs = pkgsFor system;
extraSpecialArgs = { extraSpecialArgs = {