Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve nix devx + verify it in CI #219

Merged
36 commits merged into from Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
454634e
added perl to flake nix
Jan 8, 2024
615fb2a
Merge remote-tracking branch 'old-origin/main' into eg/nix-on-develop
Jan 18, 2024
02f0fb3
openssl no vendor
Jan 18, 2024
d458e9f
updated flake nix
Feb 6, 2024
e0a592c
can now build buffrs
Feb 6, 2024
890d147
formatted flake and verifying act gives same output as CI
Feb 6, 2024
05b3233
it builds against latest
Feb 6, 2024
43b22dd
enabled ci to be triggered manually
Feb 6, 2024
b5d17e0
flake cleanup
Feb 6, 2024
2e0b68a
we now run nix flake check in ci
Feb 6, 2024
a918508
trying the flake check on macos
Feb 6, 2024
aecc004
fixed up the flake and expanded the nix checks
Feb 6, 2024
60f3be7
syntax error
Feb 6, 2024
369540e
renamed nix workflow
Feb 6, 2024
1227239
finalised the CI checks
Feb 6, 2024
dcb9090
added the formatter to the outputs
Feb 6, 2024
dceda6d
remove envrc
Feb 7, 2024
52978c7
renamed vars
Feb 7, 2024
8892f80
changed the fmt script to support nixfmt
Feb 7, 2024
c2679d0
skeleton
Feb 7, 2024
255348e
set up rust toolchain with fenix
Feb 7, 2024
0e3563f
added custom libgit2
Feb 7, 2024
39cb6e0
all tests pass locally with latest libgit2
Feb 7, 2024
7f1b01c
maybe
Feb 8, 2024
990d464
flake check passes locally
Feb 8, 2024
dc561d1
updated toolchain
Feb 8, 2024
ac71468
renamed .nix to nix
Feb 8, 2024
48a5b39
changed flake.nix to point to new nix folder
Feb 8, 2024
a629643
now override cranes rust toolchain
Feb 8, 2024
9219808
rerunning ci
Feb 8, 2024
b028388
reducing scope of mac checks to speed up job time
Feb 8, 2024
433cadc
nvm - something else was the slow thing
Feb 8, 2024
46d45b8
binned the latest libgit2
Feb 8, 2024
40fd2ec
empty commit to test caching
Feb 8, 2024
a5d333b
reduce the scope of the mac CI job to improve execution time
Feb 8, 2024
f69f04e
run nix check on mac only after a merge succeeds
Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
This conversation was marked as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

env:
MINIMUM_LINE_COVERAGE_PERCENT: 35
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/nix_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Nix Buffers CI

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
check_flake_w_nix_on_ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Run `nix flake check`
run: nix flake check

check_flake_w_nix_on_mac:
runs-on: macos-latest
This conversation was marked as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Run `nix flake check`
run: nix flake check
79 changes: 64 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,76 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
outputs = {
self,
flake-utils,
naersk,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = (import nixpkgs) {
inherit system;
};
inherit (pkgs) lib;

naersk' = pkgs.callPackage naersk {};
nativeBuildInputs = with pkgs; [ pkg-config ];
in rec {
packages.default = naersk'.buildPackage {
inherit nativeBuildInputs;
src = ./.;
buildInputs = with pkgs; [ openssl ] ++ (pkgs.lib.lists.optionals (stdenv.isDarwin) [ darwin.apple_sdk.frameworks.SystemConfiguration ]);
nativeBuildInputs = with pkgs; [pkg-config];

darwin_frameworks = with pkgs.darwin.apple_sdk.frameworks; [
Security
SystemConfiguration
];

dev_tools = with pkgs; [
This conversation was marked as resolved.
Show resolved Hide resolved
cargo
rustc
];

dependencies = with pkgs;
[
libgit2
openssl
]
++ lib.lists.optionals stdenv.isDarwin darwin_frameworks;

env_vars = {
LIBGIT2_NO_VENDOR = 1;
OPENSSL_NO_VENDOR = 1;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; nativeBuildInputs ++ [
cargo
rustc
];
in rec {
# NB: if this does not build and you need to modify the file,
# please ensure you also make the corresponding changes in the devshell
packages.default = naersk'.buildPackage ({
This conversation was marked as resolved.
Show resolved Hide resolved
inherit nativeBuildInputs;
src = ./.;
buildInputs = dev_tools ++ dependencies;
}
// env_vars);

devShells.default = pkgs.mkShell ({
buildInputs = nativeBuildInputs ++ dev_tools ++ dependencies;
}
// env_vars);

formatter = pkgs.alejandra;

checks = {
builds = packages.default;
nix-files-are-formatted = pkgs.stdenvNoCC.mkDerivation {
name = "fmt-check";
dontBuild = true;
src = ./.;
doCheck = true;
nativeBuildInputs = with pkgs; [alejandra];
checkPhase = ''
alejandra -c .
This conversation was marked as resolved.
Show resolved Hide resolved
'';
installPhase = ''
mkdir "$out"
'';
};
};
checks.builds = packages.default;
}
);
}
Loading