mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
Add modules
This commit is contained in:
parent
5cc656fffc
commit
f40362898a
19 changed files with 1045 additions and 0 deletions
59
modules/home-manager.nix
Normal file
59
modules/home-manager.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home-manager;
|
||||
|
||||
hmModule = types.submodule ({ name, ... }: {
|
||||
imports = import <home-manager/modules/modules.nix> { inherit lib pkgs; };
|
||||
|
||||
config = {
|
||||
submoduleSupport.enable = true;
|
||||
submoduleSupport.externalPackageInstall = cfg.useUserPackages;
|
||||
|
||||
home.username = config.user.userName;
|
||||
home.homeDirectory = config.user.home;
|
||||
};
|
||||
});
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
home-manager = {
|
||||
config = mkOption {
|
||||
type = types.nullOr hmModule;
|
||||
default = null;
|
||||
description = "Home Manager configuration.";
|
||||
};
|
||||
|
||||
useUserPackages = mkEnableOption ''
|
||||
installation of user packages through the
|
||||
<option>environment.packages</option> option.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf (cfg.config != null) {
|
||||
|
||||
inherit (config) assertions warnings;
|
||||
|
||||
build.activation.homeManager = ''
|
||||
${cfg.config.home.activationPackage}/activate
|
||||
'';
|
||||
|
||||
environment.packages = mkIf cfg.useUserPackages cfg.config.home.packages;
|
||||
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue