Skip to content

Commit

Permalink
Add flake app and packages for adf-bdd (#155)
Browse files Browse the repository at this point in the history
* Add flake packages for adf-bdd
  • Loading branch information
ellmau authored Aug 4, 2023
1 parent fc0042f commit 627a1a1
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "adf-bdd-bin"
version = "0.3.0"
version = "0.3.0-dev"
authors = ["Stefan Ellmauthaler <[email protected]>"]
edition = "2021"
homepage = "https://ellmau.github.io/adf-obdd"
Expand Down
37 changes: 19 additions & 18 deletions flake.lock

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

112 changes: 72 additions & 40 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,57 +1,89 @@
{
description = "basic rust flake";
rec {
description = "adf-bdd, Abstract Dialectical Frameworks solved by Binary Decision Diagrams; developed in Dresden";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
flake-utils.follows = "flake-utils/flake-utils";
};
};
flake-utils.url = "github:numtide/flake-utils";
gitignoresrc = {
url = "github:hercules-ci/gitignore.nix";
flake = false;
};
flake-utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
};

outputs = {
outputs = inputs @ {
self,
nixpkgs,
nixpkgs-unstable,
flake-utils,
gitignoresrc,
rust-overlay,
...
} @ inputs:
{
#overlay = import ./nix { inherit gitignoresrc; };
}
// (flake-utils.lib.eachDefaultSystem (system: let
unstable = import nixpkgs-unstable {inherit system;};
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
in rec {
devShell = pkgs.mkShell {
RUST_LOG = "debug";
RUST_BACKTRACE = 1;
buildInputs = [
pkgs.rust-bin.stable.latest.rustfmt
pkgs.rust-bin.stable.latest.default
pkgs.rust-analyzer
pkgs.cargo-audit
pkgs.cargo-license
pkgs.cargo-tarpaulin
pkgs.cargo-kcov
pkgs.valgrind
pkgs.gnuplot
pkgs.kcov
];
}:
flake-utils.lib.mkFlake {
inherit self inputs;
channels.nixpkgs.overlaysBuilder = channels: [rust-overlay.overlays.default];
outputsBuilder = channels: let
pkgs = channels.nixpkgs;
toolchain = pkgs.rust-bin.stable.latest.default;
platform = pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
in rec {
packages = let
cargoMetaBin = (builtins.fromTOML (builtins.readFile ./bin/Cargo.toml)).package;
cargoMetaLib = (builtins.fromTOML (builtins.readFile ./lib/Cargo.toml)).package;
meta = {
inherit description;
homepage = "https://github.com/ellmau/adf-obdd";
license = [pkgs.lib.licenses.mit];

nativeBuildInputs = with platform; [
cargoBuildHook
cargoCheckHook
];
};
in rec {
adf-bdd = platform.buildRustPackage {
pname = "adf-bdd";
inherit (cargoMetaBin) version;
inherit meta;

src = ./.;
cargoLock.lockFile = ./Cargo.lock;

buildAndTestSubdir = "bin";
};
adf_bdd = platform.buildRustPackage {
pname = "adf_bdd";
inherit (cargoMetaLib) version;
inherit meta;

src = ./.;
cargoLock.lockFile = ./Cargo.lock;

buildAndTestSubdir = "lib";
};
};
devShells.default = pkgs.mkShell {
RUST_LOG = "debug";
RUST_BACKTRACE = 1;
shellHook = ''
export PATH=''${HOME}/.cargo/bin''${PATH+:''${PATH}}
'';
buildInputs = let
notOn = systems:
pkgs.lib.optionals (!builtins.elem pkgs.system systems);
in
[
toolchain
pkgs.rust-analyzer
pkgs.cargo-audit
pkgs.cargo-license
]
++ (notOn ["aarch64-darwin" "x86_64-darwin"] [pkgs.kcov pkgs.cargo-kcov pkgs.gnuplot pkgs.valgrind])
++ (notOn ["aarch64-linux" "aarch64-darwin" "i686-linux"] [pkgs.cargo-tarpaulin]);
};
};
}));
};
}

0 comments on commit 627a1a1

Please sign in to comment.