ha-now-playing/flake.nix

63 lines
1.7 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 { };
rustToolchain =
(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
buildInputs = [
rustToolchain
pkgs.openssl
];
nativeBuildInputs = [
pkgs.pkg-config
];
in
rec {
packages.ha-now-playing = (naersk-lib.override {
cargo = rustToolchain;
rustc = rustToolchain;
}).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 {
inherit buildInputs;
nativeBuildInputs = [ cargo-edit cargo-expand cargo-diet cargo-feature cargo-outdated rust-analyzer pre-commit jq ] ++ nativeBuildInputs;
};
});
}