Merge pull request #465 from max-privatevoid/flake-module-tweaks

flake-parts: add builder option + don't expose packages automatically
This commit is contained in:
DavHau 2023-02-16 09:19:56 +07:00 committed by GitHub
commit b4b491bd77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 19 deletions

View File

@ -29,6 +29,9 @@
};
};
};
packages = {
inherit (config.dream2nix.outputs.prettier.packages) prettier;
};
};
};
}

View File

@ -5,14 +5,6 @@
}: let
l = lib // builtins;
d2n = config.dream2nix;
# make attrs default, so that users can override them without
# needing to use lib.mkOverride (usually, lib.mkForce)
mkDefaultRecursive = attrs:
l.mapAttrsRecursiveCond
d2n.lib.dlib.isNotDrvAttrs
(_: l.mkDefault)
attrs;
in {
config = {
perSystem = {
@ -29,20 +21,9 @@ in {
l.mapAttrs
(_: args: instance.dream2nix-interface.makeOutputs args)
config.dream2nix.inputs;
getAttrFromOutputs = attrName:
l.mkMerge (
l.mapAttrsToList
(_: output: mkDefaultRecursive output.${attrName} or {})
outputs
);
in {
config = {
dream2nix = {inherit instance outputs;};
# TODO(yusdacra): we could combine all the resolveImpure here if there are multiple
# TODO(yusdacra): maybe we could rename outputs with the same name to avoid collisions?
packages = getAttrFromOutputs "packages";
devShells = getAttrFromOutputs "devShells";
};
};
};

View File

@ -37,6 +37,14 @@
type = t.str;
};
# TODO make an enum of all available builders?
builder = mkOption {
default = null;
description = ''Name of builder to use'';
example = "strict-builder";
type = t.nullOr t.str;
};
subsystemInfo = mkOption {
default = {};
description = "Translator specific arguments";

View File

@ -28,6 +28,9 @@
translator = "my-pure-translator";
};
};
packages = {
inherit (config.dream2nix.outputs.niv.packages) default;
};
};
};
}