Add `devShell` example (#31)

* Add `devShell` example

Co-authored-by: oxalica <oxalicc@pm.me>
wip/nixpkgs-raku
Alex 3 years ago committed by GitHub
parent 01c3fd03f7
commit 88262ab95b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 45
      README.md

@ -50,6 +50,8 @@ $ cargo --version
cargo 1.49.0 (d00d64df9 2020-12-05)
```
### Example: NixOS Configuration
Here's an example of using it in nixos configuration.
```nix
{
@ -77,6 +79,49 @@ Here's an example of using it in nixos configuration.
}
```
### Example: Using `devShell` and `nix develop`
Running `nix develop` will create a shell with the default nightly Rust toolchain installed:
```nix
{
description = "A devShell example";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
{
devShell = pkgs.mkShell {
buildInputs = [
pkgs.openssl
pkgs.pkgconfig
pkgs.exa
pkgs.fd
pkgs.rust-bin.nightly.latest.default
];
shellHook = ''
alias ls=exa
alias find=fd
'';
};
}
);
}
```
## Attributes provided by the overlay
```nix

Loading…
Cancel
Save