Revert "Fix: forward meta attributes in flake-parts module"

This reverts commit e7c6333e06.

The propagated `self` attribute can be an error in non `flake-parts`
modules.
This commit is contained in:
a-kenji
2024-08-07 12:34:03 +02:00
committed by kenji
parent 40ea12610c
commit 10f7509a5f
4 changed files with 29 additions and 26 deletions

View File

@@ -11,7 +11,6 @@
directory, # The directory containing the machines subdirectory # allows to include machine-specific modules i.e. machines.${name} = { ... }
# A map from arch to pkgs, if specified this nixpkgs will be only imported once for each system.
# This improves performance, but all nipxkgs.* options will be ignored.
# deadnix: skip
inventory ? { },
## Sepcial inputs (not passed to the module system as config)
specialArgs ? { }, # Extra arguments to pass to nixosSystem i.e. useful to make self available # A set containing clan meta: name :: string, icon :: string, description :: string
@@ -28,9 +27,14 @@ let
;
self = directory;
};
rest = builtins.removeAttrs attrs [ "specialArgs" ];
meta = attrs.meta or { };
rest = builtins.removeAttrs attrs [
"meta"
"specialArgs"
];
in
eval {
inventory.meta = lib.mapAttrs (_: lib.mkDefault) meta;
imports = [
rest
# implementation

View File

@@ -1,4 +1,4 @@
{ lib, self, ... }:
{ lib, ... }:
let
types = lib.types;
in
@@ -7,7 +7,6 @@ in
# Required options
directory = lib.mkOption {
type = types.path;
default = self;
description = "The directory containing the clan subdirectory";
};
@@ -27,18 +26,22 @@ in
};
# Meta
meta = lib.mkOption {
type = types.nullOr (
types.submodule {
options = {
meta = {
name = lib.mkOption {
type = types.nullOr types.str;
default = null;
description = "Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.";
};
};
}
);
icon = lib.mkOption {
type = types.nullOr types.path;
default = null;
description = "A path to an icon to be used for the clan in the GUI";
};
description = lib.mkOption {
type = types.nullOr types.str;
default = null;
description = "A short description of the clan";
};
};
pkgsForSystem = lib.mkOption {

View File

@@ -201,8 +201,6 @@ in
imports = [
# Merge the inventory file
{ inventory = inventoryLoaded; }
# Merge the meta attributes from the buildClan function
{ inventory.meta = if config.meta != null then config.meta else { }; }
];
inherit nixosConfigurations;

View File

@@ -15,13 +15,10 @@ in
{
test_only_required =
let
config = evalClan {
meta.name = "test";
imports = [ ./module.nix ];
};
config = evalClan { directory = ./.; };
in
{
expr = config.inventory ? meta;
expr = config.pkgsForSystem null == null;
expected = true;
};
@@ -96,9 +93,10 @@ in
in
{
expr = result.clanInternals.meta;
expectedError = {
type = "ThrownError";
msg = "";
expected = {
description = "description";
icon = "icon";
name = "superclan";
};
};