Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Nixpkgs overlays #151

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add overlays section
lucperkins committed Jan 21, 2023
commit 4a3da9c53c096c37c9d1c8f7c88dbf9b9cdc10a0
4 changes: 2 additions & 2 deletions src/pages/concepts/flakes.mdx
Original file line number Diff line number Diff line change
@@ -169,9 +169,9 @@ Here's an example flake that uses symbolic identifiers:
```nix filename=flake.nix
{
outputs = { self, nixpkgs, flake-utils }:
let
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; };
in flake-utils.lib.eachDefaultSystem (system: {
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [ curl git jq wget ];
};
49 changes: 47 additions & 2 deletions src/pages/concepts/nixpkgs.mdx
Original file line number Diff line number Diff line change
@@ -28,6 +28,22 @@ externalSources: [
title: "The NixOS wiki",
href: "https://nixos.wiki"
}
},
{
title: "Overlays",
href: "https://nixos.wiki/wiki/Overlays",
source: {
title: "The NixOS wiki",
href: "https://nixos.wiki"
}
},
{
title: "Defining overlays",
href: "https://nixos.org/manual/nixpkgs/stable/#sec-overlays-definition",
source: {
title: "The Nixpkgs manual",
href: "https://nixos.org/manual/nixpkgs/stable"
}
}
]
---
@@ -39,8 +55,37 @@ Nixpkgs is a mono repo, containing over 80,000 package definitions and the utili
It also contains [NixOS](/concepts/nixos) modules and anything required to build and deploy a full Nix system.
Many tools in the Nix ecosystem depend on this standard library to function.

## Release channels
## Overlays

```nix
let renameOverlay = self: super: {
booper = self.python3;
bopper = self.curl;
};
```

```nix
{
outputs = { self, nixpkgs, flake-utils }:
let
overlays = [
(self: super: {
# Modify Nixpkgs as `self` here
})
];
in flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit overlays system; };
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [ curl git jq wget ];
};
});
}
```

TODO
<Admonition success open title="Mental model" client:load>
It may be helpful to think of an overlay as a function that transforms an attribute set that's almost what you want into an attribute set that's exactly what you want.
</Admonition>

[nix]: https://nixos.org
[packages]: /concepts/packages