aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcmd/built-path.hh2
-rw-r--r--src/libexpr/eval-error.hh1
-rw-r--r--src/libexpr/eval-settings.hh1
-rw-r--r--src/libexpr/fetchurl.nix102
-rw-r--r--src/libexpr/flake/call-flake.nix112
-rw-r--r--src/libexpr/gc-small-vector.hh1
-rw-r--r--src/libexpr/imported-drv-to-derivation.nix33
-rw-r--r--src/libexpr/pos-idx.hh1
-rw-r--r--src/libexpr/pos-table.hh1
-rw-r--r--src/libexpr/primops/derivation.nix38
-rw-r--r--src/libexpr/print-ambiguous.hh1
-rw-r--r--src/libexpr/repl-exit-status.hh1
-rw-r--r--src/libfetchers/fetch-to-store.hh1
-rw-r--r--src/libstore/derived-path-map.hh1
-rw-r--r--src/libstore/path-references.hh1
-rw-r--r--src/libstore/remote-store-connection.hh3
-rw-r--r--src/libutil/args/root.hh1
-rw-r--r--src/libutil/english.hh1
-rw-r--r--src/libutil/escape-char.hh2
-rw-r--r--src/libutil/escape-string.hh1
-rw-r--r--src/libutil/exit.hh1
-rw-r--r--src/libutil/print-elided.hh1
-rw-r--r--src/libutil/shlex.hh1
-rw-r--r--src/nix-channel/unpack-channel.nix6
-rw-r--r--src/nix-env/buildenv.nix16
-rw-r--r--src/nix/doctor.cc7
26 files changed, 205 insertions, 132 deletions
diff --git a/src/libcmd/built-path.hh b/src/libcmd/built-path.hh
index e677bc810..da87a33b0 100644
--- a/src/libcmd/built-path.hh
+++ b/src/libcmd/built-path.hh
@@ -1,3 +1,5 @@
+#pragma once
+///@file
#include "derived-path.hh"
#include "realisation.hh"
diff --git a/src/libexpr/eval-error.hh b/src/libexpr/eval-error.hh
index 2fb6bcf41..4f0e0d24c 100644
--- a/src/libexpr/eval-error.hh
+++ b/src/libexpr/eval-error.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <algorithm>
diff --git a/src/libexpr/eval-settings.hh b/src/libexpr/eval-settings.hh
index e8bfe81a4..98fe6881e 100644
--- a/src/libexpr/eval-settings.hh
+++ b/src/libexpr/eval-settings.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include "config.hh"
namespace nix {
diff --git a/src/libexpr/fetchurl.nix b/src/libexpr/fetchurl.nix
index 9d1b61d7f..50007c738 100644
--- a/src/libexpr/fetchurl.nix
+++ b/src/libexpr/fetchurl.nix
@@ -1,43 +1,75 @@
-{ system ? "" # obsolete
-, url
-, hash ? "" # an SRI hash
-
-# Legacy hash specification
-, md5 ? "", sha1 ? "", sha256 ? "", sha512 ? ""
-, outputHash ?
- if hash != "" then hash else if sha512 != "" then sha512 else if sha1 != "" then sha1 else if md5 != "" then md5 else sha256
-, outputHashAlgo ?
- if hash != "" then "" else if sha512 != "" then "sha512" else if sha1 != "" then "sha1" else if md5 != "" then "md5" else "sha256"
-
-, executable ? false
-, unpack ? false
-, name ? baseNameOf (toString url)
-, impure ? false
+{
+ system ? "", # obsolete
+ url,
+ hash ? "", # an SRI hash
+
+ # Legacy hash specification
+ md5 ? "",
+ sha1 ? "",
+ sha256 ? "",
+ sha512 ? "",
+ outputHash ?
+ if hash != "" then
+ hash
+ else if sha512 != "" then
+ sha512
+ else if sha1 != "" then
+ sha1
+ else if md5 != "" then
+ md5
+ else
+ sha256,
+ outputHashAlgo ?
+ if hash != "" then
+ ""
+ else if sha512 != "" then
+ "sha512"
+ else if sha1 != "" then
+ "sha1"
+ else if md5 != "" then
+ "md5"
+ else
+ "sha256",
+
+ executable ? false,
+ unpack ? false,
+ name ? baseNameOf (toString url),
+ impure ? false,
}:
-derivation ({
- builder = "builtin:fetchurl";
+derivation (
+ {
+ builder = "builtin:fetchurl";
- # New-style output content requirements.
- outputHashMode = if unpack || executable then "recursive" else "flat";
+ # New-style output content requirements.
+ outputHashMode = if unpack || executable then "recursive" else "flat";
- inherit name url executable unpack;
+ inherit
+ name
+ url
+ executable
+ unpack
+ ;
- system = "builtin";
+ system = "builtin";
- # No need to double the amount of network traffic
- preferLocalBuild = true;
+ # No need to double the amount of network traffic
+ preferLocalBuild = true;
- impureEnvVars = [
- # We borrow these environment variables from the caller to allow
- # easy proxy configuration. This is impure, but a fixed-output
- # derivation like fetchurl is allowed to do so since its result is
- # by definition pure.
- "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
- ];
+ impureEnvVars = [
+ # We borrow these environment variables from the caller to allow
+ # easy proxy configuration. This is impure, but a fixed-output
+ # derivation like fetchurl is allowed to do so since its result is
+ # by definition pure.
+ "http_proxy"
+ "https_proxy"
+ "ftp_proxy"
+ "all_proxy"
+ "no_proxy"
+ ];
- # To make "nix-prefetch-url" work.
- urls = [ url ];
-} // (if impure
- then { __impure = true; }
- else { inherit outputHashAlgo outputHash; }))
+ # To make "nix-prefetch-url" work.
+ urls = [ url ];
+ }
+ // (if impure then { __impure = true; } else { inherit outputHashAlgo outputHash; })
+)
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}
diff --git a/src/libexpr/gc-small-vector.hh b/src/libexpr/gc-small-vector.hh
index 94c3ad28b..c4bd1db26 100644
--- a/src/libexpr/gc-small-vector.hh
+++ b/src/libexpr/gc-small-vector.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <boost/container/small_vector.hpp>
diff --git a/src/libexpr/imported-drv-to-derivation.nix b/src/libexpr/imported-drv-to-derivation.nix
index 9467e6a22..50864563e 100644
--- a/src/libexpr/imported-drv-to-derivation.nix
+++ b/src/libexpr/imported-drv-to-derivation.nix
@@ -1,21 +1,26 @@
-attrs @ { drvPath, outputs, name, ... }:
+attrs@{
+ drvPath,
+ outputs,
+ name,
+ ...
+}:
let
- commonAttrs = (builtins.listToAttrs outputsList) //
- { all = map (x: x.value) outputsList;
- inherit drvPath name;
- type = "derivation";
- };
+ commonAttrs = (builtins.listToAttrs outputsList) // {
+ all = map (x: x.value) outputsList;
+ inherit drvPath name;
+ type = "derivation";
+ };
- outputToAttrListElement = outputName:
- { name = outputName;
- value = commonAttrs // {
- outPath = builtins.getAttr outputName attrs;
- inherit outputName;
- };
+ outputToAttrListElement = outputName: {
+ name = outputName;
+ value = commonAttrs // {
+ outPath = builtins.getAttr outputName attrs;
+ inherit outputName;
};
+ };
outputsList = map outputToAttrListElement outputs;
-
-in (builtins.head outputsList).value
+in
+(builtins.head outputsList).value
diff --git a/src/libexpr/pos-idx.hh b/src/libexpr/pos-idx.hh
index e94fd85c6..406fc1b36 100644
--- a/src/libexpr/pos-idx.hh
+++ b/src/libexpr/pos-idx.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <cinttypes>
diff --git a/src/libexpr/pos-table.hh b/src/libexpr/pos-table.hh
index 0b60c4f6d..704f24696 100644
--- a/src/libexpr/pos-table.hh
+++ b/src/libexpr/pos-table.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <cinttypes>
#include <numeric>
diff --git a/src/libexpr/primops/derivation.nix b/src/libexpr/primops/derivation.nix
index c0fbe8082..674408c6d 100644
--- a/src/libexpr/primops/derivation.nix
+++ b/src/libexpr/primops/derivation.nix
@@ -1,27 +1,35 @@
-/* This is the implementation of the ‘derivation’ builtin function.
- It's actually a wrapper around the ‘derivationStrict’ primop. */
+/*
+ This is the implementation of the ‘derivation’ builtin function.
+ It's actually a wrapper around the ‘derivationStrict’ primop.
+*/
-drvAttrs @ { outputs ? [ "out" ], ... }:
+drvAttrs@{
+ outputs ? [ "out" ],
+ ...
+}:
let
strict = derivationStrict drvAttrs;
- commonAttrs = drvAttrs // (builtins.listToAttrs outputsList) //
- { all = map (x: x.value) outputsList;
+ commonAttrs =
+ drvAttrs
+ // (builtins.listToAttrs outputsList)
+ // {
+ all = map (x: x.value) outputsList;
inherit drvAttrs;
};
- outputToAttrListElement = outputName:
- { name = outputName;
- value = commonAttrs // {
- outPath = builtins.getAttr outputName strict;
- drvPath = strict.drvPath;
- type = "derivation";
- inherit outputName;
- };
+ outputToAttrListElement = outputName: {
+ name = outputName;
+ value = commonAttrs // {
+ outPath = builtins.getAttr outputName strict;
+ drvPath = strict.drvPath;
+ type = "derivation";
+ inherit outputName;
};
+ };
outputsList = map outputToAttrListElement outputs;
-
-in (builtins.head outputsList).value
+in
+(builtins.head outputsList).value
diff --git a/src/libexpr/print-ambiguous.hh b/src/libexpr/print-ambiguous.hh
index 50c260a9b..b615d1e5a 100644
--- a/src/libexpr/print-ambiguous.hh
+++ b/src/libexpr/print-ambiguous.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include "value.hh"
diff --git a/src/libexpr/repl-exit-status.hh b/src/libexpr/repl-exit-status.hh
index 08299ff61..f150b9597 100644
--- a/src/libexpr/repl-exit-status.hh
+++ b/src/libexpr/repl-exit-status.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
namespace nix {
diff --git a/src/libfetchers/fetch-to-store.hh b/src/libfetchers/fetch-to-store.hh
index eef269071..717450944 100644
--- a/src/libfetchers/fetch-to-store.hh
+++ b/src/libfetchers/fetch-to-store.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include "source-path.hh"
#include "store-api.hh"
diff --git a/src/libstore/derived-path-map.hh b/src/libstore/derived-path-map.hh
index 4d72b301e..393cdedf7 100644
--- a/src/libstore/derived-path-map.hh
+++ b/src/libstore/derived-path-map.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include "types.hh"
#include "derived-path.hh"
diff --git a/src/libstore/path-references.hh b/src/libstore/path-references.hh
index 7b44e3261..0553003f8 100644
--- a/src/libstore/path-references.hh
+++ b/src/libstore/path-references.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include "references.hh"
#include "path.hh"
diff --git a/src/libstore/remote-store-connection.hh b/src/libstore/remote-store-connection.hh
index e4a9cacb9..44328b06b 100644
--- a/src/libstore/remote-store-connection.hh
+++ b/src/libstore/remote-store-connection.hh
@@ -1,3 +1,6 @@
+#pragma once
+///@file
+
#include "remote-store.hh"
#include "worker-protocol.hh"
#include "pool.hh"
diff --git a/src/libutil/args/root.hh b/src/libutil/args/root.hh
index bb98732a1..f8124eaff 100644
--- a/src/libutil/args/root.hh
+++ b/src/libutil/args/root.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include "args.hh"
diff --git a/src/libutil/english.hh b/src/libutil/english.hh
index 9c6c93571..d9289c663 100644
--- a/src/libutil/english.hh
+++ b/src/libutil/english.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <iostream>
diff --git a/src/libutil/escape-char.hh b/src/libutil/escape-char.hh
index c7bae7ec0..e4b9da8ed 100644
--- a/src/libutil/escape-char.hh
+++ b/src/libutil/escape-char.hh
@@ -1,4 +1,6 @@
#pragma once
+///@file
+
#include <ostream>
namespace nix {
diff --git a/src/libutil/escape-string.hh b/src/libutil/escape-string.hh
index 7f0a9e701..2b06893dc 100644
--- a/src/libutil/escape-string.hh
+++ b/src/libutil/escape-string.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <limits>
#include <ostream>
diff --git a/src/libutil/exit.hh b/src/libutil/exit.hh
index 55f33e62f..27abc6a89 100644
--- a/src/libutil/exit.hh
+++ b/src/libutil/exit.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <exception>
diff --git a/src/libutil/print-elided.hh b/src/libutil/print-elided.hh
index a99b15ca1..21bbf741c 100644
--- a/src/libutil/print-elided.hh
+++ b/src/libutil/print-elided.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <ostream>
diff --git a/src/libutil/shlex.hh b/src/libutil/shlex.hh
index 4e7a48597..6ebe272ad 100644
--- a/src/libutil/shlex.hh
+++ b/src/libutil/shlex.hh
@@ -1,4 +1,5 @@
#pragma once
+///@file
#include <regex>
#include <string>
diff --git a/src/nix-channel/unpack-channel.nix b/src/nix-channel/unpack-channel.nix
index 10515bc8b..84e324a4d 100644
--- a/src/nix-channel/unpack-channel.nix
+++ b/src/nix-channel/unpack-channel.nix
@@ -1,4 +1,8 @@
-{ name, channelName, src }:
+{
+ name,
+ channelName,
+ src,
+}:
derivation {
builder = "builtin:unpack-channel";
diff --git a/src/nix-env/buildenv.nix b/src/nix-env/buildenv.nix
index 0bac4c44b..c8955a94e 100644
--- a/src/nix-env/buildenv.nix
+++ b/src/nix-env/buildenv.nix
@@ -8,13 +8,15 @@ derivation {
inherit manifest;
# !!! grmbl, need structured data for passing this in a clean way.
- derivations =
- map (d:
- [ (d.meta.active or "true")
- (d.meta.priority or 5)
- (builtins.length d.outputs)
- ] ++ map (output: builtins.getAttr output d) d.outputs)
- derivations;
+ derivations = map (
+ d:
+ [
+ (d.meta.active or "true")
+ (d.meta.priority or 5)
+ (builtins.length d.outputs)
+ ]
+ ++ map (output: builtins.getAttr output d) d.outputs
+ ) derivations;
# Building user environments remotely just causes huge amounts of
# network traffic, so don't do that.
diff --git a/src/nix/doctor.cc b/src/nix/doctor.cc
index 531f0ad86..da7a1d7a0 100644
--- a/src/nix/doctor.cc
+++ b/src/nix/doctor.cc
@@ -146,10 +146,9 @@ struct CmdDoctor : StoreCommand
void checkTrustedUser(ref<Store> store)
{
- std::string_view trusted = store->isTrustedClient()
- ? "trusted"
- : "not trusted";
- checkInfo(fmt("You are %s by store uri: %s", trusted, store->getUri()));
+ auto trustedMay = store->isTrustedClient();
+ std::string_view trustedness = trustedMay ? (*trustedMay ? "trusted" : "not trusted") : "unknown trust";
+ checkInfo(fmt("You are %s by store uri: %s", trustedness, store->getUri()));
}
};