···4041Additionally the following optional arguments can be given: `fetchSubmodules = true` makes `fetchgit` also fetch the submodules of a repository. If `deepClone` is set to true, the entire repository is cloned as opposing to just creating a shallow clone. `deepClone = true` also implies `leaveDotGit = true` which means that the `.git` directory of the clone won't be removed after checkout.
4200000000000000000043## `fetchfossil` {#fetchfossil}
4445Used with Fossil. Expects `url` to a Fossil archive, `rev`, and `sha256`.
···4041Additionally the following optional arguments can be given: `fetchSubmodules = true` makes `fetchgit` also fetch the submodules of a repository. If `deepClone` is set to true, the entire repository is cloned as opposing to just creating a shallow clone. `deepClone = true` also implies `leaveDotGit = true` which means that the `.git` directory of the clone won't be removed after checkout.
4243+If only parts of the repository are needed, `sparseCheckout` can be used. This will prevent git from fetching unnecessary blobs from server, see [git sparse-checkout](https://git-scm.com/docs/git-sparse-checkout) and [git clone --filter](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---filterltfilter-specgt) for more infomation:
44+45+```nix
46+{ stdenv, fetchgit }:
47+48+stdenv.mkDerivation {
49+ name = "hello";
50+ src = fetchgit {
51+ url = "https://...";
52+ sparseCheckout = ''
53+ path/to/be/included
54+ another/path
55+ '';
56+ sha256 = "0000000000000000000000000000000000000000000000000000";
57+ };
58+}
59+```
60+61## `fetchfossil` {#fetchfossil}
6263Used with Fossil. Expects `url` to a Fossil archive, `rev`, and `sha256`.
···172 else if all isInt list && all (x: x == head list) list then head list
173 else throw "Cannot merge definitions of `${showOption loc}'. Definition values:${showDefs defs}";
174175- mergeOneOption = loc: defs:
176- if defs == [] then abort "This case should never happen."
177- else if length defs != 1 then
178- throw "The unique option `${showOption loc}' is defined multiple times. Definition values:${showDefs defs}"
179- else (head defs).value;
00180181 /* "Merge" option definitions by checking that they all have the same value. */
182 mergeEqualOption = loc: defs:
···172 else if all isInt list && all (x: x == head list) list then head list
173 else throw "Cannot merge definitions of `${showOption loc}'. Definition values:${showDefs defs}";
174175+ mergeOneOption = mergeUniqueOption { message = ""; };
176+177+ mergeUniqueOption = { message }: loc: defs:
178+ if length defs == 1
179+ then (head defs).value
180+ else assert length defs > 1;
181+ throw "The option `${showOption loc}' is defined multiple times.\n${message}\nDefinition values:${showDefs defs}";
182183 /* "Merge" option definitions by checking that they all have the same value. */
184 mergeEqualOption = loc: defs:
+14-1
lib/types.nix
···32 last
33 length
34 tail
35- unique
36 ;
37 inherit (lib.attrsets)
38 attrNames
···48 mergeDefaultOption
49 mergeEqualOption
50 mergeOneOption
051 showFiles
52 showOption
53 ;
···470 nestedTypes.elemType = elemType;
471 };
472000000000000473 # Null or value of ...
474 nullOr = elemType: mkOptionType rec {
475 name = "nullOr";
···599 # A value from a set of allowed ones.
600 enum = values:
601 let
0602 show = v:
603 if builtins.isString v then ''"${v}"''
604 else if builtins.isInt v then builtins.toString v
···32 last
33 length
34 tail
035 ;
36 inherit (lib.attrsets)
37 attrNames
···47 mergeDefaultOption
48 mergeEqualOption
49 mergeOneOption
50+ mergeUniqueOption
51 showFiles
52 showOption
53 ;
···470 nestedTypes.elemType = elemType;
471 };
472473+ unique = { message }: type: mkOptionType rec {
474+ name = "unique";
475+ inherit (type) description check;
476+ merge = mergeUniqueOption { inherit message; };
477+ emptyValue = type.emptyValue;
478+ getSubOptions = type.getSubOptions;
479+ getSubModules = type.getSubModules;
480+ substSubModules = m: uniq (type.substSubModules m);
481+ functor = (defaultFunctor name) // { wrapped = type; };
482+ nestedTypes.elemType = type;
483+ };
484+485 # Null or value of ...
486 nullOr = elemType: mkOptionType rec {
487 name = "nullOr";
···611 # A value from a set of allowed ones.
612 enum = values:
613 let
614+ inherit (lib.lists) unique;
615 show = v:
616 if builtins.isString v then ''"${v}"''
617 else if builtins.isInt v then builtins.toString v
···250: Ensures that type *`t`* cannot be merged. It is used to ensure option
251 definitions are declared only once.
252000000253`types.either` *`t1 t2`*
254255: Type *`t1`* or type *`t2`*, e.g. `with types; either int str`.
···250: Ensures that type *`t`* cannot be merged. It is used to ensure option
251 definitions are declared only once.
252253+`types.unique` `{ message = m }` *`t`*
254+255+: Ensures that type *`t`* cannot be merged. Prints the message *`m`*, after
256+ the line `The option <option path> is defined multiple times.` and before
257+ a list of definition locations.
258+259`types.either` *`t1 t2`*
260261: Type *`t1`* or type *`t2`*, e.g. `with types; either int str`.
···498 </varlistentry>
499 <varlistentry>
500 <term>
501+ <literal>types.unique</literal>
502+ <literal>{ message = m }</literal>
503+ <emphasis><literal>t</literal></emphasis>
504+ </term>
505+ <listitem>
506+ <para>
507+ Ensures that type <emphasis><literal>t</literal></emphasis>
508+ cannot be merged. Prints the message
509+ <emphasis><literal>m</literal></emphasis>, after the line
510+ <literal>The option <option path> is defined multiple times.</literal>
511+ and before a list of definition locations.
512+ </para>
513+ </listitem>
514+ </varlistentry>
515+ <varlistentry>
516+ <term>
517 <literal>types.either</literal>
518 <emphasis><literal>t1 t2</literal></emphasis>
519 </term>
···109 utillinux = pkgs.util-linux;
110111 kernelParams = config.boot.kernelParams;
112- installBootLoader =
113- config.system.build.installBootLoader
114- or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
115 activationScript = config.system.activationScripts.script;
116 dryActivationScript = config.system.dryActivationScript;
117 nixosLabel = config.system.nixos.label;
···135 pkgs.replaceDependency { inherit oldDependency newDependency drv; }
136 ) baseSystemAssertWarn config.system.replaceRuntimeDependencies;
1370000000000138in
139140{
141 imports = [
0142 (mkRemovedOptionModule [ "nesting" "clone" ] "Use `specialisation.«name» = { inheritParentConfig = true; configuration = { ... }; }` instead.")
143 (mkRemovedOptionModule [ "nesting" "children" ] "Use `specialisation.«name».configuration = { ... }` instead.")
144 ];
145146 options = {
147-148- system.build = mkOption {
149- internal = true;
150- default = {};
151- type = with types; lazyAttrsOf (uniq unspecified);
152- description = ''
153- Attribute set of derivations used to setup the system.
154- '';
155- };
156157 specialisation = mkOption {
158 default = {};
···223 Name of the initrd file to be passed to the bootloader.
224 '';
225 };
000000000000000000000000000000000226227 system.copySystemConfiguration = mkOption {
228 type = types.bool;
···109 utillinux = pkgs.util-linux;
110111 kernelParams = config.boot.kernelParams;
112+ installBootLoader = config.system.build.installBootLoader;
00113 activationScript = config.system.activationScripts.script;
114 dryActivationScript = config.system.dryActivationScript;
115 nixosLabel = config.system.nixos.label;
···133 pkgs.replaceDependency { inherit oldDependency newDependency drv; }
134 ) baseSystemAssertWarn config.system.replaceRuntimeDependencies;
135136+ /* Workaround until https://github.com/NixOS/nixpkgs/pull/156533
137+ Call can be replaced by argument when that's merged.
138+ */
139+ tmpFixupSubmoduleBoundary = subopts:
140+ lib.mkOption {
141+ type = lib.types.submoduleWith {
142+ modules = [ { options = subopts; } ];
143+ };
144+ };
145+146in
147148{
149 imports = [
150+ ../build.nix
151 (mkRemovedOptionModule [ "nesting" "clone" ] "Use `specialisation.«name» = { inheritParentConfig = true; configuration = { ... }; }` instead.")
152 (mkRemovedOptionModule [ "nesting" "children" ] "Use `specialisation.«name».configuration = { ... }` instead.")
153 ];
154155 options = {
000000000156157 specialisation = mkOption {
158 default = {};
···223 Name of the initrd file to be passed to the bootloader.
224 '';
225 };
226+227+ system.build = tmpFixupSubmoduleBoundary {
228+ installBootLoader = mkOption {
229+ internal = true;
230+ # "; true" => make the `$out` argument from switch-to-configuration.pl
231+ # go to `true` instead of `echo`, hiding the useless path
232+ # from the log.
233+ default = "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
234+ description = ''
235+ A program that writes a bootloader installation script to the path passed in the first command line argument.
236+237+ See <literal>nixos/modules/system/activation/switch-to-configuration.pl</literal>.
238+ '';
239+ type = types.unique {
240+ message = ''
241+ Only one bootloader can be enabled at a time. This requirement has not
242+ been checked until NixOS 22.05. Earlier versions defaulted to the last
243+ definition. Change your configuration to enable only one bootloader.
244+ '';
245+ } (types.either types.str types.package);
246+ };
247+248+ toplevel = mkOption {
249+ type = types.package;
250+ readOnly = true;
251+ description = ''
252+ This option contains the store path that typically represents a NixOS system.
253+254+ You can read this path in a custom deployment tool for example.
255+ '';
256+ };
257+ };
258+259260 system.copySystemConfiguration = mkOption {
261 type = types.bool;
+21
nixos/modules/system/build.nix
···000000000000000000000
···1+{ lib, ... }:
2+let
3+ inherit (lib) mkOption types;
4+in
5+{
6+ options = {
7+8+ system.build = mkOption {
9+ default = {};
10+ description = ''
11+ Attribute set of derivations used to set up the system.
12+ '';
13+ type = types.submoduleWith {
14+ modules = [{
15+ freeformType = with types; lazyAttrsOf (uniq unspecified);
16+ }];
17+ };
18+ };
19+20+ };
21+}
+1-1
nixos/tests/mpd.nix
···96 };
9798 testScript = ''
99- mpc = "${pkgs.mpc_cli}/bin/mpc --wait"
100101 # Connects to the given server and attempts to play a tune.
102 def play_some_music(server):
···96 };
9798 testScript = ''
99+ mpc = "${pkgs.mpc-cli}/bin/mpc --wait"
100101 # Connects to the given server and attempts to play a tune.
102 def play_some_music(server):
+19-6
pkgs/applications/audio/clerk/default.nix
···3, fetchFromGitHub
4, makeWrapper
5, rofi
6-, mpc_cli
7, perl
8, util-linux
9, python3Packages
···2829 strictDeps = true;
3031- installPhase = ''
32- DESTDIR=$out PREFIX=/ make install
33- wrapProgram $out/bin/clerk \
34- --prefix PATH : "${lib.makeBinPath [ rofi mpc_cli perl util-linux libnotify ]}"
35- '';
00000000000003637 meta = with lib; {
38 description = "An MPD client built on top of rofi";
···3, fetchFromGitHub
4, makeWrapper
5, rofi
6+, mpc-cli
7, perl
8, util-linux
9, python3Packages
···2829 strictDeps = true;
3031+ installPhase =
32+ let
33+ binPath = lib.makeBinPath [
34+ libnotify
35+ mpc-cli
36+ perl
37+ rofi
38+ util-linux
39+ ];
40+ in
41+ ''
42+ runHook preInstall
43+44+ DESTDIR=$out PREFIX=/ make install
45+ wrapProgram $out/bin/clerk --prefix PATH : "${binPath}"
46+47+ runHook postInstall
48+ '';
4950 meta = with lib; {
51 description = "An MPD client built on top of rofi";
···1-commit 6aea54d2ad2287b3e8894c262ee895f3d4a60516
2-Author: André Draszik <git@andred.net>
3-Date: Mon Oct 17 12:45:32 2016 +0100
4-5- evmctl: use correct include for xattr.h
6-7- The xattr API/ABI is provided by both the c-library, as well as by the
8- libattr package. The c-library's header file is sys/xattr.h, whereas
9- libattr's header file can be found in attr/xattr.h.
10-11- Given none of the code here *links* against the libattr.so shared library, it
12- is wrong to *compile* against libattr's API (header file).
13-14- Doing so avoids confusion as to which xattr.h is used as the least problem,
15- and potential ABI differences as the worst problem due the mismatching header
16- file used.
17-18- So make sure we compile and link against the same thing, the c-library in
19- both cases.
20-21- Signed-off-by: André Draszik <git@andred.net>
22- Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
23-24-diff --git a/configure.ac b/configure.ac
25-index 0497eb7..a5b4288 100644
26---- a/configure.ac
27-+++ b/configure.ac
28-@@ -30,7 +30,7 @@ AC_SUBST(OPENSSL_LIBS)
29- AC_CHECK_HEADER(unistd.h)
30- AC_CHECK_HEADERS(openssl/conf.h)
31-32--AC_CHECK_HEADERS(attr/xattr.h, , [AC_MSG_ERROR([attr/xattr.h header not found. You need the libattr development package.])])
33-+AC_CHECK_HEADERS(sys/xattr.h, , [AC_MSG_ERROR([sys/xattr.h header not found. You need the c-library development package.])])
34- AC_CHECK_HEADERS(keyutils.h, , [AC_MSG_ERROR([keyutils.h header not found. You need the libkeyutils development package.])])
35-36- #debug support - yes for a while
37-diff --git a/packaging/ima-evm-utils.spec b/packaging/ima-evm-utils.spec
38-index a11a27a..63388d2 100644
39---- a/packaging/ima-evm-utils.spec
40-+++ b/packaging/ima-evm-utils.spec
41-@@ -11,7 +11,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
42- BuildRequires: autoconf
43- BuildRequires: automake
44- BuildRequires: openssl-devel
45--BuildRequires: libattr-devel
46- BuildRequires: keyutils-libs-devel
47-48- %description
49-diff --git a/packaging/ima-evm-utils.spec.in b/packaging/ima-evm-utils.spec.in
50-index 7ca6c6f..65c32f9 100644
51---- a/packaging/ima-evm-utils.spec.in
52-+++ b/packaging/ima-evm-utils.spec.in
53-@@ -11,7 +11,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
54- BuildRequires: autoconf
55- BuildRequires: automake
56- BuildRequires: openssl-devel
57--BuildRequires: libattr-devel
58- BuildRequires: keyutils-libs-devel
59-60- %description
61-diff --git a/src/evmctl.c b/src/evmctl.c
62-index 2ffee78..3fbcd33 100644
63---- a/src/evmctl.c
64-+++ b/src/evmctl.c
65-@@ -49,7 +49,7 @@
66- #include <stdint.h>
67- #include <string.h>
68- #include <dirent.h>
69--#include <attr/xattr.h>
70-+#include <sys/xattr.h>
71- #include <linux/xattr.h>
72- #include <getopt.h>
73- #include <keyutils.h>