Skip to content

Commit 1b0325b

Browse files
committed
Switch to devenv
1 parent cbb8293 commit 1b0325b

File tree

10 files changed

+193
-131
lines changed

10 files changed

+193
-131
lines changed

.envrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
use flake
1+
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="
2+
3+
use devenv

.github/workflows/control.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,39 @@ on:
66
branches:
77
- main
88
paths:
9-
- 'flake.*'
9+
- '.github/workflows/control.yml'
10+
- 'devenv.*'
1011
- 'control/**'
1112
pull_request:
1213
paths:
13-
- 'flake.*'
14+
- '.github/workflows/control.yml'
15+
- 'devenv.*'
1416
- 'control/**'
1517

1618
jobs:
1719
quality:
1820
name: Code Quality
1921
runs-on: ubuntu-latest
2022

21-
defaults:
22-
run:
23-
working-directory: ./control
24-
2523
steps:
2624
- uses: actions/checkout@v4
2725
- uses: cachix/install-nix-action@v30
26+
- uses: cachix/cachix-action@v15
27+
with:
28+
name: devenv
29+
- name: Install devenv.sh
30+
run: nix profile install nixpkgs#devenv
2831

2932
- name: Clippy
33+
shell: devenv shell bash -- -e {0}
3034
run: |
31-
eval "$(nix print-dev-env)"
32-
set -x
33-
35+
cd ./control
3436
cargo clippy -- -Dwarnings
3537
3638
- name: Test
39+
shell: devenv shell bash -- -e {0}
3740
run: |
38-
eval "$(nix print-dev-env)"
39-
set -x
40-
41+
cd ./control
4142
cargo test
4243
4344
build:
@@ -46,17 +47,17 @@ jobs:
4647
needs:
4748
- quality
4849

49-
defaults:
50-
run:
51-
working-directory: ./control
52-
5350
steps:
5451
- uses: actions/checkout@v4
5552
- uses: cachix/install-nix-action@v30
53+
- uses: cachix/cachix-action@v15
54+
with:
55+
name: devenv
56+
- name: Install devenv.sh
57+
run: nix profile install nixpkgs#devenv
5658

5759
- name: Build
60+
shell: devenv shell bash -- -e {0}
5861
run: |
59-
eval "$(nix print-dev-env)"
60-
set -x
61-
62+
cd ./control
6263
cargo build --release

.github/workflows/firmware.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,40 @@ on:
66
branches:
77
- main
88
paths:
9-
- 'flake.*'
9+
- '.github/workflows/firmware.yml'
10+
- 'devenv.*'
1011
- 'firmware/**'
1112
pull_request:
1213
paths:
13-
- 'flake.*'
14+
- '.github/workflows/firmware.yml'
15+
- 'devenv.*'
1416
- 'firmware/**'
1517

1618
jobs:
1719
quality:
1820
name: Code Quality
1921
runs-on: ubuntu-latest
2022

21-
defaults:
22-
run:
23-
working-directory: ./firmware
24-
2523
steps:
2624
- uses: actions/checkout@v4
2725
- uses: cachix/install-nix-action@v30
26+
- uses: cachix/cachix-action@v15
27+
with:
28+
name: devenv
29+
- name: Install devenv.sh
30+
run: nix profile install nixpkgs#devenv
2831

2932
- name: Clippy
3033
env:
3134
WIFI_PASSWORD: super secret
3235
MQTT_PASSWORD: lol nope
3336
CONFIG: ./configs/test.toml
37+
shell: devenv shell bash -- -e {0}
3438
run: |
35-
eval "$(nix print-dev-env)"
3639
set -x
3740
41+
cd ./firmware
42+
3843
rustup target add thumbv6m-none-eabi
3944
rustup show
4045
@@ -46,10 +51,6 @@ jobs:
4651
needs:
4752
- quality
4853

49-
defaults:
50-
run:
51-
working-directory: ./firmware
52-
5354
strategy:
5455
matrix:
5556
config:
@@ -60,16 +61,23 @@ jobs:
6061
steps:
6162
- uses: actions/checkout@v4
6263
- uses: cachix/install-nix-action@v30
64+
- uses: cachix/cachix-action@v15
65+
with:
66+
name: devenv
67+
- name: Install devenv.sh
68+
run: nix profile install nixpkgs#devenv
6369

