Skip to content

Commit 0d8c7e5

Browse files
committed
build: add nix flake
1 parent baf1b60 commit 0d8c7e5

File tree

5 files changed

+113
-8
lines changed

5 files changed

+113
-8
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ guide/build/
1313
# These are backup files generated by rustfmt
1414
**/*.rs.bk
1515

16+
# IDEs
1617
.idea
18+
19+
# direnv
20+
/.direnv

flake.lock

+58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
};
6+
7+
outputs = inputs@{ flake-parts, ... }:
8+
flake-parts.lib.mkFlake { inherit inputs; } {
9+
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
10+
perSystem = { pkgs, config, inputs', system, lib, ... }: {
11+
formatter = pkgs.nixpkgs-fmt;
12+
13+
devShells.default = pkgs.mkShell {
14+
packages = [
15+
config.formatter
16+
pkgs.fd
17+
pkgs.just
18+
pkgs.nodePackages.prettier
19+
pkgs.taplo
20+
pkgs.watchexec
21+
] ++ lib.optional pkgs.stdenv.isDarwin [
22+
pkgs.pkgsBuildHost.darwin.apple_sdk.frameworks.Security
23+
pkgs.pkgsBuildHost.darwin.apple_sdk.frameworks.CoreFoundation
24+
pkgs.pkgsBuildHost.darwin.apple_sdk.frameworks.SystemConfiguration
25+
pkgs.pkgsBuildHost.libiconv
26+
];
27+
};
28+
};
29+
};
30+
}

justfile

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
_list:
22
@just --list
33

4+
# Check project.
5+
check: && clippy
6+
just --unstable --fmt --check
7+
# nixpkgs-fmt --check .
8+
fd --hidden --type=file -e=md -e=yml --exec-batch prettier --check
9+
fd --hidden -e=toml --exec-batch taplo format --check
10+
fd --hidden -e=toml --exec-batch taplo lint
11+
cargo +nightly fmt -- --check
12+
13+
# Format project.
14+
fmt:
15+
just --unstable --fmt
16+
# nixpkgs-fmt .
17+
fd --hidden --type=file -e=md -e=yml --exec-batch prettier --write
18+
fd --type=file --hidden -e=toml --exec-batch taplo format
19+
cargo +nightly fmt
20+
421
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
522
[private]
623
downgrade-for-msrv:
@@ -12,27 +29,22 @@ msrv := ```
1229
| sed -E 's/^1\.([0-9]{2})$/1\.\1\.0/'
1330
```
1431
msrv_rustup := "+" + msrv
15-
1632
non_linux_all_features_list := ```
1733
cargo metadata --format-version=1 \
1834
| jq '.packages[] | select(.source == null) | .features | keys' \
1935
| jq -r --slurp \
2036
--arg exclusions "tokio-uring,io-uring" \
2137
'add | unique | . - ($exclusions | split(",")) | join(",")'
2238
```
23-
24-
all_crate_features := if os() == "linux" {
25-
"--all-features"
26-
} else {
27-
"--features='" + non_linux_all_features_list + "'"
28-
}
39+
all_crate_features := if os() == "linux" { "--all-features" } else { "--features='" + non_linux_all_features_list + "'" }
2940

3041
# Run Clippy over workspace.
3142
clippy toolchain="":
3243
cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }}
3344

3445
# Test workspace code.
35-
[macos, windows]
46+
[macos]
47+
[windows]
3648
test toolchain="":
3749
cargo {{ toolchain }} test --lib --tests --package=actix-macros
3850
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros --no-default-features

0 commit comments

Comments
 (0)