ha-now-playing/flake.nix

64 lines
1.7 KiB
Nix
Raw Normal View History

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 { };
rustToolchain =
(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
2021-11-23 14:23:12 +01:00
buildInputs = [
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 {
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 {
inherit buildInputs;
2022-03-21 17:41:49 +01:00
nativeBuildInputs = [ cargo-edit cargo-expand cargo-diet cargo-feature cargo-outdated rust-analyzer pre-commit jq gitflow ] ++ 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
}