-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add nix derivation for building cargo workspace
- Loading branch information
1 parent
2056478
commit 864ece0
Showing
8 changed files
with
176 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ inputs, self, ... }: | ||
{ | ||
perSystem = | ||
{ pkgs, config, ... }: | ||
let | ||
advisory-db = inputs.advisory-db; | ||
in | ||
{ | ||
checks = { | ||
cln = config.packages.cln; | ||
rust = config.packages.rust; | ||
cargo-audit = pkgs.craneLib.cargoAudit { | ||
src = ../../.; | ||
inherit advisory-db; | ||
}; | ||
formatting = config.treefmt.build.check self; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ self, ... }: | ||
{ | ||
perSystem = | ||
{ pkgs, config, ... }: | ||
{ | ||
packages = rec { | ||
# This package depends on git submodules so use a shell command like 'nix build .?submodules=1'. | ||
cln = pkgs.callPackage ./default.nix { inherit self pkgs config; }; | ||
rust = pkgs.callPackage ./rust.nix { craneLib = pkgs.craneLib; }; | ||
default = cln; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
pkgs, | ||
lib, | ||
craneLib, | ||
... | ||
}: | ||
let | ||
version = builtins.readFile ../../.version; | ||
src = lib.cleanSourceWith { | ||
src = ../../.; | ||
filter = path: type: (lib.hasSuffix "\.proto" path) || (craneLib.filterCargoSources path type); | ||
}; | ||
in | ||
craneLib.buildPackage { | ||
pname = "rust"; | ||
inherit src version; | ||
strictDeps = true; | ||
nativeBuildInputs = with pkgs; [ protobuf ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ self, ... }: | ||
{ | ||
perSystem = | ||
{ | ||
config, | ||
pkgs, | ||
system, | ||
... | ||
}: | ||
{ | ||
devShells = { | ||
rust = pkgs.craneLib.devShell { | ||
checks = { | ||
inherit (self.checks.${system}) rust; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ ... }: | ||
{ | ||
perSystem = | ||
{ pkgs, lib, ... }: | ||
{ | ||
treefmt = { | ||
projectRootFile = "flake.nix"; | ||
programs.nixfmt.enable = true; | ||
}; | ||
}; | ||
} |