6470
- name: Build
6571
env:
6672
WIFI_PASSWORD: super secret
6773
MQTT_PASSWORD: lol nope
6874
CONFIG: "./configs/${{ matrix.config }}"
75+
shell: devenv shell bash -- -e {0}
6976
run: |
70-
eval "$(nix print-dev-env)"
7177
set -x
7278
79+
cd ./firmware
80+
7381
rustup target add thumbv6m-none-eabi
7482
rustup show
7583

.github/workflows/formatting.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: cachix/install-nix-action@v30
18+
- uses: cachix/cachix-action@v15
19+
with:
20+
name: devenv
21+
- name: Install devenv.sh
22+
run: nix profile install nixpkgs#devenv
1823

1924
- name: Format
20-
run: |
21-
eval "$(nix print-dev-env)"
22-
treefmt --fail-on-change
25+
shell: devenv shell bash -- -e {0}
26+
run: treefmt --fail-on-change

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Devenv
2+
.devenv*
3+
devenv.local.nix
4+
5+
# direnv
6+
.direnv
7+
8+
# pre-commit
9+
.pre-commit-config.yaml

devenv.lock

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"nodes": {
3+
"devenv": {
4+
"locked": {
5+
"dir": "src/modules",
6+
"lastModified": 1736426010,
7+
"owner": "cachix",
8+
"repo": "devenv",
9+
"rev": "1c384bc4be3ee571511fbbc6fdc94fe47d60f6cf",
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": 1733328505,
23+
"owner": "edolstra",
24+
"repo": "flake-compat",
25+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
26+
"type": "github"
27+
},
28+
"original": {
29+
"owner": "edolstra",
30+
"repo": "flake-compat",
31+
"type": "github"
32+
}
33+
},
34+
"gitignore": {
35+
"inputs": {
36+
"nixpkgs": [
37+
"pre-commit-hooks",
38+
"nixpkgs"
39+
]
40+
},
41+
"locked": {
42+
"lastModified": 1709087332,
43+
"owner": "hercules-ci",
44+
"repo": "gitignore.nix",
45+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
46+
"type": "github"
47+
},
48+
"original": {
49+
"owner": "hercules-ci",
50+
"repo": "gitignore.nix",
51+
"type": "github"
52+
}
53+
},
54+
"nixpkgs": {
55+
"locked": {
56+
"lastModified": 1733477122,
57+
"owner": "cachix",
58+
"repo": "devenv-nixpkgs",
59+
"rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857",
60+
"type": "github"
61+
},
62+
"original": {
63+
"owner": "cachix",
64+
"ref": "rolling",
65+
"repo": "devenv-nixpkgs",
66+
"type": "github"
67+
}
68+
},
69+
"pre-commit-hooks": {
70+
"inputs": {
71+
"flake-compat": "flake-compat",
72+
"gitignore": "gitignore",
73+
"nixpkgs": [
74+
"nixpkgs"
75+
]
76+
},
77+
"locked": {
78+
"lastModified": 1735882644,
79+
"owner": "cachix",
80+
"repo": "pre-commit-hooks.nix",
81+
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
82+
"type": "github"
83+
},
84+
"original": {
85+
"owner": "cachix",
86+
"repo": "pre-commit-hooks.nix",
87+
"type": "github"
88+
}
89+
},
90+
"root": {
91+
"inputs": {
92+
"devenv": "devenv",
93+
"nixpkgs": "nixpkgs",
94+
"pre-commit-hooks": "pre-commit-hooks"
95+
}
96+
}
97+
},
98+
"root": "root",
99+
"version": 7
100+
}

devenv.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{pkgs, ...}: {
2+
packages = with pkgs; [
3+
# Code formatting tools
4+
treefmt
5+
alejandra
6+
mdl
7+
rustfmt
8+
9+
# Rust toolchain
10+
rustup
11+
probe-rs
12+
13+
# Extra tools for control program
14+
cargo-cross
15+
16+
# Sensor firmware toolchain
17+
esphome
18+
];
19+
}

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

flake.lock

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)