Skip to content

Commit

Permalink
nixos: use enable for ssh_config units
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqui23 committed Dec 25, 2021
1 parent 8615a85 commit c92001a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,27 @@ in {
++ lib.optional cfg.useUserPackages "/etc/profile.d";

systemd.services = mapAttrs' (_: usercfg:
let username = usercfg.home.username;
in nameValuePair "ssh_config-${utils.escapeSystemdPath username}" (lib.mkIf usercfg.programs.ssh.enable {
let inherit (usercfg.home) username homeDirectory;
in nameValuePair "ssh_config-${utils.escapeSystemdPath username}" {
inherit (usercfg.programs.ssh) enable;
description = "Linking ${username}' ssh conifg";
wantedBy = [ "multi-user.target" ];
before = [ "systemd-user-sessions.service" ];

unitConfig = { RequiresMountsFor = usercfg.home.homeDirectory; };
unitConfig.RequiresMountsFor = homeDirectory;

stopIfChanged = false;

serviceConfig = {
User = usercfg.home.username;
User = username;
Type = "oneshot";
RemainAfterExit = "yes";
TimeoutStartSec = 90;
SyslogIdentifier = "hm-activate-${username}";

ExecStart = ["${pkgs.coreutils}/bin/ln -s ${usercfg.programs.ssh.configPath} ${usercfg.home.homeDirectory}/.ssh/config"];
ExecStart = ["${pkgs.coreutils}/bin/ln -s ${usercfg.programs.ssh.configPath} ${homeDirectory}/.ssh/config"];
};
})) cfg.users;
}) cfg.users;

};
}

0 comments on commit c92001a

Please sign in to comment.