Add lib option

This commit is contained in:
Archit Gupta 2023-09-13 22:54:25 -07:00
parent 53f35dc91c
commit 712a66158c
2 changed files with 20 additions and 1 deletions

19
builtinModules/lib.nix Normal file
View File

@ -0,0 +1,19 @@
# flakelight -- Framework for simplifying flake setup
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
# SPDX-License-Identifier: MIT
{ config, lib, ... }:
let
inherit (lib) mkOption mkIf;
inherit (lib.types) attrsOf raw;
in
{
options.lib = mkOption {
type = attrsOf raw;
default = { };
};
config.outputs = mkIf (config.lib != { }) {
inherit (config) lib;
};
}

View File

@ -9,7 +9,7 @@
outputs = { nixpkgs, ... }:
let lib = import ./. nixpkgs; in
lib.mkFlake ./. {
outputs = { inherit lib; };
inherit lib;
functor = _: lib.mkFlake;
templates = import ./templates;
checks.statix = pkgs: "${pkgs.statix}/bin/statix check";