mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
nix-darwin: add system module for nix-darwin
This commit is contained in:
parent
f247b3b99b
commit
a9a4fb641f
2 changed files with 52 additions and 0 deletions
|
@ -830,6 +830,17 @@ in
|
|||
A new module is available: 'programs.afew'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-19T00:40:34+00:00";
|
||||
message = ''
|
||||
A new nix-darwin module is available. Use it the same way the NixOS
|
||||
module is used. A major limitation is that Home Manager services don't
|
||||
work, as they depend explicitly on Linux and systemd user services.
|
||||
However, 'home.file' and 'home.packages' do work. Everything else is
|
||||
untested at this time.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
41
nix-darwin/default.nix
Normal file
41
nix-darwin/default.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.home-manager;
|
||||
|
||||
hmModule = types.submodule ({name, ...}: {
|
||||
imports = import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
nixosSubmodule = true;
|
||||
};
|
||||
|
||||
config = {
|
||||
home.username = config.users.users.${name}.name;
|
||||
home.homeDirectory = config.users.users.${name}.home;
|
||||
};
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
home-manager.users = mkOption {
|
||||
type = types.attrsOf hmModule;
|
||||
default = {};
|
||||
description = ''
|
||||
Per-user Home Manager configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.users != {}) {
|
||||
system.activationScripts.extraActivation.text =
|
||||
lib.concatStringsSep "\n" (lib.mapAttrsToList (username: usercfg: ''
|
||||
echo Activating home-manager configuration for ${username}
|
||||
sudo -u ${username} ${usercfg.home.activationPackage}/activate
|
||||
'') cfg.users);
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue