ci/treefmt: add markdown-code-runner (#427460)
This commit is contained in:
commit
be57485fff
@ -75,6 +75,23 @@ let
|
|||||||
includes = [ "*" ];
|
includes = [ "*" ];
|
||||||
priority = 1;
|
priority = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: Upstream this into treefmt-nix eventually:
|
||||||
|
# https://github.com/numtide/treefmt-nix/issues/387
|
||||||
|
settings.formatter.markdown-code-runner = {
|
||||||
|
command = pkgs.lib.getExe pkgs.markdown-code-runner;
|
||||||
|
options =
|
||||||
|
let
|
||||||
|
config = pkgs.writers.writeTOML "markdown-code-runner-config" {
|
||||||
|
presets.nixfmt = {
|
||||||
|
language = "nix";
|
||||||
|
command = [ (pkgs.lib.getExe pkgs.nixfmt) ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
[ "--config=${config}" ];
|
||||||
|
includes = [ "*.md" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
fs = pkgs.lib.fileset;
|
fs = pkgs.lib.fileset;
|
||||||
nixFilesSrc = fs.toSource {
|
nixFilesSrc = fs.toSource {
|
||||||
|
@ -137,7 +137,6 @@ stdenvNoCC.mkDerivation (
|
|||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
manpage-urls = callPackage ../tests/manpage-urls.nix { };
|
manpage-urls = callPackage ../tests/manpage-urls.nix { };
|
||||||
check-nix-code-blocks = callPackage ../tests/check-nix-code-blocks.nix { };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
runCommand,
|
|
||||||
markdown-code-runner,
|
|
||||||
nixfmt-rfc-style,
|
|
||||||
}:
|
|
||||||
|
|
||||||
runCommand "manual_check-nix-code-blocks"
|
|
||||||
{
|
|
||||||
nativeBuildInputs = [
|
|
||||||
markdown-code-runner
|
|
||||||
nixfmt-rfc-style
|
|
||||||
];
|
|
||||||
}
|
|
||||||
''
|
|
||||||
set +e
|
|
||||||
|
|
||||||
mdcr --check --config ${./mdcr-config.toml} ${./..}
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
cat <<EOF
|
|
||||||
Error: `mdcr` command failed. Please make sure the Nix code snippets in Markdown files are correctly formatted.
|
|
||||||
|
|
||||||
Run this command from the Nixpkgs repository root for automatic formatting:
|
|
||||||
|
|
||||||
mdcr --log debug --config ${toString ./..}/tests/mdcr-config.toml ${toString ./..}
|
|
||||||
|
|
||||||
EOF
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
touch "$out"
|
|
||||||
''
|
|
@ -1,3 +0,0 @@
|
|||||||
[presets.nixfmt]
|
|
||||||
language = "nix"
|
|
||||||
command = ["nixfmt"]
|
|
@ -45,11 +45,18 @@ So note that the default value of `system.services.<name>` is not a complete ser
|
|||||||
It is possible to write service modules that are portable. This is done by either avoiding the `systemd` option tree, or by defining process-manager-specific definitions in an optional way:
|
It is possible to write service modules that are portable. This is done by either avoiding the `systemd` option tree, or by defining process-manager-specific definitions in an optional way:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ config, options, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
_class = "service";
|
_class = "service";
|
||||||
config = {
|
config = {
|
||||||
process.argv = [ (lib.getExe config.foo.program) ];
|
process.argv = [ (lib.getExe config.foo.program) ];
|
||||||
} // lib.optionalAttrs (options?systemd) {
|
}
|
||||||
|
// lib.optionalAttrs (options ? systemd) {
|
||||||
# ... systemd-specific definitions ...
|
# ... systemd-specific definitions ...
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ For a basic configuration with Postfix as the MTA, the following settings are su
|
|||||||
local_recipient_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ];
|
local_recipient_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ];
|
||||||
relay_domains = [ "hash:/var/lib/mailman/data/postfix_domains" ];
|
relay_domains = [ "hash:/var/lib/mailman/data/postfix_domains" ];
|
||||||
smtpd_tls_chain_files = [
|
smtpd_tls_chain_files = [
|
||||||
config.security.acme.certs."lists.example.org".directory + "/full.pem"
|
(config.security.acme.certs."lists.example.org".directory + "/full.pem")
|
||||||
config.security.acme.certs."lists.example.org".directory + "/key.pem"
|
(config.security.acme.certs."lists.example.org".directory + "/key.pem")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user