diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36af715..d061c44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/flake.lock b/flake.lock index 0b08c20..42bd4d3 100644 --- a/flake.lock +++ b/flake.lock @@ -2,19 +2,16 @@ "nodes": { "crane": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", "nixpkgs": [ "nixpkgs" - ], - "rust-overlay": "rust-overlay" + ] }, "locked": { - "lastModified": 1693439040, - "narHash": "sha256-t2nOxBcP0Q/XJt6Ild4v0hJ49OSl9F3nE1cdIT4xsDg=", + "lastModified": 1720975002, + "narHash": "sha256-1i521ecK2MFg+lxSk9oRx/C0SsdlI6GS6eYT79nA6TA=", "owner": "ipetkov", "repo": "crane", - "rev": "174604795d316b75777e28185c3a4918bc69b399", + "rev": "1791a5b98d2c1bf143ad85469abcfa2426f3f087", "type": "github" }, "original": { @@ -23,50 +20,16 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1692799911, - "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -77,11 +40,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1693355128, - "narHash": "sha256-+ZoAny3ZxLcfMaUoLVgL9Ywb/57wP+EtsdNGuXUJrwg=", + "lastModified": 1720955038, + "narHash": "sha256-GaliJqfFwyYxReFywxAa8orCO+EnDq2NK2F+5aSc8vo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a63a64b593dcf2fe05f7c5d666eb395950f36bc9", + "rev": "aa247c0c90ecf4ae7a032c54fdc21b91ca274062", "type": "github" }, "original": { @@ -94,35 +57,10 @@ "root": { "inputs": { "crane": "crane", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "crane", - "flake-utils" - ], - "nixpkgs": [ - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1691374719, - "narHash": "sha256-HCodqnx1Mi2vN4f3hjRPc7+lSQy18vRn8xWW68GeQOg=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "b520a3889b24aaf909e287d19d406862ced9ffc9", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, @@ -137,21 +75,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 5a3e3a0..7593652 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }; + } + ); } - - - -