This commit is contained in:
Amy de Buitléir 2025-10-12 22:05:59 +01:00
parent 6a1eee3d27
commit 095401025c
8 changed files with 128 additions and 383 deletions

View file

@ -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.