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

Switch back to nci #27

Closed
wants to merge 2 commits into from
Closed
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
136 changes: 136 additions & 0 deletions flake.lock

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

29 changes: 16 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";

# Rust
nci.url = "github:yusdacra/nix-cargo-integration";
nci.inputs.nixpkgs.follows = "nixpkgs";
nci.inputs.parts.follows = "flake-parts";

# Dev tools
treefmt-nix.url = "github:numtide/treefmt-nix";
};
Expand All @@ -12,26 +17,28 @@
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [
inputs.nci.flakeModule
inputs.treefmt-nix.flakeModule
];
perSystem = { config, self', pkgs, lib, system, ... }:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
nonRustDeps = [
pkgs.libiconv
];
crateOutputs = config.nci.outputs."rust-nix-template";
in
{
# Rust package
packages.default = pkgs.rustPlatform.buildRustPackage {
inherit (cargoToml.package) name version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nci = {
projects."rust-nix-template".path = ./.;
crates = {
"rust-nix-template" = { };
};
};

# Rust package
packages.default = crateOutputs.packages.release;

# Rust dev environment
devShells.default = pkgs.mkShell {
inputsFrom = [
crateOutputs.devShell
config.treefmt.build.devShell
];
shellHook = ''
Expand All @@ -42,13 +49,9 @@
echo "🍎🍎 Run 'just <recipe>' to get started"
just
'';
buildInputs = nonRustDeps;
nativeBuildInputs = with pkgs; [
just
rustc
cargo
cargo-watch
rust-analyzer
];
};

Expand Down
Loading