summaryrefslogtreecommitdiff
path: root/user-profiles/core.nix
blob: 8b8da681cdb2cb6430d4c74574c8026b1da51d98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ flake, flakeInputs, sources, path, userName, hostName, config, lib, utils, ... }:

with lib;

{
  config = {
    users.users.${userName} = { # Make sure the user is created
      openssh.authorizedPrincipals = [
        "${userName}@${hostName}"
        "${userName}@*"
      ];
    };
    home-manager.users.${userName} = let sysConfig = config; in { config, ... }: {
      config._module.args = {
        inherit sysConfig flake flakeInputs sources;
      };
      config.nix.settings = {
        inherit (sysConfig.nix.settings) use-xdg-base-directories;
      };
    };

    systemd.services."home-manager-${utils.escapeSystemdPath userName}" = lib.mkIf (!config.home-manager.enableSystemd) {
      restartIfChanged = false; # only run once on startup, deploy to running system with deploy-rs
    };
  };
}