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

Fix nix flake build and check this on CI #145

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ jobs:

- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2

flake:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nix
uses: DeterminateSystems/nix-installer-action@v12

- name: Cache nix dependencies
uses: DeterminateSystems/magic-nix-cache-action@v7

- name: Build
run: nix flake check

update-release-draft:
runs-on: ubuntu-latest
Expand Down
99 changes: 11 additions & 88 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 46 additions & 33 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,54 @@
{
description = "Protofetch - A source dependency management tool for Protobuf files";
description = "Protofetch - A source dependency management tool for Protobuf files";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane = { url = "github:ipetkov/crane"; inputs.nixpkgs.follows = "nixpkgs"; };
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, flake-utils, crane }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
outputs =
{
self,
nixpkgs,
flake-utils,
crane,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.lib.${system};
in {
craneLib = crane.mkLib pkgs;

protofetch = craneLib.buildPackage {
pname = "protofetch";
src = lib.cleanSourceWith {
src = ./.; # The original, unfiltered source
filter = path: type: (lib.hasSuffix "\.proto" path) || (craneLib.filterCargoSources path type);
};
buildInputs = [
pkgs.openssl
pkgs.libgit2
pkgs.pkg-config
] ++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security ];
preBuild = ''
export HOME=$(mktemp -d)
'';
};
in
{
packages = rec {
default = protofetch;
protofetch = craneLib.buildPackage {
pname = "protofetch";
src = lib.cleanSourceWith {
src = ./.; # The original, unfiltered source
filter = path: type:
(lib.hasSuffix "\.proto" path) ||
(craneLib.filterCargoSources path type);
};
buildInputs = with pkgs; [
openssl
libgit2
pkg-config
] ++ (if stdenv.isDarwin then [darwin.apple_sdk.frameworks.Security] else []);
preBuild = ''
export HOME=$(mktemp -d)
'';
};
inherit protofetch;
default = protofetch;
};
});
checks = {
# Build the crate as part of `nix flake check`
inherit protofetch;
};
}
);
}




Loading