mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-02-04 03:53:39 +08:00
temp
This commit is contained in:
parent
6a1eee3d27
commit
095401025c
8 changed files with 128 additions and 383 deletions
|
|
@ -261,7 +261,28 @@ system:
|
|||
}
|
||||
....
|
||||
|
||||
So `lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]`
|
||||
followed by the first function will give us the development shell definitions for both systems,
|
||||
and followed by the second function will give us the package definitions for both systems.
|
||||
We can make the flake more readable with the following definitions.
|
||||
|
||||
[source,nix]
|
||||
....
|
||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
|
||||
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
....
|
||||
|
||||
Now let's examine the definition of `nixpkgsFor.${system}`.
|
||||
|
||||
[source,nix]
|
||||
....
|
||||
nixpkgsFor = forAllSupportedSystems (system: import nixpkgs { inherit system; });
|
||||
....
|
||||
|
||||
Putting everything together, we have a shiny new flake.
|
||||
You may want to compare it carefully to the original version,
|
||||
in order to reassure yourself that the definitions are equivalent.
|
||||
|
||||
////
|
||||
$ cp ../flake-4.nix flake.nix
|
||||
|
|
@ -276,12 +297,13 @@ $# cat flake.nix
|
|||
Let's verify that it runs on our system.
|
||||
|
||||
....
|
||||
$ git commit -am "refactored the flake"
|
||||
$ nix run
|
||||
....
|
||||
|
||||
You may want to compare the latest `flake.nix` carefully to the original version,
|
||||
in order to reassure yourself that the definitions are equivalent.
|
||||
// TODO In packages, add cow-hello and set default = cow-hello. Explain why.
|
||||
|
||||
// TODO Add an apps section and explain why.
|
||||
|
||||
////
|
||||
Good adoc0 scripts clean up after themselves.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue