Skip to content

Commit f44aed1

Browse files
committed
Copy Nix flake setup from RustShop
1 parent a6f1f12 commit f44aed1

File tree

8 files changed

+309
-60
lines changed

8 files changed

+309
-60
lines changed

.github/workflows/ci-nix.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: "CI (nix)"
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "main" branch
8+
push:
9+
branches: [ "main", "master" ]
10+
pull_request:
11+
branches: [ "main", "master" ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
lint:
20+
name: "Lint"
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
# Checks-out repository under $GITHUB_WORKSPACE
25+
- uses: actions/checkout@v3
26+
27+
- name: Cache install Nix packages
28+
uses: mtoohey31/cache-flake-attrs@v2
29+
with:
30+
key: ${{ runner.os }}-nix-${{ hashFiles('./flake.lock', './flake.nix') }}-lint
31+
flake_paths: ".#devShells.x86_64-linux.lint"
32+
33+
# run the same check that git `pre-commit` hook would, just in case
34+
- name: Commit check
35+
run: nix develop --ignore-environment --extra-experimental-features nix-command --extra-experimental-features flakes .#lint --command ./misc/git-hooks/pre-commit
36+
37+
38+
build:
39+
name: "Build"
40+
runs-on: ubuntu-latest
41+
steps:
42+
# Checks-out repository under $GITHUB_WORKSPACE
43+
- uses: actions/checkout@v3
44+
45+
- name: Cache install Nix packages
46+
uses: mtoohey31/cache-flake-attrs@v2
47+
with:
48+
key: ${{ runner.os }}-nix-${{ hashFiles('./flake.lock', './flake.nix', './Cargo.lock') }}-deps
49+
flake_paths: ".#deps"
50+
51+
- name: Run tests
52+
run: nix build -L --extra-experimental-features nix-command --extra-experimental-features flakes .#ci

cargo-crev/src/repo.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ impl Repo {
596596
let dependency_request =
597597
Dependency::parse(name, version_str.as_deref(), source.source_id())?;
598598
let _lock = self.config.acquire_package_cache_lock()?;
599-
if !source.query(&dependency_request, &mut |summary| summaries.push(summary)).is_ready() {
599+
if !source
600+
.query(&dependency_request, &mut |summary| summaries.push(summary))
601+
.is_ready()
602+
{
600603
source.block_until_ready()?;
601604
}
602605
let summary = if let Some(version) = version {

ci/prep_deploy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ cp cargo-crev/README.md LICENSE* "$name/"
1010
tar czvf "$name.tar.gz" "$name"
1111

1212
# Get the sha-256 checksum w/o filename and newline
13-
echo -n $(shasum -ba 256 "$name.tar.gz" | cut -d " " -f 1) > "$name.tar.gz.sha256"
13+
echo -n "$(shasum -ba 256 "$name.tar.gz" | cut -d " " -f 1)" > "$name.tar.gz.sha256"
1414

crev-wot/src/trust_set.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ impl TrustSet {
214214
.unwrap_or_else(HashSet::new);
215215

216216
let too_far = candidate_total_distance.map(|d| params.max_distance < d);
217-
let trust_too_low = too_far.unwrap_or(true) && effective_trust_level == TrustLevel::None;
217+
let trust_too_low =
218+
too_far.unwrap_or(true) && effective_trust_level == TrustLevel::None;
218219

219220
let overriden_by = if let Some(existing_override) = current_trust_set
220221
.trust_ignore_overrides

flake.lock

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

0 commit comments

Comments
 (0)