ha-now-playing/flake.nix
2022-01-14 10:06:26 +01:00

59 lines
1.6 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
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 = "utils";
};
};
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
naersk-lib = pkgs.callPackage naersk { };
buildInputs = [
(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
pkgs.openssl
];
nativeBuildInputs = [
pkgs.pkg-config
];
in
rec {
packages.ha-now-playing = naersk-lib.buildPackage
{
inherit buildInputs nativeBuildInputs;
pname = "ha-now-playing";
root = ./.;
};
defaultPackage = packages.ha-now-playing;
apps.ha-now-playing = utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
defaultApp = apps.ha-now-playing;
overlays = final: prev: {
ha-now-playing = packages.ha-now-playing;
};
devShell = with pkgs; mkShell {
nativeBuildInputs = [ jq ] ++ nativeBuildInputs;
buildInputs = [ cargo-edit cargo-expand cargo-diet cargo-feature cargo-outdated pre-commit ] ++ buildInputs;
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
}