Skip to content

Commit 3ebc05f

Browse files
committedMar 15, 2025
docs: add alternative approach for using nixpkgs-unstable
1 parent 39b7606 commit 3ebc05f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
 

‎README.md

+37
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,43 @@ By default, devenv uses `github:cachix/devenv-nixpkgs/rolling` as its nixpkgs so
5454

5555
This approach prioritizes having the latest language features over the potential stability benefits of the default channel. For most Elixir development, this trade-off is worthwhile as it provides access to the newest language capabilities.
5656

57+
#### Alternative Approach
58+
59+
If you encounter issues with our direct method (replacing the nixpkgs source in devenv.yaml), you can follow the [official devenv approach](https://devenv.sh/common-patterns/#getting-a-recent-version-of-a-package-from-nixpkgs-unstable) for using packages from nixpkgs-unstable:
60+
61+
1. Keep the default nixpkgs source and add nixpkgs-unstable as an additional input in `devenv.yaml`:
62+
63+
```yaml
64+
inputs:
65+
nixpkgs:
66+
url: github:cachix/devenv-nixpkgs/rolling
67+
nixpkgs-unstable:
68+
url: github:nixos/nixpkgs/nixpkgs-unstable
69+
```
70+
71+
2. Use the unstable package in `devenv.nix`:
72+
```nix
73+
{ pkgs, inputs, ... }:
74+
let
75+
pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };
76+
in
77+
{
78+
languages.elixir = {
79+
enable = true;
80+
package = pkgs-unstable.beam.packages.erlang_27.elixir;
81+
};
82+
languages.erlang.enable = true;
83+
}
84+
```
85+
86+
This method keeps the stability benefits of the default devenv nixpkgs for most packages while still allowing specific access to newer versions from unstable when needed.
87+
88+
For more information:
89+
90+
- [Devenv documentation on using nixpkgs-unstable](https://devenv.sh/common-patterns/#getting-a-recent-version-of-a-package-from-nixpkgs-unstable)
91+
- [Discussion about package versioning in Nix](https://github.com/NixOS/nixpkgs/issues/93327)
92+
- [NixOS search for Elixir packages](https://search.nixos.org/packages?channel=unstable&query=elixir)
93+
5794
## Customizing
5895

5996
### Adding dependencies

0 commit comments

Comments
 (0)
Please sign in to comment.