flake: deprecate .lib.lib

This commit is contained in:
lassulus 2023-09-26 15:57:59 +02:00 committed by mergify[bot]
parent c2bdc227e4
commit 2bf4fc166b
3 changed files with 6 additions and 6 deletions

View file

@ -1,9 +1,9 @@
{ lib ? import <nixpkgs/lib> { lib ? import <nixpkgs/lib>
, rootMountPoint ? "/mnt" , rootMountPoint ? "/mnt"
, checked ? false , checked ? false
, diskoLib ? import ./lib { inherit lib rootMountPoint; }
}: }:
let let
diskoLib = import ./lib { inherit lib rootMountPoint; };
eval = cfg: lib.evalModules { eval = cfg: lib.evalModules {
modules = lib.singleton { modules = lib.singleton {
# _file = toString input; # _file = toString input;
@ -17,7 +17,7 @@ let
}; };
in in
{ {
lib = diskoLib; lib = lib.warn "the .lib.lib output is deprecated" diskoLib;
# legacy alias # legacy alias
create = cfg: builtins.trace "the create output is deprecated, use format instead" (eval cfg).config.disko.devices._create; create = cfg: builtins.trace "the create output is deprecated, use format instead" (eval cfg).config.disko.devices._create;

View file

@ -19,7 +19,7 @@
{ {
nixosModules.default = self.nixosModules.disko; # convention nixosModules.default = self.nixosModules.disko; # convention
nixosModules.disko = import ./module.nix; nixosModules.disko = import ./module.nix;
lib = import ./. { lib = import ./lib {
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
}; };
packages = forAllSystems (system: packages = forAllSystems (system:

View file

@ -7,7 +7,7 @@ with lib;
with builtins; with builtins;
let let
outputs = import ../default.nix { inherit lib diskoLib; };
diskoLib = { diskoLib = {
# like make-disk-image.nix from nixpkgs, but with disko config # like make-disk-image.nix from nixpkgs, but with disko config
@ -19,7 +19,7 @@ let
testLib = import ./tests.nix { inherit lib makeTest eval-config; }; testLib = import ./tests.nix { inherit lib makeTest eval-config; };
# like lib.types.oneOf but instead of a list takes an attrset # like lib.types.oneOf but instead of a list takes an attrset
# uses the field "type" to find the correct type in the attrset # uses the field "type" to find the correct type in the attrset
subType = { types, extraArgs ? { parent = { type = "rootNode"; name = "root"; }; } }: lib.mkOptionType rec { subType = { types, extraArgs ? { parent = { type = "rootNode"; name = "root"; }; } }: lib.mkOptionType {
name = "subType"; name = "subType";
description = "one of ${concatStringsSep "," (attrNames types)}"; description = "one of ${concatStringsSep "," (attrNames types)}";
check = x: if x ? type then types.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}"; check = x: if x ? type then types.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}";
@ -584,6 +584,6 @@ let
(lib.attrNames (builtins.readDir ./types)) (lib.attrNames (builtins.readDir ./types))
); );
}; } // outputs;
in in
diskoLib diskoLib