refactor: change projects -> inputs, make option description more explanatory

This commit is contained in:
Yusuf Bera Ertan 2022-10-31 22:26:03 +03:00
parent 5fd403b090
commit cc3020a32f
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA
4 changed files with 16 additions and 24 deletions

View File

@ -16,29 +16,14 @@
}:
flake-parts.lib.mkFlake {inherit self;} {
systems = ["x86_64-linux"];
imports = [dream2nix.flakeModule];
imports = [dream2nix.flakeModuleBeta];
dream2nix = {
config.projectRoot = ./.;
projects."ripgrep" = {
# define an input for dream2nix to generate outputs for
inputs."ripgrep" = {
source = src;
settings = [{builder = "crane";}];
};
};
perSystem = {
config,
lib,
pkgs,
...
}: let
inherit (config.dream2nix) outputs;
in {
packages.ripgrep = outputs.packages.ripgrep.overrideAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [pkgs.hello];
postInstall = ''
${old.postInstall or ""}
hello
'';
});
};
};
}

View File

@ -194,7 +194,7 @@
# kept for compat
lib2 = d2n-lib;
flakeModule = {
flakeModuleBeta = {
imports = [./src/modules/flake-parts];
dream2nix.lib = d2n-lib;
};

View File

@ -14,7 +14,7 @@
outputs = d2n.lib.dlib.mergeFlakes (
l.map
(p: d2n.lib.makeFlakeOutputs (makeArgs p))
(l.attrValues d2n.projects)
(l.attrValues d2n.inputs)
);
in {
config = {

View File

@ -22,14 +22,21 @@ in {
};
default = {};
description = ''
The dream2nix config.
The dream2nix config. This will be applied to all defined `sources`.
You can override this per `source` by specifying `config` for that source:
```nix
sources."name" = {
config.projectSource = ./source;
};
```
'';
};
projects = l.mkOption {
type = t.attrsOf t.raw;
inputs = l.mkOption {
type = t.attrsOf t.attrs;
default = {};
description = ''
The projects that outputs will be generated for.
A list of inputs to generate outputs from.
Each one takes the same arguments `makeFlakeOutputs` takes.
'';
};
outputs = l.mkOption {