···14 config = mkIf config.programs.partition-manager.enable {
15 services.dbus.packages = [ pkgs.libsForQt5.kpmcore ];
16 # `kpmcore` need to be installed to pull in polkit actions.
17- environment.systemPackages = [ pkgs.libsForQt5.kpmcore pkgs.partition-manager ];
18 };
19}
···14 config = mkIf config.programs.partition-manager.enable {
15 services.dbus.packages = [ pkgs.libsForQt5.kpmcore ];
16 # `kpmcore` need to be installed to pull in polkit actions.
17+ environment.systemPackages = [ pkgs.libsForQt5.kpmcore pkgs.libsForQt5.partitionmanager ];
18 };
19}
+2-2
nixos/modules/tasks/filesystems/bcachefs.nix
···123 inherit assertions;
124 # needed for systemd-remount-fs
125 system.fsPackages = [ pkgs.bcachefs-tools ];
126- # FIXME: Replace this with `linuxPackages_latest` when 6.7 is released, remove this line when the LTS version is at least 6.7
127- boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_testing;
128 systemd.services = lib.mapAttrs' (mkUnits "") (lib.filterAttrs (n: fs: (fs.fsType == "bcachefs") && (!utils.fsNeededForBoot fs)) config.fileSystems);
129 }
130
···123 inherit assertions;
124 # needed for systemd-remount-fs
125 system.fsPackages = [ pkgs.bcachefs-tools ];
126+ # FIXME: Remove this line when the default kernel has bcachefs
127+ boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
128 systemd.services = lib.mapAttrs' (mkUnits "") (lib.filterAttrs (n: fs: (fs.fsType == "bcachefs") && (!utils.fsNeededForBoot fs)) config.fileSystems);
129 }
130
···71 description = "A graphical Git client designed to help you understand and manage your source code history";
72 homepage = "https://murmele.github.io/Gittyup";
73 license = with licenses; [ mit ];
74- maintainers = with maintainers; [ thiagokokada ];
75 platforms = platforms.unix;
76 broken = stdenv.isDarwin;
77 };
···71 description = "A graphical Git client designed to help you understand and manage your source code history";
72 homepage = "https://murmele.github.io/Gittyup";
73 license = with licenses; [ mit ];
74+ maintainers = with maintainers; [ ];
75 platforms = platforms.unix;
76 broken = stdenv.isDarwin;
77 };
+227-202
pkgs/build-support/trivial-builders/default.nix
···910rec {
1112- /* Run the shell command `buildCommand' to produce a store path named
13- `name'. The attributes in `env' are added to the environment
14- prior to running the command. By default `runCommand` runs in a
15- stdenv with no compiler environment. `runCommandCC` uses the default
16- stdenv, `pkgs.stdenv`.
1718- Example:
019002021- runCommand "name" {envVariable = true;} ''echo hello > $out''
22- runCommandCC "name" {} ''gcc -o myfile myfile.c; cp myfile $out'';
230002425- The `*Local` variants force a derivation to be built locally,
26- it is not substituted.
02728- This is intended for very cheap commands (<1s execution time).
29- It saves on the network roundrip and can speed up a build.
3031- It is the same as adding the special fields
03233- `preferLocalBuild = true;`
34- `allowSubstitutes = false;`
3536- to a derivation’s attributes.
000000037 */
38 runCommand = name: env: runCommandWith {
39 stdenv = stdenvNoCC;
···57 # `runCommandCCLocal` left out on purpose.
58 # We shouldn’t force the user to have a cc in scope.
5960- /* Generalized version of the `runCommand`-variants
061 which does customized behavior via a single
62 attribute set passed as the first argument
63 instead of having a lot of variants like
···72 defaultStdenv = stdenv;
73 in
74 {
75- # which stdenv to use, defaults to a stdenv with a C compiler, pkgs.stdenv
76 stdenv ? defaultStdenv
77- # whether to build this derivation locally instead of substituting
78 , runLocal ? false
79- # extra arguments to pass to stdenv.mkDerivation
80- , derivationArgs ? {}
81- # name of the resulting derivation
82 , name
83- # TODO(@Artturin): enable strictDeps always
84 }: buildCommand:
85- stdenv.mkDerivation ({
86- enableParallelBuilding = true;
87- inherit buildCommand name;
88- passAsFile = [ "buildCommand" ]
89- ++ (derivationArgs.passAsFile or []);
90- }
91- // lib.optionalAttrs (! derivationArgs?meta) {
92- pos = let args = builtins.attrNames derivationArgs; in
93- if builtins.length args > 0
94- then builtins.unsafeGetAttrPos (builtins.head args) derivationArgs
95- else null;
96- }
97- // (lib.optionalAttrs runLocal {
98- preferLocalBuild = true;
99- allowSubstitutes = false;
100- })
101- // builtins.removeAttrs derivationArgs [ "passAsFile" ]);
102103104- /* Writes a text file to the nix store.
0105 The contents of text is added to the file in the store.
106107 Example:
···145 matches = builtins.match "/bin/([^/]+)" destination;
146 in
147 runCommand name
148- { inherit text executable checkPhase allowSubstitutes preferLocalBuild;
0149 passAsFile = [ "text" ];
150- meta = lib.optionalAttrs (executable && matches != null) {
151- mainProgram = lib.head matches;
152- } // meta;
0153 }
154 ''
155 target=$out${lib.escapeShellArg destination}
···169 '';
170171 /*
172- Writes a text file to nix store with no optional parameters available.
173174- Example:
175176177- # Writes contents of file to /nix/store/<store path>
178- writeText "my-file"
179 ''
180 Contents of File
181 '';
182183184 */
185- writeText = name: text: writeTextFile {inherit name text;};
186187 /*
188 Writes a text file to nix store in a specific directory with no
···224225226 */
227- writeScript = name: text: writeTextFile {inherit name text; executable = true;};
228229 /*
230 Writes a text file to /nix/store/<store path>/bin/<name> and
···270 text = ''
271 #!${runtimeShell}
272 ${text}
273- '';
274 checkPhase = ''
275 ${stdenv.shellDryRun} "$target"
276 '';
···292293294 */
295- writeShellScriptBin = name : text :
296 writeTextFile {
297 inherit name;
298 executable = true;
···300 text = ''
301 #!${runtimeShell}
302 ${text}
303- '';
304 checkPhase = ''
305 ${stdenv.shellDryRun} "$target"
306 '';
···340 , runtimeInputs ? [ ]
341 , meta ? { }
342 , checkPhase ? null
343- , excludeShellChecks ? [ ]
344 }:
345 writeTextFile {
346 inherit name meta;
···366 # but we still want to use writeShellApplication on those platforms
367 let
368 shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck-minimal.compiler;
369- excludeOption = lib.optionalString (excludeShellChecks != [ ]) "--exclude '${lib.concatStringsSep "," excludeShellChecks}'";
370 shellcheckCommand = lib.optionalString shellcheckSupported ''
371 # use shellcheck which does not include docs
372 # pandoc takes long to build and documentation isn't needed for just running the cli
···385 # Create a C binary
386 writeCBin = pname: code:
387 runCommandCC pname
388- {
389- inherit pname code;
390- executable = true;
391- passAsFile = ["code"];
392- # Pointless to do this on a remote machine.
393- preferLocalBuild = true;
394- allowSubstitutes = false;
395- meta = {
396- mainProgram = pname;
397- };
398- }
399- ''
400- n=$out/bin/${pname}
401- mkdir -p "$(dirname "$n")"
402- mv "$codePath" code.c
403- $CC -x c code.c -o "$n"
404- '';
405406407 /* concat a list of files to the nix store.
···532 */
533 symlinkJoin =
534 args_@{ name
535- , paths
536- , preferLocalBuild ? true
537- , allowSubstitutes ? false
538- , postBuild ? ""
539- , ...
540- }:
541 let
542 args = removeAttrs args_ [ "name" "postBuild" ]
543 // {
544- inherit preferLocalBuild allowSubstitutes;
545- passAsFile = [ "paths" ];
546- }; # pass the defaults
547- in runCommand name args
0548 ''
549 mkdir -p $out
550 for i in $(cat $pathsPath); do
···584 See the note on symlinkJoin for the difference between linkFarm and symlinkJoin.
585 */
586 linkFarm = name: entries:
587- let
588- entries' =
589- if (lib.isAttrs entries) then entries
590- # We do this foldl to have last-wins semantics in case of repeated entries
591- else if (lib.isList entries) then lib.foldl (a: b: a // { "${b.name}" = b.path; }) { } entries
592- else throw "linkFarm entries must be either attrs or a list!";
593594- linkCommands = lib.mapAttrsToList (name: path: ''
595- mkdir -p "$(dirname ${lib.escapeShellArg "${name}"})"
596- ln -s ${lib.escapeShellArg "${path}"} ${lib.escapeShellArg "${name}"}
597- '') entries';
598- in
599- runCommand name {
600- preferLocalBuild = true;
601- allowSubstitutes = false;
602- passthru.entries = entries';
603- } ''
604- mkdir -p $out
605- cd $out
606- ${lib.concatStrings linkCommands}
607- '';
000608609 /*
610 Easily create a linkFarm from a set of derivations.
···639 bin output and other contents of the package's output (e.g. setup
640 hooks) cause trouble when used in your environment.
641 */
642- onlyBin = drv: runCommand "${drv.name}-only-bin" {} ''
643 mkdir -p $out
644 ln -s ${lib.getBin drv}/bin $out/bin
645 '';
···675 # TODO 2023-01, no backport: simplify to inherit passthru;
676 passthru = passthru
677 // optionalAttrs (substitutions?passthru)
678- (warn "makeSetupHook (name = ${lib.strings.escapeNixString name}): `substitutions.passthru` is deprecated. Please set `passthru` directly."
679- substitutions.passthru);
680 })
681 (''
682 mkdir -p $out/nix-support
683 cp ${script} $out/nix-support/setup-hook
684 recordPropagatedDependencies
685- '' + lib.optionalString (substitutions != {}) ''
686 substituteAll ${script} $out/nix-support/setup-hook
687 '');
688···691692 writeReferencesToFile = path: runCommand "runtime-deps"
693 {
694- exportReferencesGraph = ["graph" path];
695 }
696 ''
697 touch $out
···710 */
711 writeDirectReferencesToFile = path: runCommand "runtime-references"
712 {
713- exportReferencesGraph = ["graph" path];
714 inherit path;
715 }
716 ''
···744 */
745 writeStringReferencesToFile = string:
746 /*
747- The basic operation this performs is to copy the string context
748- from `string' to a second string and wrap that string in a
749- derivation. However, that alone is not enough, since nothing in the
750- string refers to the output paths of the derivations/paths in its
751- context, meaning they'll be considered build-time dependencies and
752- removed from the wrapper derivation's closure. Putting the
753- necessary output paths in the new string is however not very
754- straightforward - the attrset returned by `getContext' contains
755- only references to derivations' .drv-paths, not their output
756- paths. In order to "convert" them, we try to extract the
757- corresponding paths from the original string using regex.
758 */
759 let
760 # Taken from https://github.com/NixOS/nix/blob/130284b8508dad3c70e8160b15f3d62042fc730a/src/libutil/hash.cc#L84
···798 if lib.elem "out" value.outputs then
799 lib.filter
800 (x: lib.isList x &&
801- # If the matched path is in `namedOutputPaths`,
802- # it's a partial match of an output path where
803- # the output name isn't `out`
804- lib.all (o: !lib.hasPrefix (lib.head x) o) namedOutputPaths)
805 (builtins.split "(${builtins.storeDir}/[${nixHashChars}]+-${name})" string)
806 else
807- [])
808 packages);
809 allPaths = lib.concatStringsSep "\n" (lib.unique (sources ++ namedOutputPaths ++ outputPaths));
810 allPathsWithContext = builtins.appendContext allPaths context;
811 in
812- if builtins ? getContext then
813- writeText "string-references" allPathsWithContext
814- else
815- writeDirectReferencesToFile (writeText "string-file" string);
816817818 /* Print an error message if the file with the specified name and
···830 }
831832 */
833- requireFile = { name ? null
834- , sha256 ? null
835- , sha1 ? null
836- , hash ? null
837- , url ? null
838- , message ? null
839- , hashMode ? "flat"
840- } :
841- assert (message != null) || (url != null);
842- assert (sha256 != null) || (sha1 != null) || (hash != null);
843- assert (name != null) || (url != null);
844- let msg =
845- if message != null then message
846- else ''
847- Unfortunately, we cannot download file ${name_} automatically.
848- Please go to ${url} to download it yourself, and add it to the Nix store
849- using either
850- nix-store --add-fixed ${hashAlgo} ${name_}
851- or
852- nix-prefetch-url --type ${hashAlgo} file:///path/to/${name_}
853- '';
854- hashAlgo = if hash != null then (builtins.head (lib.strings.splitString "-" hash))
855- else if sha256 != null then "sha256"
856- else "sha1";
857- hashAlgo_ = if hash != null then "" else hashAlgo;
858- hash_ = if hash != null then hash
859- else if sha256 != null then sha256
860- else sha1;
861- name_ = if name == null then baseNameOf (toString url) else name;
862- in
863- stdenvNoCC.mkDerivation {
864- name = name_;
865- outputHashMode = hashMode;
866- outputHashAlgo = hashAlgo_;
867- outputHash = hash_;
868- preferLocalBuild = true;
869- allowSubstitutes = false;
870- builder = writeScript "restrict-message" ''
871- source ${stdenvNoCC}/setup
872- cat <<_EOF_
0000873874- ***
875- ${msg}
876- ***
877878- _EOF_
879- exit 1
880- '';
881- };
882883884 /*
···915 applyPatches =
916 { src
917 , name ? (if builtins.typeOf src == "path"
918- then builtins.baseNameOf src
919- else
920- if builtins.isAttrs src && builtins.hasAttr "name" src
921- then src.name
922- else throw "applyPatches: please supply a `name` argument because a default name can only be computed when the `src` is a path or is an attribute set with a `name` attribute."
923- ) + "-patched"
924- , patches ? []
925 , postPatch ? ""
926 , ...
927- }@args: stdenvNoCC.mkDerivation {
928- inherit name src patches postPatch;
929- preferLocalBuild = true;
930- allowSubstitutes = false;
931- phases = "unpackPhase patchPhase installPhase";
932- installPhase = "cp -R ./ $out";
933- }
0934 # Carry `meta` information from the underlying `src` if present.
935 // (optionalAttrs (src?meta) { inherit (src) meta; })
936 // (removeAttrs args [ "src" "name" "patches" "postPatch" ]);
937938 /* An immutable file in the store with a length of 0 bytes. */
939- emptyFile = runCommand "empty-file" {
940- outputHashAlgo = "sha256";
941- outputHashMode = "recursive";
942- outputHash = "0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p";
943- preferLocalBuild = true;
944- } "touch $out";
0945946 /* An immutable empty directory in the store. */
947- emptyDirectory = runCommand "empty-directory" {
948- outputHashAlgo = "sha256";
949- outputHashMode = "recursive";
950- outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
951- preferLocalBuild = true;
952- } "mkdir $out";
0953}
···910rec {
1112+ /*
13+ Run the shell command `buildCommand' to produce a store path named `name'.
0001415+ The attributes in `env' are added to the environment prior to running the command.
16+ Environment variables set by `stdenv.mkDerivation` take precedence.
1718+ By default `runCommand` runs in a stdenv with no compiler environment.
19+ `runCommandCC` uses the default stdenv, `pkgs.stdenv`.
2021+ Example:
02223+ ```nix
24+ runCommand "name" {envVariable = true;} ''echo hello > $out'';
25+ ```
2627+ ```nix
28+ runCommandCC "name" {} ''gcc -o myfile myfile.c; cp myfile $out'';
29+ ```
3031+ The `*Local` variants force a derivation to be built locally,
32+ it is not substituted.
3334+ This is intended for very cheap commands (<1s execution time).
35+ It saves on the network roundrip and can speed up a build.
3637+ It is the same as adding the special fields
03839+ ```nix
40+ {
41+ preferLocalBuild = true;
42+ allowSubstitutes = false;
43+ }
44+ ```
45+46+ to a derivation’s attributes.
47 */
48 runCommand = name: env: runCommandWith {
49 stdenv = stdenvNoCC;
···67 # `runCommandCCLocal` left out on purpose.
68 # We shouldn’t force the user to have a cc in scope.
6970+ /*
71+ Generalized version of the `runCommand`-variants
72 which does customized behavior via a single
73 attribute set passed as the first argument
74 instead of having a lot of variants like
···83 defaultStdenv = stdenv;
84 in
85 {
86+ # which stdenv to use, defaults to a stdenv with a C compiler, pkgs.stdenv
87 stdenv ? defaultStdenv
88+ # whether to build this derivation locally instead of substituting
89 , runLocal ? false
90+ # extra arguments to pass to stdenv.mkDerivation
91+ , derivationArgs ? { }
92+ # name of the resulting derivation
93 , name
94+ # TODO(@Artturin): enable strictDeps always
95 }: buildCommand:
96+ stdenv.mkDerivation ({
97+ enableParallelBuilding = true;
98+ inherit buildCommand name;
99+ passAsFile = [ "buildCommand" ]
100+ ++ (derivationArgs.passAsFile or [ ]);
101+ }
102+ // lib.optionalAttrs (! derivationArgs?meta) {
103+ pos = let args = builtins.attrNames derivationArgs; in
104+ if builtins.length args > 0
105+ then builtins.unsafeGetAttrPos (builtins.head args) derivationArgs
106+ else null;
107+ }
108+ // (lib.optionalAttrs runLocal {
109+ preferLocalBuild = true;
110+ allowSubstitutes = false;
111+ })
112+ // builtins.removeAttrs derivationArgs [ "passAsFile" ]);
113114115+ /*
116+ Writes a text file to the nix store.
117 The contents of text is added to the file in the store.
118119 Example:
···157 matches = builtins.match "/bin/([^/]+)" destination;
158 in
159 runCommand name
160+ {
161+ inherit text executable checkPhase allowSubstitutes preferLocalBuild;
162 passAsFile = [ "text" ];
163+ meta = lib.optionalAttrs (executable && matches != null)
164+ {
165+ mainProgram = lib.head matches;
166+ } // meta;
167 }
168 ''
169 target=$out${lib.escapeShellArg destination}
···183 '';
184185 /*
186+ Writes a text file to nix store with no optional parameters available.
187188+ Example:
189190191+ # Writes contents of file to /nix/store/<store path>
192+ writeText "my-file"
193 ''
194 Contents of File
195 '';
196197198 */
199+ writeText = name: text: writeTextFile { inherit name text; };
200201 /*
202 Writes a text file to nix store in a specific directory with no
···238239240 */
241+ writeScript = name: text: writeTextFile { inherit name text; executable = true; };
242243 /*
244 Writes a text file to /nix/store/<store path>/bin/<name> and
···284 text = ''
285 #!${runtimeShell}
286 ${text}
287+ '';
288 checkPhase = ''
289 ${stdenv.shellDryRun} "$target"
290 '';
···306307308 */
309+ writeShellScriptBin = name: text:
310 writeTextFile {
311 inherit name;
312 executable = true;
···314 text = ''
315 #!${runtimeShell}
316 ${text}
317+ '';
318 checkPhase = ''
319 ${stdenv.shellDryRun} "$target"
320 '';
···354 , runtimeInputs ? [ ]
355 , meta ? { }
356 , checkPhase ? null
357+ , excludeShellChecks ? [ ]
358 }:
359 writeTextFile {
360 inherit name meta;
···380 # but we still want to use writeShellApplication on those platforms
381 let
382 shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck-minimal.compiler;
383+ excludeOption = lib.optionalString (excludeShellChecks != [ ]) "--exclude '${lib.concatStringsSep "," excludeShellChecks}'";
384 shellcheckCommand = lib.optionalString shellcheckSupported ''
385 # use shellcheck which does not include docs
386 # pandoc takes long to build and documentation isn't needed for just running the cli
···399 # Create a C binary
400 writeCBin = pname: code:
401 runCommandCC pname
402+ {
403+ inherit pname code;
404+ executable = true;
405+ passAsFile = [ "code" ];
406+ # Pointless to do this on a remote machine.
407+ preferLocalBuild = true;
408+ allowSubstitutes = false;
409+ meta = {
410+ mainProgram = pname;
411+ };
412+ }
413+ ''
414+ n=$out/bin/${pname}
415+ mkdir -p "$(dirname "$n")"
416+ mv "$codePath" code.c
417+ $CC -x c code.c -o "$n"
418+ '';
419420421 /* concat a list of files to the nix store.
···546 */
547 symlinkJoin =
548 args_@{ name
549+ , paths
550+ , preferLocalBuild ? true
551+ , allowSubstitutes ? false
552+ , postBuild ? ""
553+ , ...
554+ }:
555 let
556 args = removeAttrs args_ [ "name" "postBuild" ]
557 // {
558+ inherit preferLocalBuild allowSubstitutes;
559+ passAsFile = [ "paths" ];
560+ }; # pass the defaults
561+ in
562+ runCommand name args
563 ''
564 mkdir -p $out
565 for i in $(cat $pathsPath); do
···599 See the note on symlinkJoin for the difference between linkFarm and symlinkJoin.
600 */
601 linkFarm = name: entries:
602+ let
603+ entries' =
604+ if (lib.isAttrs entries) then entries
605+ # We do this foldl to have last-wins semantics in case of repeated entries
606+ else if (lib.isList entries) then lib.foldl (a: b: a // { "${b.name}" = b.path; }) { } entries
607+ else throw "linkFarm entries must be either attrs or a list!";
608609+ linkCommands = lib.mapAttrsToList
610+ (name: path: ''
611+ mkdir -p "$(dirname ${lib.escapeShellArg "${name}"})"
612+ ln -s ${lib.escapeShellArg "${path}"} ${lib.escapeShellArg "${name}"}
613+ '')
614+ entries';
615+ in
616+ runCommand name
617+ {
618+ preferLocalBuild = true;
619+ allowSubstitutes = false;
620+ passthru.entries = entries';
621+ } ''
622+ mkdir -p $out
623+ cd $out
624+ ${lib.concatStrings linkCommands}
625+ '';
626627 /*
628 Easily create a linkFarm from a set of derivations.
···657 bin output and other contents of the package's output (e.g. setup
658 hooks) cause trouble when used in your environment.
659 */
660+ onlyBin = drv: runCommand "${drv.name}-only-bin" { } ''
661 mkdir -p $out
662 ln -s ${lib.getBin drv}/bin $out/bin
663 '';
···693 # TODO 2023-01, no backport: simplify to inherit passthru;
694 passthru = passthru
695 // optionalAttrs (substitutions?passthru)
696+ (warn "makeSetupHook (name = ${lib.strings.escapeNixString name}): `substitutions.passthru` is deprecated. Please set `passthru` directly."
697+ substitutions.passthru);
698 })
699 (''
700 mkdir -p $out/nix-support
701 cp ${script} $out/nix-support/setup-hook
702 recordPropagatedDependencies
703+ '' + lib.optionalString (substitutions != { }) ''
704 substituteAll ${script} $out/nix-support/setup-hook
705 '');
706···709710 writeReferencesToFile = path: runCommand "runtime-deps"
711 {
712+ exportReferencesGraph = [ "graph" path ];
713 }
714 ''
715 touch $out
···728 */
729 writeDirectReferencesToFile = path: runCommand "runtime-references"
730 {
731+ exportReferencesGraph = [ "graph" path ];
732 inherit path;
733 }
734 ''
···762 */
763 writeStringReferencesToFile = string:
764 /*
765+ The basic operation this performs is to copy the string context
766+ from `string' to a second string and wrap that string in a
767+ derivation. However, that alone is not enough, since nothing in the
768+ string refers to the output paths of the derivations/paths in its
769+ context, meaning they'll be considered build-time dependencies and
770+ removed from the wrapper derivation's closure. Putting the
771+ necessary output paths in the new string is however not very
772+ straightforward - the attrset returned by `getContext' contains
773+ only references to derivations' .drv-paths, not their output
774+ paths. In order to "convert" them, we try to extract the
775+ corresponding paths from the original string using regex.
776 */
777 let
778 # Taken from https://github.com/NixOS/nix/blob/130284b8508dad3c70e8160b15f3d62042fc730a/src/libutil/hash.cc#L84
···816 if lib.elem "out" value.outputs then
817 lib.filter
818 (x: lib.isList x &&
819+ # If the matched path is in `namedOutputPaths`,
820+ # it's a partial match of an output path where
821+ # the output name isn't `out`
822+ lib.all (o: !lib.hasPrefix (lib.head x) o) namedOutputPaths)
823 (builtins.split "(${builtins.storeDir}/[${nixHashChars}]+-${name})" string)
824 else
825+ [ ])
826 packages);
827 allPaths = lib.concatStringsSep "\n" (lib.unique (sources ++ namedOutputPaths ++ outputPaths));
828 allPathsWithContext = builtins.appendContext allPaths context;
829 in
830+ if builtins ? getContext then
831+ writeText "string-references" allPathsWithContext
832+ else
833+ writeDirectReferencesToFile (writeText "string-file" string);
834835836 /* Print an error message if the file with the specified name and
···848 }
849850 */
851+ requireFile =
852+ { name ? null
853+ , sha256 ? null
854+ , sha1 ? null
855+ , hash ? null
856+ , url ? null
857+ , message ? null
858+ , hashMode ? "flat"
859+ }:
860+ assert (message != null) || (url != null);
861+ assert (sha256 != null) || (sha1 != null) || (hash != null);
862+ assert (name != null) || (url != null);
863+ let
864+ msg =
865+ if message != null then message
866+ else ''
867+ Unfortunately, we cannot download file ${name_} automatically.
868+ Please go to ${url} to download it yourself, and add it to the Nix store
869+ using either
870+ nix-store --add-fixed ${hashAlgo} ${name_}
871+ or
872+ nix-prefetch-url --type ${hashAlgo} file:///path/to/${name_}
873+ '';
874+ hashAlgo =
875+ if hash != null then (builtins.head (lib.strings.splitString "-" hash))
876+ else if sha256 != null then "sha256"
877+ else "sha1";
878+ hashAlgo_ = if hash != null then "" else hashAlgo;
879+ hash_ =
880+ if hash != null then hash
881+ else if sha256 != null then sha256
882+ else sha1;
883+ name_ = if name == null then baseNameOf (toString url) else name;
884+ in
885+ stdenvNoCC.mkDerivation {
886+ name = name_;
887+ outputHashMode = hashMode;
888+ outputHashAlgo = hashAlgo_;
889+ outputHash = hash_;
890+ preferLocalBuild = true;
891+ allowSubstitutes = false;
892+ builder = writeScript "restrict-message" ''
893+ source ${stdenvNoCC}/setup
894+ cat <<_EOF_
895896+ ***
897+ ${msg}
898+ ***
899900+ _EOF_
901+ exit 1
902+ '';
903+ };
904905906 /*
···937 applyPatches =
938 { src
939 , name ? (if builtins.typeOf src == "path"
940+ then builtins.baseNameOf src
941+ else
942+ if builtins.isAttrs src && builtins.hasAttr "name" src
943+ then src.name
944+ else throw "applyPatches: please supply a `name` argument because a default name can only be computed when the `src` is a path or is an attribute set with a `name` attribute."
945+ ) + "-patched"
946+ , patches ? [ ]
947 , postPatch ? ""
948 , ...
949+ }@args: stdenvNoCC.mkDerivation
950+ {
951+ inherit name src patches postPatch;
952+ preferLocalBuild = true;
953+ allowSubstitutes = false;
954+ phases = "unpackPhase patchPhase installPhase";
955+ installPhase = "cp -R ./ $out";
956+ }
957 # Carry `meta` information from the underlying `src` if present.
958 // (optionalAttrs (src?meta) { inherit (src) meta; })
959 // (removeAttrs args [ "src" "name" "patches" "postPatch" ]);
960961 /* An immutable file in the store with a length of 0 bytes. */
962+ emptyFile = runCommand "empty-file"
963+ {
964+ outputHashAlgo = "sha256";
965+ outputHashMode = "recursive";
966+ outputHash = "0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p";
967+ preferLocalBuild = true;
968+ } "touch $out";
969970 /* An immutable empty directory in the store. */
971+ emptyDirectory = runCommand "empty-directory"
972+ {
973+ outputHashAlgo = "sha256";
974+ outputHashMode = "recursive";
975+ outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
976+ preferLocalBuild = true;
977+ } "mkdir $out";
978}
···344 '';
345 license = lib.licenses.psfl;
346 platforms = lib.platforms.all;
347- maintainers = with lib.maintainers; [ fridh thiagokokada ];
348 knownVulnerabilities = [
349 "Python 2.7 has reached its end of life after 2020-01-01. See https://www.python.org/doc/sunset-python-2/."
350 # Quote: That means that we will not improve it anymore after that day,
···344 '';
345 license = lib.licenses.psfl;
346 platforms = lib.platforms.all;
347+ maintainers = with lib.maintainers; [ fridh ];
348 knownVulnerabilities = [
349 "Python 2.7 has reached its end of life after 2020-01-01. See https://www.python.org/doc/sunset-python-2/."
350 # Quote: That means that we will not improve it anymore after that day,
···56rustPlatform.buildRustPackage rec {
7 pname = "cargo-careful";
8- version = "0.4.0";
910 src = fetchFromGitHub {
11 owner = "RalfJung";
12 repo = "cargo-careful";
13 rev = "v${version}";
14- hash = "sha256-5FteKVlEx5NSj3lzRRj3qerkyK+UdJfTWtG6xEzI4t4=";
15 };
1617- cargoHash = "sha256-gs8o+tWvC4cgIITpfvJqfTquyYaEbvNMeZEJKFzd83I=";
1819 meta = with lib; {
20 description = "A tool to execute Rust code carefully, with extra checking along the way";
···56rustPlatform.buildRustPackage rec {
7 pname = "cargo-careful";
8+ version = "0.4.1";
910 src = fetchFromGitHub {
11 owner = "RalfJung";
12 repo = "cargo-careful";
13 rev = "v${version}";
14+ hash = "sha256-oiwR6NgHHu9B1L6dSK6KZfgcSdwBPEzUZONwPHr0a4k=";
15 };
1617+ cargoHash = "sha256-sVIAY9eYlpyS/PU6kLInc4hMeD3qcewoMbTH+wTIBuI=";
1819 meta = with lib; {
20 description = "A tool to execute Rust code carefully, with extra checking along the way";
+4-4
pkgs/games/anki/bin.nix
···3let
4 pname = "anki-bin";
5 # Update hashes for both Linux and Darwin!
6- version = "23.10.1";
78 sources = {
9 linux = fetchurl {
10 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
11- sha256 = "sha256-Kv0SH+bLnBSM/tYHe2kEJc4n7izZTBNWQs2nm/teLEU=";
12 };
1314 # For some reason anki distributes completely separate dmg-files for the aarch64 version and the x86_64 version
15 darwin-x86_64 = fetchurl {
16 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-intel-qt6.dmg";
17- sha256 = "sha256-MSlKsEv4N/H7G1bUOBlPBXerpHIW32P6Va02aRq1+54=";
18 };
19 darwin-aarch64 = fetchurl {
20 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-apple-qt6.dmg";
21- sha256 = "sha256-jEm9WJBXx77KpldzBuxK1Pu6VGiARZPnRmMhEjZdm1I=";
22 };
23 };
24
···3let
4 pname = "anki-bin";
5 # Update hashes for both Linux and Darwin!
6+ version = "23.12.1";
78 sources = {
9 linux = fetchurl {
10 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
11+ sha256 = "sha256-bFtAUqSoFS8CWESiepWXywndkijATbWp6CJdqlQecuk=";
12 };
1314 # For some reason anki distributes completely separate dmg-files for the aarch64 version and the x86_64 version
15 darwin-x86_64 = fetchurl {
16 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-intel-qt6.dmg";
17+ sha256 = "sha256-z48REB14p7rb50ty9u/26wx0sY4QZb4pj6wOXsSBCdg=";
18 };
19 darwin-aarch64 = fetchurl {
20 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-apple-qt6.dmg";
21+ sha256 = "sha256-bdaCqSjje86wmVKIFZqzuFaEZ7SWQr7CAS/Hm1CpOMg=";
22 };
23 };
24
+1-1
pkgs/os-specific/linux/amdctl/default.nix
···26 description = "Set P-State voltages and clock speeds on recent AMD CPUs on Linux.";
27 homepage = "https://github.com/kevinlekiller/amdctl";
28 license = licenses.gpl3Plus;
29- maintainers = with maintainers; [ thiagokokada ];
30 platforms = [ "x86_64-linux" ];
31 };
32}
···26 description = "Set P-State voltages and clock speeds on recent AMD CPUs on Linux.";
27 homepage = "https://github.com/kevinlekiller/amdctl";
28 license = licenses.gpl3Plus;
29+ maintainers = with maintainers; [ ];
30 platforms = [ "x86_64-linux" ];
31 };
32}
+25-11
pkgs/os-specific/linux/kernel/README.md
···452. Add the new kernel to the `kernels` attribute set in [`linux-kernels.nix`](./linux-kernels.nix) (e.g., create an attribute `kernel_2_6_22`).
67-3. Update the kernel configuration. First unpack the kernel. Then for each supported platform (`i686`, `x86_64`, `uml`) do the following:
89- 1. Make a copy from the old config (e.g., `config-2.6.21-i686-smp`) to the new one (e.g., `config-2.6.22-i686-smp`).
1011- 2. Copy the config file for this platform (e.g., `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
001213- 3. Run `make oldconfig ARCH={i386,x86_64,um}` and answer all questions. (For the uml configuration, also add `SHELL=bash`.) Make sure to keep the configuration consistent between platforms (i.e., don’t enable some feature on `i686` and disable it on `x86_64`).
1415- 4. If needed, you can also run `make menuconfig`:
0001617- ```ShellSession
18- $ nix-env -f "<nixpkgs>" -iA ncurses
19- $ export NIX_CFLAGS_LINK=-lncurses
20- $ make menuconfig ARCH=arch
21- ```
2223- 5. Copy `.config` over the new config file (e.g., `config-2.6.22-i686-smp`).
00000000024254. Test building the kernel:
26
···452. Add the new kernel to the `kernels` attribute set in [`linux-kernels.nix`](./linux-kernels.nix) (e.g., create an attribute `kernel_2_6_22`).
67+3. Update the kernel configuration:
89+ 1. While in the Nixpkgs repository, enter the development shell for that kernel:
1011+ ```console
12+ $ nix-shell -A linuxKernel.kernels.linux_2_6_22
13+ ```
1415+ 2. Unpack the kernel:
1617+ ```console
18+ [nix-shell]$ pushd $(mktemp -d)
19+ [nix-shell]$ unpackPhase
20+ ```
2122+ 3. For each supported platform (`i686`, `x86_64`, `uml`) do the following:
23+24+ 1. Make a copy from the old config (e.g., `config-2.6.21-i686-smp`) to the new one (e.g., `config-2.6.22-i686-smp`).
25+26+ 2. Copy the config file for this platform (e.g., `config-2.6.22-i686-smp`) to `.config` in the unpacked kernel source tree.
2728+ 3. Run `make oldconfig ARCH={i386,x86_64,um}` and answer all questions. (For the uml configuration, also add `SHELL=bash`.) Make sure to keep the configuration consistent between platforms (i.e., don’t enable some feature on `i686` and disable it on `x86_64`).
29+30+ 4. If needed, you can also run `make menuconfig`:
31+32+ ```ShellSession
33+ $ nix-shell -p ncurses pkg-config
34+ $ make menuconfig ARCH=arch
35+ ```
36+37+ 5. Copy `.config` over the new config file (e.g., `config-2.6.22-i686-smp`).
38394. Test building the kernel:
40
···185 ];
186 };
18700000000188 linux_testing = let
189 testing = callPackage ../os-specific/linux/kernel/mainline.nix {
190 # A special branch that tracks the kernel under the release process
···586 linux_6_1 = recurseIntoAttrs (packagesFor kernels.linux_6_1);
587 linux_6_5 = recurseIntoAttrs (packagesFor kernels.linux_6_5);
588 linux_6_6 = recurseIntoAttrs (packagesFor kernels.linux_6_6);
0589 __attrsFailEvaluation = true;
590 } // lib.optionalAttrs config.allowAliases {
591 linux_4_9 = throw "linux 4.9 was removed because it will reach its end of life within 22.11"; # Added 2022-11-08
···650 packageAliases = {
651 linux_default = packages.linux_6_1;
652 # Update this when adding the newest kernel major version!
653- linux_latest = packages.linux_6_6;
654 linux_mptcp = throw "'linux_mptcp' has been moved to https://github.com/teto/mptcp-flake";
655 linux_rt_default = packages.linux_rt_5_4;
656 linux_rt_latest = packages.linux_rt_6_1;
···185 ];
186 };
187188+ linux_6_7 = callPackage ../os-specific/linux/kernel/mainline.nix {
189+ branch = "6.7";
190+ kernelPatches = [
191+ kernelPatches.bridge_stp_helper
192+ kernelPatches.request_key_helper
193+ ];
194+ };
195+196 linux_testing = let
197 testing = callPackage ../os-specific/linux/kernel/mainline.nix {
198 # A special branch that tracks the kernel under the release process
···594 linux_6_1 = recurseIntoAttrs (packagesFor kernels.linux_6_1);
595 linux_6_5 = recurseIntoAttrs (packagesFor kernels.linux_6_5);
596 linux_6_6 = recurseIntoAttrs (packagesFor kernels.linux_6_6);
597+ linux_6_7 = recurseIntoAttrs (packagesFor kernels.linux_6_7);
598 __attrsFailEvaluation = true;
599 } // lib.optionalAttrs config.allowAliases {
600 linux_4_9 = throw "linux 4.9 was removed because it will reach its end of life within 22.11"; # Added 2022-11-08
···659 packageAliases = {
660 linux_default = packages.linux_6_1;
661 # Update this when adding the newest kernel major version!
662+ linux_latest = packages.linux_6_7;
663 linux_mptcp = throw "'linux_mptcp' has been moved to https://github.com/teto/mptcp-flake";
664 linux_rt_default = packages.linux_rt_5_4;
665 linux_rt_latest = packages.linux_rt_6_1;