···40404141Additionally 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.
42424343+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:
4444+4545+```nix
4646+{ stdenv, fetchgit }:
4747+4848+stdenv.mkDerivation {
4949+ name = "hello";
5050+ src = fetchgit {
5151+ url = "https://...";
5252+ sparseCheckout = ''
5353+ path/to/be/included
5454+ another/path
5555+ '';
5656+ sha256 = "0000000000000000000000000000000000000000000000000000";
5757+ };
5858+}
5959+```
6060+4361## `fetchfossil` {#fetchfossil}
44624563Used with Fossil. Expects `url` to a Fossil archive, `rev`, and `sha256`.
···172172 else if all isInt list && all (x: x == head list) list then head list
173173 else throw "Cannot merge definitions of `${showOption loc}'. Definition values:${showDefs defs}";
174174175175- mergeOneOption = loc: defs:
176176- if defs == [] then abort "This case should never happen."
177177- else if length defs != 1 then
178178- throw "The unique option `${showOption loc}' is defined multiple times. Definition values:${showDefs defs}"
179179- else (head defs).value;
175175+ mergeOneOption = mergeUniqueOption { message = ""; };
176176+177177+ mergeUniqueOption = { message }: loc: defs:
178178+ if length defs == 1
179179+ then (head defs).value
180180+ else assert length defs > 1;
181181+ throw "The option `${showOption loc}' is defined multiple times.\n${message}\nDefinition values:${showDefs defs}";
180182181183 /* "Merge" option definitions by checking that they all have the same value. */
182184 mergeEqualOption = loc: defs:
+14-1
lib/types.nix
···3232 last
3333 length
3434 tail
3535- unique
3635 ;
3736 inherit (lib.attrsets)
3837 attrNames
···4847 mergeDefaultOption
4948 mergeEqualOption
5049 mergeOneOption
5050+ mergeUniqueOption
5151 showFiles
5252 showOption
5353 ;
···470470 nestedTypes.elemType = elemType;
471471 };
472472473473+ unique = { message }: type: mkOptionType rec {
474474+ name = "unique";
475475+ inherit (type) description check;
476476+ merge = mergeUniqueOption { inherit message; };
477477+ emptyValue = type.emptyValue;
478478+ getSubOptions = type.getSubOptions;
479479+ getSubModules = type.getSubModules;
480480+ substSubModules = m: uniq (type.substSubModules m);
481481+ functor = (defaultFunctor name) // { wrapped = type; };
482482+ nestedTypes.elemType = type;
483483+ };
484484+473485 # Null or value of ...
474486 nullOr = elemType: mkOptionType rec {
475487 name = "nullOr";
···599611 # A value from a set of allowed ones.
600612 enum = values:
601613 let
614614+ inherit (lib.lists) unique;
602615 show = v:
603616 if builtins.isString v then ''"${v}"''
604617 else if builtins.isInt v then builtins.toString v
···250250: Ensures that type *`t`* cannot be merged. It is used to ensure option
251251 definitions are declared only once.
252252253253+`types.unique` `{ message = m }` *`t`*
254254+255255+: Ensures that type *`t`* cannot be merged. Prints the message *`m`*, after
256256+ the line `The option <option path> is defined multiple times.` and before
257257+ a list of definition locations.
258258+253259`types.either` *`t1 t2`*
254260255261: Type *`t1`* or type *`t2`*, e.g. `with types; either int str`.
···498498 </varlistentry>
499499 <varlistentry>
500500 <term>
501501+ <literal>types.unique</literal>
502502+ <literal>{ message = m }</literal>
503503+ <emphasis><literal>t</literal></emphasis>
504504+ </term>
505505+ <listitem>
506506+ <para>
507507+ Ensures that type <emphasis><literal>t</literal></emphasis>
508508+ cannot be merged. Prints the message
509509+ <emphasis><literal>m</literal></emphasis>, after the line
510510+ <literal>The option <option path> is defined multiple times.</literal>
511511+ and before a list of definition locations.
512512+ </para>
513513+ </listitem>
514514+ </varlistentry>
515515+ <varlistentry>
516516+ <term>
501517 <literal>types.either</literal>
502518 <emphasis><literal>t1 t2</literal></emphasis>
503519 </term>
···109109 utillinux = pkgs.util-linux;
110110111111 kernelParams = config.boot.kernelParams;
112112- installBootLoader =
113113- config.system.build.installBootLoader
114114- or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
112112+ installBootLoader = config.system.build.installBootLoader;
115113 activationScript = config.system.activationScripts.script;
116114 dryActivationScript = config.system.dryActivationScript;
117115 nixosLabel = config.system.nixos.label;
···135133 pkgs.replaceDependency { inherit oldDependency newDependency drv; }
136134 ) baseSystemAssertWarn config.system.replaceRuntimeDependencies;
137135136136+ /* Workaround until https://github.com/NixOS/nixpkgs/pull/156533
137137+ Call can be replaced by argument when that's merged.
138138+ */
139139+ tmpFixupSubmoduleBoundary = subopts:
140140+ lib.mkOption {
141141+ type = lib.types.submoduleWith {
142142+ modules = [ { options = subopts; } ];
143143+ };
144144+ };
145145+138146in
139147140148{
141149 imports = [
150150+ ../build.nix
142151 (mkRemovedOptionModule [ "nesting" "clone" ] "Use `specialisation.«name» = { inheritParentConfig = true; configuration = { ... }; }` instead.")
143152 (mkRemovedOptionModule [ "nesting" "children" ] "Use `specialisation.«name».configuration = { ... }` instead.")
144153 ];
145154146155 options = {
147147-148148- system.build = mkOption {
149149- internal = true;
150150- default = {};
151151- type = with types; lazyAttrsOf (uniq unspecified);
152152- description = ''
153153- Attribute set of derivations used to setup the system.
154154- '';
155155- };
156156157157 specialisation = mkOption {
158158 default = {};
···223223 Name of the initrd file to be passed to the bootloader.
224224 '';
225225 };
226226+227227+ system.build = tmpFixupSubmoduleBoundary {
228228+ installBootLoader = mkOption {
229229+ internal = true;
230230+ # "; true" => make the `$out` argument from switch-to-configuration.pl
231231+ # go to `true` instead of `echo`, hiding the useless path
232232+ # from the log.
233233+ default = "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
234234+ description = ''
235235+ A program that writes a bootloader installation script to the path passed in the first command line argument.
236236+237237+ See <literal>nixos/modules/system/activation/switch-to-configuration.pl</literal>.
238238+ '';
239239+ type = types.unique {
240240+ message = ''
241241+ Only one bootloader can be enabled at a time. This requirement has not
242242+ been checked until NixOS 22.05. Earlier versions defaulted to the last
243243+ definition. Change your configuration to enable only one bootloader.
244244+ '';
245245+ } (types.either types.str types.package);
246246+ };
247247+248248+ toplevel = mkOption {
249249+ type = types.package;
250250+ readOnly = true;
251251+ description = ''
252252+ This option contains the store path that typically represents a NixOS system.
253253+254254+ You can read this path in a custom deployment tool for example.
255255+ '';
256256+ };
257257+ };
258258+226259227260 system.copySystemConfiguration = mkOption {
228261 type = types.bool;
+21
nixos/modules/system/build.nix
···11+{ lib, ... }:
22+let
33+ inherit (lib) mkOption types;
44+in
55+{
66+ options = {
77+88+ system.build = mkOption {
99+ default = {};
1010+ description = ''
1111+ Attribute set of derivations used to set up the system.
1212+ '';
1313+ type = types.submoduleWith {
1414+ modules = [{
1515+ freeformType = with types; lazyAttrsOf (uniq unspecified);
1616+ }];
1717+ };
1818+ };
1919+2020+ };
2121+}
+1-1
nixos/tests/mpd.nix
···9696 };
97979898 testScript = ''
9999- mpc = "${pkgs.mpc_cli}/bin/mpc --wait"
9999+ mpc = "${pkgs.mpc-cli}/bin/mpc --wait"
100100101101 # Connects to the given server and attempts to play a tune.
102102 def play_some_music(server):
···11-commit 6aea54d2ad2287b3e8894c262ee895f3d4a60516
22-Author: André Draszik <git@andred.net>
33-Date: Mon Oct 17 12:45:32 2016 +0100
44-55- evmctl: use correct include for xattr.h
66-77- The xattr API/ABI is provided by both the c-library, as well as by the
88- libattr package. The c-library's header file is sys/xattr.h, whereas
99- libattr's header file can be found in attr/xattr.h.
1010-1111- Given none of the code here *links* against the libattr.so shared library, it
1212- is wrong to *compile* against libattr's API (header file).
1313-1414- Doing so avoids confusion as to which xattr.h is used as the least problem,
1515- and potential ABI differences as the worst problem due the mismatching header
1616- file used.
1717-1818- So make sure we compile and link against the same thing, the c-library in
1919- both cases.
2020-2121- Signed-off-by: André Draszik <git@andred.net>
2222- Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
2323-2424-diff --git a/configure.ac b/configure.ac
2525-index 0497eb7..a5b4288 100644
2626---- a/configure.ac
2727-+++ b/configure.ac
2828-@@ -30,7 +30,7 @@ AC_SUBST(OPENSSL_LIBS)
2929- AC_CHECK_HEADER(unistd.h)
3030- AC_CHECK_HEADERS(openssl/conf.h)
3131-3232--AC_CHECK_HEADERS(attr/xattr.h, , [AC_MSG_ERROR([attr/xattr.h header not found. You need the libattr development package.])])
3333-+AC_CHECK_HEADERS(sys/xattr.h, , [AC_MSG_ERROR([sys/xattr.h header not found. You need the c-library development package.])])
3434- AC_CHECK_HEADERS(keyutils.h, , [AC_MSG_ERROR([keyutils.h header not found. You need the libkeyutils development package.])])
3535-3636- #debug support - yes for a while
3737-diff --git a/packaging/ima-evm-utils.spec b/packaging/ima-evm-utils.spec
3838-index a11a27a..63388d2 100644
3939---- a/packaging/ima-evm-utils.spec
4040-+++ b/packaging/ima-evm-utils.spec
4141-@@ -11,7 +11,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
4242- BuildRequires: autoconf
4343- BuildRequires: automake
4444- BuildRequires: openssl-devel
4545--BuildRequires: libattr-devel
4646- BuildRequires: keyutils-libs-devel
4747-4848- %description
4949-diff --git a/packaging/ima-evm-utils.spec.in b/packaging/ima-evm-utils.spec.in
5050-index 7ca6c6f..65c32f9 100644
5151---- a/packaging/ima-evm-utils.spec.in
5252-+++ b/packaging/ima-evm-utils.spec.in
5353-@@ -11,7 +11,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
5454- BuildRequires: autoconf
5555- BuildRequires: automake
5656- BuildRequires: openssl-devel
5757--BuildRequires: libattr-devel
5858- BuildRequires: keyutils-libs-devel
5959-6060- %description
6161-diff --git a/src/evmctl.c b/src/evmctl.c
6262-index 2ffee78..3fbcd33 100644
6363---- a/src/evmctl.c
6464-+++ b/src/evmctl.c
6565-@@ -49,7 +49,7 @@
6666- #include <stdint.h>
6767- #include <string.h>
6868- #include <dirent.h>
6969--#include <attr/xattr.h>
7070-+#include <sys/xattr.h>
7171- #include <linux/xattr.h>
7272- #include <getopt.h>
7373- #include <keyutils.h>