aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorRebecca Turner <rbt@sent.as>2024-04-04 16:07:44 -0700
committerRebecca Turner <rbt@sent.as>2024-04-08 13:00:00 -0700
commitcfbcf122769d613e08ed906021d84ab5c0db95c0 (patch)
treef7ee0873b07cf94c8544b7862b332206da253ec5 /src/libexpr/flake
parentb3233405381b50c7f7eb87d7962b25a06d16be44 (diff)
Format Nix code with `nixfmt`
Change-Id: I61efeb666ff7481c05fcb247168290e86a250151
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/call-flake.nix112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/libexpr/flake/call-flake.nix b/src/libexpr/flake/call-flake.nix
index 4beb0b0fe..58b4a5542 100644
--- a/src/libexpr/flake/call-flake.nix
+++ b/src/libexpr/flake/call-flake.nix
@@ -4,69 +4,69 @@ let
lockFile = builtins.fromJSON lockFileStr;
- allNodes =
- builtins.mapAttrs
- (key: node:
- let
+ allNodes = builtins.mapAttrs (
+ key: node:
+ let
- sourceInfo =
- if key == lockFile.root
- then rootSrc
- else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]);
+ sourceInfo =
+ if key == lockFile.root then
+ rootSrc
+ else
+ fetchTree (node.info or { } // removeAttrs node.locked [ "dir" ]);
- subdir = if key == lockFile.root then rootSubdir else node.locked.dir or "";
+ subdir = if key == lockFile.root then rootSubdir else node.locked.dir or "";
- outPath = sourceInfo + ((if subdir == "" then "" else "/") + subdir);
+ outPath = sourceInfo + ((if subdir == "" then "" else "/") + subdir);
- flake = import (outPath + "/flake.nix");
+ flake = import (outPath + "/flake.nix");
- inputs = builtins.mapAttrs
- (inputName: inputSpec: allNodes.${resolveInput inputSpec})
- (node.inputs or {});
+ inputs = builtins.mapAttrs (inputName: inputSpec: allNodes.${resolveInput inputSpec}) (
+ node.inputs or { }
+ );
- # Resolve a input spec into a node name. An input spec is
- # either a node name, or a 'follows' path from the root
- # node.
- resolveInput = inputSpec:
- if builtins.isList inputSpec
- then getInputByPath lockFile.root inputSpec
- else inputSpec;
+ # Resolve a input spec into a node name. An input spec is
+ # either a node name, or a 'follows' path from the root
+ # node.
+ resolveInput =
+ inputSpec: if builtins.isList inputSpec then getInputByPath lockFile.root inputSpec else inputSpec;
- # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the
- # root node, returning the final node.
- getInputByPath = nodeName: path:
- if path == []
- then nodeName
- else
- getInputByPath
- # Since this could be a 'follows' input, call resolveInput.
- (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path})
- (builtins.tail path);
+ # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the
+ # root node, returning the final node.
+ getInputByPath =
+ nodeName: path:
+ if path == [ ] then
+ nodeName
+ else
+ getInputByPath
+ # Since this could be a 'follows' input, call resolveInput.
+ (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path})
+ (builtins.tail path);
- outputs = flake.outputs (inputs // { self = result; });
+ outputs = flake.outputs (inputs // { self = result; });
- result =
- outputs
- # We add the sourceInfo attribute for its metadata, as they are
- # relevant metadata for the flake. However, the outPath of the
- # sourceInfo does not necessarily match the outPath of the flake,
- # as the flake may be in a subdirectory of a source.
- # This is shadowed in the next //
- // sourceInfo
- // {
- # This shadows the sourceInfo.outPath
- inherit outPath;
+ result =
+ outputs
+ # We add the sourceInfo attribute for its metadata, as they are
+ # relevant metadata for the flake. However, the outPath of the
+ # sourceInfo does not necessarily match the outPath of the flake,
+ # as the flake may be in a subdirectory of a source.
+ # This is shadowed in the next //
+ // sourceInfo
+ // {
+ # This shadows the sourceInfo.outPath
+ inherit outPath;
- inherit inputs; inherit outputs; inherit sourceInfo; _type = "flake";
- };
-
- in
- if node.flake or true then
- assert builtins.isFunction flake.outputs;
- result
- else
- sourceInfo
- )
- lockFile.nodes;
-
-in allNodes.${lockFile.root}
+ inherit inputs;
+ inherit outputs;
+ inherit sourceInfo;
+ _type = "flake";
+ };
+ in
+ if node.flake or true then
+ assert builtins.isFunction flake.outputs;
+ result
+ else
+ sourceInfo
+ ) lockFile.nodes;
+in
+allNodes.${lockFile.root}