refactor(lib): add lib output to flake
This is needed so we can use subattributes of flake.lib
This commit is contained in:
parent
1dc3f4bf44
commit
4e74db3938
6 changed files with 33 additions and 4 deletions
14
nix/flake-parts/lib.nix
Normal file
14
nix/flake-parts/lib.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ lib, inputs, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) lazyAttrsOf raw;
|
||||||
|
inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.flake = mkSubmoduleOptions {
|
||||||
|
lib = mkOption {
|
||||||
|
type = lazyAttrsOf raw;
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ let
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.lib = {
|
flake.lib.modules = {
|
||||||
/**
|
/**
|
||||||
Return an attribute set for use with a option that needs to be used for all users.
|
Return an attribute set for use with a option that needs to be used for all users.
|
||||||
|
|
15
nix/lib/options.nix
Normal file
15
nix/lib/options.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) str;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.lib.options = {
|
||||||
|
mkStrOption =
|
||||||
|
default:
|
||||||
|
mkOption {
|
||||||
|
inherit default;
|
||||||
|
type = str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{ inputs, config, ... }:
|
{ inputs, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (cfg.lib) forAllUsers';
|
inherit (cfg.lib.modules) forAllUsers';
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
hm = inputs.home-manager;
|
hm = inputs.home-manager;
|
||||||
globalCfg = {
|
globalCfg = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
inherit (cfg.lib) forAllUsers';
|
inherit (cfg.lib.modules) forAllUsers';
|
||||||
inherit (lib.attrsets) mapAttrs';
|
inherit (lib.attrsets) mapAttrs';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
inherit (cfg.lib) forAllUsers';
|
inherit (cfg.lib.modules) forAllUsers';
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue