Skip to content

Commit c399844

Browse files
committed
devenv.sh test
1 parent 4309cfc commit c399844

File tree

6 files changed

+207
-18
lines changed

6 files changed

+207
-18
lines changed

.envrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
use flake
1+
export DIRENV_WARN_TIMEOUT=20s
2+
3+
eval "$(devenv direnvrc)"
4+
5+
# The use_devenv function supports passing flags to the devenv command
6+
# For example: use devenv --impure --option services.postgres.enable:bool true
7+
use devenv

.github/workflows/test.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
name: Test
2-
on: [push, pull_request]
1+
name: "Test"
2+
on:
3+
pull_request:
4+
push:
35
jobs:
4-
all:
5-
runs-on: ${{ matrix.os }}
6-
env:
7-
RUSTFLAGS: --deny warnings
8-
strategy:
9-
matrix:
10-
os: [ubuntu-latest]
11-
rust: [stable, beta]
6+
tests:
7+
runs-on: ubuntu-latest
128
steps:
13-
- uses: hecrj/setup-rust-action@v2
14-
with:
15-
rust-version: ${{ matrix.rust }}
16-
- uses: actions/checkout@master
17-
- name: Run tests
18-
run: |
19-
cargo test --verbose --workspace --all-features
9+
- uses: actions/checkout@v3
10+
- uses: cachix/install-nix-action@v18
11+
- uses: cachix/cachix-action@v12
12+
with:
13+
name: m00nwtchr
14+
extraPullNames: devenv
15+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
16+
- run: nix profile install github:cachix/devenv/latest
17+
name: Install devenv.sh
18+
- run: devenv shell echo ok
19+
- run: devenv ci

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,13 @@
22
*.db*
33
.env
44
/.direnv
5+
6+
# Devenv
7+
.devenv*
8+
devenv.local.nix
9+
10+
# direnv
11+
.direnv
12+
13+
# pre-commit
14+
.pre-commit-config.yaml

devenv.lock

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"nodes": {
3+
"devenv": {
4+
"locked": {
5+
"dir": "src/modules",
6+
"lastModified": 1754418859,
7+
"owner": "cachix",
8+
"repo": "devenv",
9+
"rev": "e13cd53579f6a0f441ac09230178dccb3008dd36",
10+
"type": "github"
11+
},
12+
"original": {
13+
"dir": "src/modules",
14+
"owner": "cachix",
15+
"repo": "devenv",
16+
"type": "github"
17+
}
18+
},
19+
"flake-compat": {
20+
"flake": false,
21+
"locked": {
22+
"lastModified": 1747046372,
23+
"owner": "edolstra",
24+
"repo": "flake-compat",
25+
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
26+
"type": "github"
27+
},
28+
"original": {
29+
"owner": "edolstra",
30+
"repo": "flake-compat",
31+
"type": "github"
32+
}
33+
},
34+
"git-hooks": {
35+
"inputs": {
36+
"flake-compat": "flake-compat",
37+
"gitignore": "gitignore",
38+
"nixpkgs": [
39+
"nixpkgs"
40+
]
41+
},
42+
"locked": {
43+
"lastModified": 1754416808,
44+
"owner": "cachix",
45+
"repo": "git-hooks.nix",
46+
"rev": "9c52372878df6911f9afc1e2a1391f55e4dfc864",
47+
"type": "github"
48+
},
49+
"original": {
50+
"owner": "cachix",
51+
"repo": "git-hooks.nix",
52+
"type": "github"
53+
}
54+
},
55+
"gitignore": {
56+
"inputs": {
57+
"nixpkgs": [
58+
"git-hooks",
59+
"nixpkgs"
60+
]
61+
},
62+
"locked": {
63+
"lastModified": 1709087332,
64+
"owner": "hercules-ci",
65+
"repo": "gitignore.nix",
66+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
67+
"type": "github"
68+
},
69+
"original": {
70+
"owner": "hercules-ci",
71+
"repo": "gitignore.nix",
72+
"type": "github"
73+
}
74+
},
75+
"nixpkgs": {
76+
"locked": {
77+
"lastModified": 1753719760,
78+
"owner": "cachix",
79+
"repo": "devenv-nixpkgs",
80+
"rev": "0f871fffdc0e5852ec25af99ea5f09ca7be9b632",
81+
"type": "github"
82+
},
83+
"original": {
84+
"owner": "cachix",
85+
"ref": "rolling",
86+
"repo": "devenv-nixpkgs",
87+
"type": "github"
88+
}
89+
},
90+
"root": {
91+
"inputs": {
92+
"devenv": "devenv",
93+
"git-hooks": "git-hooks",
94+
"nixpkgs": "nixpkgs",
95+
"pre-commit-hooks": [
96+
"git-hooks"
97+
]
98+
}
99+
}
100+
},
101+
"root": "root",
102+
"version": 7
103+
}

devenv.nix

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
pkgs,
3+
lib,
4+
config,
5+
inputs,
6+
...
7+
}: {
8+
# https://devenv.sh/basics/
9+
env.GREET = "devenv";
10+
11+
cachix.enable = true;
12+
cachix.pull = ["m00nwtchr"];
13+
14+
# https://devenv.sh/packages/
15+
packages = [pkgs.git pkgs.cargo-nextest];
16+
17+
# https://devenv.sh/languages/
18+
languages.rust.enable = true;
19+
20+
# https://devenv.sh/processes/
21+
# processes.cargo-watch.exec = "cargo-watch";
22+
23+
# https://devenv.sh/services/
24+
# services.postgres.enable = true;
25+
26+
# https://devenv.sh/scripts/
27+
scripts.hello.exec = ''
28+
echo hello from $GREET
29+
'';
30+
31+
enterShell = ''
32+
hello
33+
git --version
34+
'';
35+
36+
# https://devenv.sh/tasks/
37+
# tasks = {
38+
# "myproj:setup".exec = "mytool build";
39+
# "devenv:enterShell".after = [ "myproj:setup" ];
40+
# };
41+
42+
# https://devenv.sh/tests/
43+
enterTest = ''
44+
echo "Running tests"
45+
git --version | grep --color=auto "${pkgs.git.version}"
46+
cargo nextest run --verbose --workspace --all-features
47+
'';
48+
49+
# https://devenv.sh/git-hooks/
50+
git-hooks.hooks = {
51+
clippy.enable = true;
52+
};
53+
54+
# See full reference at https://devenv.sh/reference/options/
55+
}

devenv.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
2+
inputs:
3+
nixpkgs:
4+
url: github:cachix/devenv-nixpkgs/rolling
5+
6+
# If you're using non-OSS software, you can set allowUnfree to true.
7+
# allowUnfree: true
8+
9+
# If you're willing to use a package that's vulnerable
10+
# permittedInsecurePackages:
11+
# - "openssl-1.1.1w"
12+
13+
# If you have more than one devenv you can merge them
14+
#imports:
15+
# - ./backend

0 commit comments

Comments
 (0)