-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83706a8
commit 74a6809
Showing
22 changed files
with
318 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Typically [packages](./packages.md) come prebuilt with binaries provided by [the official binary cache](https://cache.nixos.org). | ||
|
||
If you're modifying a package or using a package that's not built upstream, | ||
Nix will build it from source instead of downloading a binary. | ||
|
||
To prevent packages from being built more than once, there's seamless integration with | ||
binary caches using [Cachix](https://cachix.org). | ||
|
||
## Setup | ||
|
||
If you'd like to push binaries to your own cache, you'll need [to create one](https://app.cachix.org/cache). | ||
|
||
After that you'll need to set `cachix authtoken XXX` with either [a personal auth token](https://app.cachix.org/personal-auth-tokens) or a cache token (that you can create in cache settings). | ||
|
||
## devenv.nix | ||
|
||
To specify `pre-commit-hooks` as a cache to pull from and `mycache` to pull from and push to: | ||
|
||
```nix title="devenv.nix" | ||
{ | ||
cachix.pull = [ "pre-commit-hooks" ]; | ||
cachix.push = "mycache"; | ||
} | ||
``` | ||
|
||
# Pushing only in specific cases | ||
|
||
You'll likely not want every user to push to the cache. | ||
|
||
It's usually convenient to push [explicitly](./files-and-variables/#devenvlocalnix), for example as part of CI run: | ||
|
||
```shell-session | ||
$ echo '{ cachix.push = "mycache"; }' > devenv.local.nix | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
To ease testing of your environments, | ||
we provide a way to define the tests and to run them. | ||
|
||
## Writing devenv tests | ||
|
||
A simple test would look like: | ||
|
||
```nix title="devenv.nix" | ||
{ pkgs, ... }: { | ||
tests.basic = { | ||
nix = '' | ||
{ pkgs, ... }: { | ||
packages = [ pkgs.ncdu ]; | ||
} | ||
''; | ||
test = '' | ||
ncdu --version | grep "ncdu 2.2" | ||
''; | ||
}; | ||
} | ||
``` | ||
|
||
```shell-session | ||
$ devenv test | ||
✔ Gathering tests in 0.3s. | ||
• Found 1 test(s), running 1: | ||
• Testing basic ... | ||
• Running $ devenv ci | ||
• Running .test.sh. | ||
✔ Running basic in 16.7s. | ||
``` | ||
|
||
## Defining tests in a folder | ||
|
||
A simple test with a tesh script: | ||
|
||
```shell-session | ||
$ ls tests/mytest/ | ||
.test.sh devenv.nix devenv.yaml | ||
``` | ||
|
||
And define it: | ||
|
||
```nix title="devenv.nix" | ||
{ config, ... }: { | ||
tests = config.lib.mkTests ./tests; | ||
} | ||
``` | ||
|
||
Run tests: | ||
|
||
```shell-session | ||
$ devenv test | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
{ pkgs, ... }: | ||
|
||
{ | ||
packages = [ pkgs.rust-bin.stable.latest.default ]; | ||
packages = [ | ||
# from the rust-overlay | ||
pkgs.rust-bin.stable.latest.default | ||
|
||
services.blackfire.enable = true; | ||
# from subflake | ||
pkgs.hello2 | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
outputs = { ... }: { | ||
overlays.default = self: super: { | ||
hello2 = self.hello; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.