mirror of
https://github.com/nix-community/flakelight.git
synced 2024-11-22 23:43:11 +01:00
35 lines
965 B
Nix
35 lines
965 B
Nix
# flakelight -- Framework for simplifying flake setup
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
{ config, lib, ... }:
|
|
let
|
|
inherit (builtins) isAttrs;
|
|
inherit (lib) foldl mapAttrsToList mergeOneOption mkOption mkOptionType mkIf
|
|
recursiveUpdate;
|
|
inherit (lib.types) lazyAttrsOf;
|
|
|
|
homeConfiguration = mkOptionType {
|
|
name = "homeConfiguration";
|
|
description = "homeConfiguration";
|
|
descriptionClass = "noun";
|
|
check = x: isAttrs x && x ? activationPackage;
|
|
merge = mergeOneOption;
|
|
};
|
|
in
|
|
{
|
|
options.homeConfigurations = mkOption {
|
|
type = lazyAttrsOf homeConfiguration;
|
|
default = { };
|
|
};
|
|
|
|
config.outputs = mkIf (config.homeConfigurations != { }) {
|
|
inherit (config) homeConfigurations;
|
|
checks = foldl recursiveUpdate { } (mapAttrsToList
|
|
(n: v: {
|
|
${v.config.nixpkgs.system}."home-${n}" = v.activationPackage;
|
|
})
|
|
config.homeConfigurations);
|
|
};
|
|
}
|