mirror of
https://github.com/nix-community/flakelight.git
synced 2024-11-22 15:33:10 +01:00
0760edb005
The set of args passed to modules is useful for more than just autoloading. This renames it appropriately and makes it available through pkgs arguments as well.
38 lines
1.1 KiB
Nix
38 lines
1.1 KiB
Nix
# flakelight -- Framework for simplifying flake setup
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
{ config, lib, flakelight, moduleArgs, ... }:
|
|
let
|
|
inherit (builtins) isAttrs mapAttrs;
|
|
inherit (lib) foldl mapAttrsToList mergeOneOption mkOption mkOptionType mkIf
|
|
recursiveUpdate;
|
|
inherit (lib.types) lazyAttrsOf;
|
|
inherit (flakelight.types) optFunctionTo;
|
|
|
|
homeConfiguration = mkOptionType {
|
|
name = "homeConfiguration";
|
|
description = "homeConfiguration";
|
|
descriptionClass = "noun";
|
|
check = x: isAttrs x && x ? activationPackage;
|
|
merge = mergeOneOption;
|
|
};
|
|
|
|
configs = mapAttrs (_: f: f moduleArgs) config.homeConfigurations;
|
|
in
|
|
{
|
|
options.homeConfigurations = mkOption {
|
|
type = lazyAttrsOf (optFunctionTo homeConfiguration);
|
|
default = { };
|
|
};
|
|
|
|
config.outputs = mkIf (config.homeConfigurations != { }) {
|
|
homeConfigurations = configs;
|
|
checks = foldl recursiveUpdate { } (mapAttrsToList
|
|
(n: v: {
|
|
${v.config.nixpkgs.system}."home-${n}" = v.activationPackage;
|
|
})
|
|
configs);
|
|
};
|
|
}
|