mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Format .nix files
This does not include any automation for the release branch, but is based on the configuration of https://github.com/NixOS/nix/pull/12349 pre-commit run -a nixfmt-rfc-style
This commit is contained in:
parent
6cb17fd836
commit
32aed360b8
266 changed files with 7443 additions and 5118 deletions
|
@ -3,7 +3,10 @@ let
|
|||
name = "fail";
|
||||
builder = "/bin/false";
|
||||
system = "x86_64-linux";
|
||||
outputs = [ "out" "foo" ];
|
||||
outputs = [
|
||||
"out"
|
||||
"foo"
|
||||
];
|
||||
};
|
||||
|
||||
path = "${./eval-okay-context-introspection.nix}";
|
||||
|
@ -13,7 +16,10 @@ let
|
|||
path = true;
|
||||
};
|
||||
"${builtins.unsafeDiscardStringContext drv.drvPath}" = {
|
||||
outputs = [ "foo" "out" ];
|
||||
outputs = [
|
||||
"foo"
|
||||
"out"
|
||||
];
|
||||
allOutputs = true;
|
||||
};
|
||||
};
|
||||
|
@ -21,25 +27,22 @@ let
|
|||
combo-path = "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
|
||||
legit-context = builtins.getContext combo-path;
|
||||
|
||||
reconstructed-path = builtins.appendContext
|
||||
(builtins.unsafeDiscardStringContext combo-path)
|
||||
desired-context;
|
||||
reconstructed-path = builtins.appendContext (builtins.unsafeDiscardStringContext combo-path) desired-context;
|
||||
|
||||
# Eta rule for strings with context.
|
||||
etaRule = str:
|
||||
str == builtins.appendContext
|
||||
(builtins.unsafeDiscardStringContext str)
|
||||
(builtins.getContext str);
|
||||
etaRule =
|
||||
str:
|
||||
str == builtins.appendContext (builtins.unsafeDiscardStringContext str) (builtins.getContext str);
|
||||
|
||||
# Only holds true if string context contains both a `DrvDeep` and
|
||||
# `Opaque` element.
|
||||
almostEtaRule = str:
|
||||
str == builtins.addDrvOutputDependencies
|
||||
(builtins.unsafeDiscardOutputDependency str);
|
||||
almostEtaRule =
|
||||
str: str == builtins.addDrvOutputDependencies (builtins.unsafeDiscardOutputDependency str);
|
||||
|
||||
addDrvOutputDependencies_idempotent = str:
|
||||
builtins.addDrvOutputDependencies str ==
|
||||
builtins.addDrvOutputDependencies (builtins.addDrvOutputDependencies str);
|
||||
addDrvOutputDependencies_idempotent =
|
||||
str:
|
||||
builtins.addDrvOutputDependencies str
|
||||
== builtins.addDrvOutputDependencies (builtins.addDrvOutputDependencies str);
|
||||
|
||||
rules = str: [
|
||||
(etaRule str)
|
||||
|
@ -47,12 +50,14 @@ let
|
|||
(addDrvOutputDependencies_idempotent str)
|
||||
];
|
||||
|
||||
in [
|
||||
in
|
||||
[
|
||||
(legit-context == desired-context)
|
||||
(reconstructed-path == combo-path)
|
||||
(etaRule "foo")
|
||||
(etaRule drv.foo.outPath)
|
||||
] ++ builtins.concatMap rules [
|
||||
]
|
||||
++ builtins.concatMap rules [
|
||||
drv.drvPath
|
||||
(builtins.addDrvOutputDependencies drv.drvPath)
|
||||
(builtins.unsafeDiscardOutputDependency drv.drvPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue