107 lines
2.4 KiB
Nix
107 lines
2.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
crane = {
|
|
url = "github:ipetkov/crane";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{ self, ... }@inputs:
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [ "x86_64-linux" ];
|
|
|
|
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
|
|
|
|
perSystem =
|
|
{
|
|
pkgs,
|
|
system,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [
|
|
"rustfmt"
|
|
"clippy"
|
|
];
|
|
};
|
|
|
|
crane-lib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
|
|
|
|
pname = "pamedia";
|
|
version = "0.3.0";
|
|
|
|
src = crane-lib.cleanCargoSource ./.;
|
|
|
|
buildInputs = [
|
|
rustToolchain
|
|
pkgs.libpulseaudio.dev
|
|
];
|
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
|
|
|
cargoArtifacts = crane-lib.buildDepsOnly {
|
|
inherit
|
|
src
|
|
buildInputs
|
|
nativeBuildInputs
|
|
pname
|
|
version
|
|
;
|
|
};
|
|
|
|
pamedia = crane-lib.buildPackage {
|
|
inherit
|
|
cargoArtifacts
|
|
src
|
|
buildInputs
|
|
nativeBuildInputs
|
|
pname
|
|
version
|
|
;
|
|
};
|
|
|
|
in
|
|
{
|
|
_module.args.pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
overlays = [ inputs.rust-overlay.overlays.default ];
|
|
};
|
|
|
|
packages = {
|
|
inherit pamedia;
|
|
};
|
|
packages.default = config.packages.pamedia;
|
|
|
|
overlayAttrs = {
|
|
inherit pamedia;
|
|
};
|
|
|
|
devShells.default =
|
|
with pkgs;
|
|
mkShell {
|
|
packages = [
|
|
cargo
|
|
rustc
|
|
rustfmt
|
|
pre-commit
|
|
rustPackages.clippy
|
|
cargo-edit
|
|
cargo-feature
|
|
rust-analyzer
|
|
libnotify
|
|
];
|
|
inputsFrom = [ config.packages.pamedia ];
|
|
};
|
|
};
|
|
};
|
|
|
|
}
|