2021-11-19 17:44:10 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2021-11-20 17:37:14 +01:00
|
|
|
utils.url = "github:numtide/flake-utils";
|
2021-11-21 20:39:07 +01:00
|
|
|
naersk = {
|
|
|
|
url = "github:nmattia/naersk/master";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2022-01-14 10:06:26 +01:00
|
|
|
rust-overlay = {
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.flake-utils.follows = "utils";
|
|
|
|
};
|
2021-11-19 17:44:10 +01:00
|
|
|
};
|
|
|
|
|
2022-01-14 10:06:26 +01:00
|
|
|
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
|
2021-11-23 14:23:12 +01:00
|
|
|
utils.lib.eachDefaultSystem (system:
|
2021-11-20 17:37:14 +01:00
|
|
|
let
|
2022-01-14 10:06:26 +01:00
|
|
|
overlays = [ (import rust-overlay) ];
|
|
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
2021-11-23 14:23:12 +01:00
|
|
|
naersk-lib = pkgs.callPackage naersk { };
|
2022-01-14 10:43:59 +01:00
|
|
|
rustToolchain =
|
|
|
|
(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
|
2021-11-23 14:23:12 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2022-01-14 10:43:59 +01:00
|
|
|
rustToolchain
|
2021-11-23 14:23:12 +01:00
|
|
|
pkgs.openssl
|
|
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.pkg-config
|
|
|
|
];
|
2021-11-20 17:37:14 +01:00
|
|
|
in
|
|
|
|
rec {
|
2022-01-14 10:43:59 +01:00
|
|
|
packages.ha-now-playing = (naersk-lib.override {
|
|
|
|
cargo = rustToolchain;
|
|
|
|
rustc = rustToolchain;
|
|
|
|
}).buildPackage
|
2021-11-23 14:23:12 +01:00
|
|
|
{
|
|
|
|
inherit buildInputs nativeBuildInputs;
|
|
|
|
pname = "ha-now-playing";
|
|
|
|
root = ./.;
|
|
|
|
|
|
|
|
};
|
2021-11-20 17:37:14 +01:00
|
|
|
defaultPackage = packages.ha-now-playing;
|
2021-11-19 17:44:10 +01:00
|
|
|
|
2021-11-20 17:37:14 +01:00
|
|
|
apps.ha-now-playing = utils.lib.mkApp {
|
|
|
|
drv = self.defaultPackage."${system}";
|
|
|
|
};
|
|
|
|
defaultApp = apps.ha-now-playing;
|
2021-11-19 17:44:10 +01:00
|
|
|
|
2021-11-23 14:23:12 +01:00
|
|
|
overlays = final: prev: {
|
|
|
|
ha-now-playing = packages.ha-now-playing;
|
|
|
|
};
|
|
|
|
|
2021-11-20 17:37:14 +01:00
|
|
|
devShell = with pkgs; mkShell {
|
2022-02-13 13:29:07 +01:00
|
|
|
inherit buildInputs;
|
2022-02-13 13:49:41 +01:00
|
|
|
nativeBuildInputs = [ cargo-edit cargo-expand cargo-diet cargo-feature cargo-outdated rust-analyzer pre-commit jq ] ++ nativeBuildInputs;
|
2021-11-19 17:44:10 +01:00
|
|
|
};
|
2021-11-20 17:37:14 +01:00
|
|
|
|
|
|
|
});
|
2021-11-19 17:44:10 +01:00
|
|
|
|
|
|
|
}
|