mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2025-03-16 21:38:24 +00:00
Use markdown by default
This commit is contained in:
parent
fb87cc7333
commit
6b87695050
16 changed files with 66 additions and 55 deletions
18
dev/flake.lock
generated
18
dev/flake.lock
generated
|
@ -97,11 +97,11 @@
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1668065367,
|
"lastModified": 1668147980,
|
||||||
"narHash": "sha256-v8LdAfDSzxRS4BS+qZvorRGC8nXhN9xMJevu/hf+Gt0=",
|
"narHash": "sha256-dHu5VIGQvZoHtqr5tmndpiVVk5JnJ/6wZUNRwEfvIxk=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "hercules-ci-effects",
|
"repo": "hercules-ci-effects",
|
||||||
"rev": "692309d1cbb24847cc2b0a345ec9f0fe9481a7db",
|
"rev": "244595b8dcfea8c6ac52a99157653162d26ea6d3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -183,16 +183,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667991831,
|
"lastModified": 1668145650,
|
||||||
"narHash": "sha256-DHgEsLZI044B9T4AjA3K6+yB9/DqLr4dyA7OIx0FG7o=",
|
"narHash": "sha256-RJsYVz7j6HhXQtcFQJz9bZsgwFG8MblmOt8A4iD1AlY=",
|
||||||
"owner": "NixOS",
|
"owner": "hercules-ci",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "872fceeed60ae6b7766cc0a4cd5bf5901b9098ec",
|
"rev": "b106ff14ede4034f8771025f8ac785144358f3cd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "hercules-ci",
|
||||||
"ref": "nixos-unstable",
|
"ref": "options-markdown-and-errors",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# As a consequence, this flake is a little non-standard, and
|
# As a consequence, this flake is a little non-standard, and
|
||||||
# we can't use the `nix` CLI as expected.
|
# we can't use the `nix` CLI as expected.
|
||||||
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:hercules-ci/nixpkgs/options-markdown-and-errors";
|
||||||
|
|
||||||
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
|
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
|
||||||
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
|
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
|
@ -27,14 +27,14 @@ let
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
type = lib.types.enum [ "app" ];
|
type = lib.types.enum [ "app" ];
|
||||||
default = "app";
|
default = "app";
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
A type tag for <literal>apps</literal> consumers.
|
A type tag for `apps` consumers.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
program = mkOption {
|
program = mkOption {
|
||||||
type = programType;
|
type = programType;
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
A path to an executable or a derivation with <literal>meta.mainProgram</literal>.
|
A path to an executable or a derivation with `meta.mainProgram`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,7 @@ mkTransposedPerSystemModule {
|
||||||
type = types.lazyAttrsOf appType;
|
type = types.lazyAttrsOf appType;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Programs runnable with nix run <literal>.#<name></literal>.
|
Programs runnable with nix run `<name>`.
|
||||||
'';
|
'';
|
||||||
example = lib.literalExpression or lib.literalExample ''
|
example = lib.literalExpression or lib.literalExample ''
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ mkTransposedPerSystemModule {
|
||||||
type = types.lazyAttrsOf types.package;
|
type = types.lazyAttrsOf types.package;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Derivations to be built by nix flake check.
|
Derivations to be built by [`nix flake check`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-check.html).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
file = ./checks.nix;
|
file = ./checks.nix;
|
||||||
|
|
|
@ -18,8 +18,8 @@ in
|
||||||
type = types.lazyAttrsOf types.unspecified;
|
type = types.lazyAttrsOf types.unspecified;
|
||||||
default = { };
|
default = { };
|
||||||
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#darwinModules.${k}"; imports = [ v ]; });
|
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#darwinModules.${k}"; imports = [ v ]; });
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
Nix-darwin modules.
|
[nix-darwin](https://daiderd.com/nix-darwin/) modules.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,8 +14,8 @@ mkTransposedPerSystemModule {
|
||||||
type = types.lazyAttrsOf types.package;
|
type = types.lazyAttrsOf types.package;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set of packages to be built by <literal>nix develop .#<name></literal>.
|
An attribute set of packages to be used as shells.
|
||||||
<literal>nix build .#<name></literal> will run <literal>devShells.<name></literal>.
|
[`nix develop .#<name>`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html) will run `devShells.<name>`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
file = ./devShells.nix;
|
file = ./devShells.nix;
|
||||||
|
|
|
@ -16,8 +16,8 @@ in
|
||||||
{ freeformType = types.lazyAttrsOf types.raw; }
|
{ freeformType = types.lazyAttrsOf types.raw; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
Raw flake attributes. Any attribute can be set here, but some
|
Raw flake output attributes. Any attribute can be set here, but some
|
||||||
attributes are represented by options, to provide appropriate
|
attributes are represented by options, to provide appropriate
|
||||||
configuration merging.
|
configuration merging.
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -14,7 +14,7 @@ mkTransposedPerSystemModule {
|
||||||
type = types.nullOr types.package;
|
type = types.nullOr types.package;
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
A package used by <literal>nix fmt</literal>.
|
A package used by [`nix fmt`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-fmt.html).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
file = ./formatter.nix;
|
file = ./formatter.nix;
|
||||||
|
|
|
@ -14,7 +14,7 @@ mkTransposedPerSystemModule {
|
||||||
type = types.lazyAttrsOf types.raw;
|
type = types.lazyAttrsOf types.raw;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set of unmergeable values. This is also used by <literal>nix build .#<attrpath></literal>.
|
An attribute set of unmergeable values. This is also used by [`nix build .#<attrpath>`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-build.html).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
file = ./legacyPackages.nix;
|
file = ./legacyPackages.nix;
|
||||||
|
|
|
@ -15,8 +15,8 @@ in
|
||||||
nixosConfigurations = mkOption {
|
nixosConfigurations = mkOption {
|
||||||
type = types.lazyAttrsOf types.raw;
|
type = types.lazyAttrsOf types.raw;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
Instantiated NixOS configurations.
|
Instantiated NixOS configurations. Used by `nixos-rebuild`.
|
||||||
'';
|
'';
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ in
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
./my-machine/nixos-configuration.nix
|
./my-machine/nixos-configuration.nix
|
||||||
|
config.nixosModules.my-module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,10 @@ in
|
||||||
type = types.lazyAttrsOf types.unspecified;
|
type = types.lazyAttrsOf types.unspecified;
|
||||||
default = { };
|
default = { };
|
||||||
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#nixosModules.${k}"; imports = [ v ]; });
|
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#nixosModules.${k}"; imports = [ v ]; });
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
NixOS modules.
|
NixOS modules.
|
||||||
|
|
||||||
|
You may use this for reusable pieces of configuration, service modules, etc.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,13 +23,13 @@ in
|
||||||
default = final: prev: {};
|
default = final: prev: {};
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
An attribute set of overlays.
|
An attribute set of [overlays](https://nixos.org/manual/nixpkgs/stable/#chap-overlays).
|
||||||
|
|
||||||
Note that the overlays themselves are not mergeable. While overlays
|
Note that the overlays themselves are not mergeable. While overlays
|
||||||
can be composed, the order of composition is significant, but the
|
can be composed, the order of composition is significant, but the
|
||||||
module system does not guarantee sufficiently deterministic
|
module system does not guarantee sufficiently deterministic
|
||||||
definition ordering, across versions and when changing <literal>imports</literal>.
|
definition ordering, across versions and when changing `imports`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,8 +14,9 @@ mkTransposedPerSystemModule {
|
||||||
type = types.lazyAttrsOf types.package;
|
type = types.lazyAttrsOf types.package;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set of packages to be built by <literal>nix build .#<name></literal>.
|
An attribute set of packages to be built by [`nix build`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-build.html).
|
||||||
<literal>nix build .#<name></literal> will build <literal>packages.<name></literal>.
|
|
||||||
|
`nix build .#<name>` will build `packages.<name>`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
file = ./packages.nix;
|
file = ./packages.nix;
|
||||||
|
|
|
@ -16,17 +16,21 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
systems = mkOption {
|
systems = mkOption {
|
||||||
description = "All the system types to enumerate in the flake.";
|
description = lib.mdDoc ''
|
||||||
|
All the system types to enumerate in the flake output subattributes.
|
||||||
|
|
||||||
|
In other words, all valid values for `system` in e.g. `packages.<system>.foo`.
|
||||||
|
'';
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
perInput = mkOption {
|
perInput = mkOption {
|
||||||
description = "Function from system to function from flake to <literal>system</literal>-specific attributes.";
|
description = lib.mdDoc "Function from system to function from flake to `system`-specific attributes.";
|
||||||
type = types.functionTo (types.functionTo (types.lazyAttrsOf types.unspecified));
|
type = types.functionTo (types.functionTo (types.lazyAttrsOf types.unspecified));
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = mkOption {
|
perSystem = mkOption {
|
||||||
description = "A function from system to flake-like attributes omitting the <literal><system></literal> attribute.";
|
description = lib.mdDoc "A function from system to flake-like attributes omitting the `<system>` attribute.";
|
||||||
type = mkPerSystemType ({ config, system, ... }: {
|
type = mkPerSystemType ({ config, system, ... }: {
|
||||||
_file = ./perSystem.nix;
|
_file = ./perSystem.nix;
|
||||||
config = {
|
config = {
|
||||||
|
@ -46,7 +50,7 @@ in
|
||||||
|
|
||||||
allSystems = mkOption {
|
allSystems = mkOption {
|
||||||
type = types.lazyAttrsOf types.unspecified;
|
type = types.lazyAttrsOf types.unspecified;
|
||||||
description = "The system-specific config for each of systems.";
|
description = lib.mdDoc "The system-specific config for each of systems.";
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,12 +17,12 @@ let
|
||||||
adHoc = mkOption {
|
adHoc = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
Whether to provide a stub option declaration for <option>perSystem.<name></option>
|
Whether to provide a stub option declaration for {option}`perSystem.<name>`.
|
||||||
|
|
||||||
The stub option declaration does not support merging and lacks
|
The stub option declaration does not support merging and lacks
|
||||||
documentation, so you are recommended to declare the <option>perSystem.<name></option>
|
documentation, so you are recommended to declare the {option}`perSystem.<name>`
|
||||||
option yourself and avoid <option>adHoc</option>.
|
option yourself and avoid {option}`adHoc`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -32,18 +32,18 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
transposition = lib.mkOption {
|
transposition = lib.mkOption {
|
||||||
description = ''
|
description = lib.mdDoc ''
|
||||||
A helper that defines transposed attributes in the flake outputs.
|
A helper that defines transposed attributes in the flake outputs.
|
||||||
|
|
||||||
Transposition is the operation that swaps the indices of a data structure.
|
Transposition is the operation that swaps the indices of a data structure.
|
||||||
Here it refers specifically to the transposition between
|
Here it refers specifically to the transposition between
|
||||||
|
|
||||||
<literal>
|
```plain
|
||||||
perSystem: .''${system}.''${attribute}
|
perSystem: .''${system}.''${attribute}
|
||||||
outputs: .''${attribute}.''${system}
|
outputs: .''${attribute}.''${system}
|
||||||
</literal>
|
```
|
||||||
|
|
||||||
It also defines the reverse operation in <option>perInput</option>.
|
It also defines the reverse operation in [{option}`perInput`](#opt-perInput).
|
||||||
'';
|
'';
|
||||||
type =
|
type =
|
||||||
types.lazyAttrsOf
|
types.lazyAttrsOf
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
let sourcePathStr = toString sourcePath;
|
let sourcePathStr = toString sourcePath;
|
||||||
in
|
in
|
||||||
opt:
|
opt:
|
||||||
let declarations = concatMap
|
let
|
||||||
|
declarations = concatMap
|
||||||
(decl:
|
(decl:
|
||||||
if hasPrefix sourcePathStr (toString decl)
|
if hasPrefix sourcePathStr (toString decl)
|
||||||
then
|
then
|
||||||
|
@ -39,6 +40,8 @@
|
||||||
transformOptions = filterTransformOptions {
|
transformOptions = filterTransformOptions {
|
||||||
inherit sourceName baseUrl sourcePath;
|
inherit sourceName baseUrl sourcePath;
|
||||||
};
|
};
|
||||||
|
warningsAreErrors = true; # not sure if feasible long term
|
||||||
|
markdownByDefault = true;
|
||||||
}).optionsDocBook;
|
}).optionsDocBook;
|
||||||
inherit title;
|
inherit title;
|
||||||
} ''
|
} ''
|
||||||
|
|
Loading…
Add table
Reference in a new issue