Skip to content

Commit

Permalink
fix formatting and links
Browse files Browse the repository at this point in the history
  • Loading branch information
fricklerhandwerk committed Mar 8, 2024
1 parent 86a5de3 commit 0c1f347
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
22 changes: 11 additions & 11 deletions source/tutorials/module-system/module-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Start by changing the first line in `default.nix`:

```{code-block} diff
:caption: default.nix
- { ... }:
+ { lib, ... }:
{
-{ ... }:
+{ lib, ... }:
{
}
}
```

Now the module is a function which takes *at least* one argument, called `lib`, and may accept other arguments (expressed by the ellipsis `...`).
Expand All @@ -97,7 +97,7 @@ Change `default.nix` to include the following declaration:
```{code-block} diff
:caption: default.nix
{ lib, ... }: {
+
+ options = {
+ scripts.output = lib.mkOption {
+ type = lib.types.lines;
Expand Down Expand Up @@ -204,12 +204,12 @@ Update `default.nix` by changing the value of `scripts.output` to the following

```{code-block} diff
:caption: default.nix
config = {
- scripts.output = 42;
+ scripts.output = ''
+ ./map size=640x640 scale=2 | feh -
+ '';
};
config = {
- scripts.output = 42;
+ scripts.output = ''
+ ./map size=640x640 scale=2 | feh -
+ '';
};
```

## Interlude: reproducible scripts
Expand Down
7 changes: 3 additions & 4 deletions source/tutorials/packaging-existing-software.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ in
This allows you to run `nix-build -A hello` to realize the derivation in `hello.nix`, similar to the current convention used in Nixpkgs.

:::{note}
[`callPackage`] automatically passes attributes from `pkgs` to the given function, if they match attributes required by that function's argument attrset.
`callPackage` automatically passes attributes from `pkgs` to the given function, if they match attributes required by that function's argument attribute set.

In this case, `callPackage` will supply `lib`, `stdenv`, and `fetchzip` to the function defined in `hello.nix`.
:::
Expand Down Expand Up @@ -643,6 +643,7 @@ Adjust your `installPhase` to call the appropriate hooks:
# ...
```

## A successful build

Running the `nix-build` command once more will finally do what you want, repeatably.
Expand All @@ -658,15 +659,13 @@ default.nix hello.nix icat.nix result
## References

- [Nixpkgs Manual - Standard Environment](https://nixos.org/manual/nixpkgs/unstable/#part-stdenv)
- [Nix Pills - `callPackage` Design Pattern][`callPackage`]

[`callPackage`]: https://nixos.org/guides/nix-pills/callpackage-design-pattern.html

## Next steps

- [Add your own new packages to Nixpkgs](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md)
- [](../contributing/how-to-contribute.md)
- [](../contributing/how-to-get-help.md)
- [](callpackage-tutorial)
- [](sharing-dependencies)
- [](automatic-direnv)
- [](python-dev-environment)

0 comments on commit 0c1f347

Please sign in to comment.