Nix
2.26.3
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
fetch-settings.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
types.hh
"
5
#include "
config.hh
"
6
7
#include <map>
8
#include <limits>
9
10
#include <sys/types.h>
11
12
namespace
nix::fetchers {
13
14
struct
Settings :
public
Config
15
{
16
Settings();
17
18
Setting<StringMap>
accessTokens{
this
, {},
"access-tokens"
,
19
R
"(
20
Access tokens used to access protected GitHub, GitLab, or
21
other locations requiring token-based authentication.
22
23
Access tokens are specified as a string made up of
24
space-separated `host=token` values. The specific token
25
used is selected by matching the `host` portion against the
26
"host" specification of the input. The actual use of the
27
`token` value is determined by the type of resource being
28
accessed:
29
30
* Github: the token value is the OAUTH-TOKEN string obtained
31
as the Personal Access Token from the Github server (see
32
https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps).
33
34
* Gitlab: the token value is either the OAuth2 token or the
35
Personal Access Token (these are different types tokens
36
for gitlab, see
37
https://docs.gitlab.com/12.10/ee/api/README.html#authentication).
38
The `token` value should be `type:tokenstring` where
39
`type` is either `OAuth2` or `PAT` to indicate which type
40
of token is being specified.
41
42
Example `~/.config/nix/nix.conf`:
43
44
```
45
access-tokens = github.com=23ac...b289 gitlab.mycompany.com=PAT:A123Bp_Cd..EfG gitlab.com=OAuth2:1jklw3jk
46
```
47
48
Example `~/code/flake.nix`:
49
50
```nix
51
input.foo = {
52
type = "gitlab";
53
host = "gitlab.mycompany.com";
54
owner = "mycompany";
55
repo = "pro";
56
};
57
```
58
59
This example specifies three tokens, one each for accessing
60
github.com, gitlab.mycompany.com, and gitlab.com.
61
62
The `input.foo` uses the "gitlab" fetcher, which might
63
requires specifying the token type along with the token
64
value.
65
)"};
66
67
Setting<bool>
allowDirty{
this
,
true
,
"allow-dirty"
,
68
"Whether to allow dirty Git/Mercurial trees."
};
69
70
Setting<bool>
warnDirty{
this
,
true
,
"warn-dirty"
,
71
"Whether to warn about dirty Git/Mercurial trees."
};
72
73
Setting<bool>
allowDirtyLocks{
74
this
,
75
false
,
76
"allow-dirty-locks"
,
77
R
"(
78
Whether to allow dirty inputs (such as dirty Git workdirs)
79
to be locked via their NAR hash. This is generally bad
80
practice since Nix has no way to obtain such inputs if they
81
are subsequently modified. Therefore lock files with dirty
82
locks should generally only be used for local testing, and
83
should not be pushed to other users.
84
)",
85
{},
86
true
,
87
Xp::Flakes};
88
89
Setting<bool>
trustTarballsFromGitForges{
90
this
,
true
,
"trust-tarballs-from-git-forges"
,
91
R
"(
92
If enabled (the default), Nix will consider tarballs from
93
GitHub and similar Git forges to be locked if a Git revision
94
is specified,
95
e.g. `github:NixOS/patchelf/7c2f768bf9601268a4e71c2ebe91e2011918a70f`.
96
This requires Nix to trust that the provider will return the
97
correct contents for the specified Git revision.
98
99
If disabled, such tarballs are only considered locked if a
100
`narHash` attribute is specified,
101
e.g. `github:NixOS/patchelf/7c2f768bf9601268a4e71c2ebe91e2011918a70f?narHash=sha256-PPXqKY2hJng4DBVE0I4xshv/vGLUskL7jl53roB8UdU%3D`.
102
)"};
103
104
Setting<std::string>
flakeRegistry{
this
,
"https://channels.nixos.org/flake-registry.json"
,
"flake-registry"
,
105
R
"(
106
Path or URI of the global flake registry.
107
108
When empty, disables the global flake registry.
109
)",
110
{},
true
, Xp::Flakes};
111
};
112
113
}
nix::Setting
Definition
config.hh:320
config.hh
types.hh
src
libfetchers
fetch-settings.hh
Generated by
1.13.2