about summary refs log tree commit diff stats
path: root/modules/by-name/ho/home-manager/module.nix
blob: d7eccbd69f8fefcac20b41a56c7f1d501500c6ac (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
  config,
  lib,
  system,
  modules,
  ...
}: let
  cfg = config.soispha.home-manager;
in {
  options.soispha.home-manager = {
    enable = lib.mkEnableOption "home-manager with custom config.";
  };

  imports = [
    modules.home-manager.nixosModules.home-manager
  ];

  # TODO: Find a way to throw this error below, when a user `enable`s a home-manager
  # module, but not this module. Without having to plaster all the `home-manager` modules
  # with `assert`s. <2024-10-18>
  # builtins.throw "If you want use a home-manager module, you must also enable `soispha.home-manager.enable`.");
  config = lib.mkIf cfg.enable {
    home-manager = {
      useGlobalPkgs = true;
      useUserPackages = true;

      # TODO(@bpeetz): Remove this once the legacy -> by-name migration is done. <2025-05-16>
      users.soispha = import ../../../home.legacy;
      extraSpecialArgs = {
        inherit
          system
          ;
      };
    };
  };
}