pamedia-rs/flake.nix
2023-07-03 13:54:33 +02:00

60 lines
1.5 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nmattia/naersk/master";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
naersk,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {inherit system overlays;};
naersk-lib = pkgs.callPackage naersk {};
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
buildInputs = [
rustToolchain
pkgs.libpulseaudio.dev
];
nativeBuildInputs = [
pkgs.pkgconf
];
in rec {
packages.pamedia = naersk-lib.buildPackage {
inherit buildInputs nativeBuildInputs;
root = ./.;
pname = "pamedia";
};
packages.default = packages.pamedia;
defaultApp = flake-utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
overlays = final: prev: {
pamedia = packages.pamedia;
};
devShell = with pkgs;
mkShell {
buildInputs = [cargo rustc rustfmt pre-commit rustPackages.clippy cargo-edit cargo-feature cargo-outdated rust-analyzer] ++ buildInputs;
nativeBuildInputs = [libnotify] ++ nativeBuildInputs;
};
});
}