2021-11-19 17:44:10 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
inputs = {
|
2022-05-11 16:23:36 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2022-11-18 09:49:45 +01:00
|
|
|
flake-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";
|
2022-11-18 09:49:45 +01:00
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
};
|
|
|
|
pre-commit-hooks = {
|
|
|
|
url = "github:cachix/pre-commit-hooks.nix";
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
2022-01-14 10:06:26 +01:00
|
|
|
};
|
2021-11-19 17:44:10 +01:00
|
|
|
};
|
|
|
|
|
2022-11-18 09:49:45 +01:00
|
|
|
outputs = { self, nixpkgs, flake-utils, naersk, rust-overlay, pre-commit-hooks }:
|
|
|
|
flake-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 =
|
2022-11-18 09:49:45 +01:00
|
|
|
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
|
2021-11-20 17:37:14 +01:00
|
|
|
in
|
2022-11-18 09:49:45 +01:00
|
|
|
{
|
|
|
|
formatter = pkgs.nixpkgs-fmt;
|
2021-11-23 14:23:12 +01:00
|
|
|
|
2022-11-18 09:49:45 +01:00
|
|
|
packages = {
|
|
|
|
ha-now-playing = (naersk-lib.override {
|
|
|
|
cargo = rustToolchain;
|
|
|
|
rustc = rustToolchain;
|
|
|
|
}).buildPackage
|
|
|
|
{
|
|
|
|
pname = "ha-now-playing";
|
|
|
|
root = ./.;
|
|
|
|
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
rustToolchain
|
|
|
|
openssl
|
|
|
|
];
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
pkgconf
|
|
|
|
cargo-edit
|
|
|
|
cargo-expand
|
|
|
|
cargo-diet
|
|
|
|
cargo-feature
|
|
|
|
cargo-outdated
|
|
|
|
rust-analyzer
|
|
|
|
pre-commit
|
|
|
|
jq
|
|
|
|
gitflow
|
|
|
|
yaml-language-server
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
packages.default = self.packages.${system}.ha-now-playing;
|
2021-11-19 17:44:10 +01:00
|
|
|
|
2022-11-18 09:49:45 +01:00
|
|
|
apps.ha-now-playing = flake-utils.lib.mkApp {
|
|
|
|
drv = self.packages.${system}.default;
|
2021-11-20 17:37:14 +01:00
|
|
|
};
|
2022-11-18 09:49:45 +01:00
|
|
|
apps.default = self.apps.${system}.ha-now-playing;
|
2021-11-19 17:44:10 +01:00
|
|
|
|
2022-11-18 09:49:45 +01:00
|
|
|
overlays = _final: _prev: {
|
|
|
|
inherit (self.packages.${system}) ha-now-playing;
|
|
|
|
};
|
|
|
|
|
|
|
|
checks = {
|
|
|
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
nixpkgs-fmt.enable = true;
|
|
|
|
statix.enable = true;
|
|
|
|
deadnix.enable = true;
|
|
|
|
clippy.enable = true;
|
|
|
|
};
|
|
|
|
};
|
2021-11-23 14:23:12 +01:00
|
|
|
};
|
|
|
|
|
2022-03-23 10:51:43 +01:00
|
|
|
devShells.default = with pkgs; mkShell {
|
2022-11-18 09:49:45 +01:00
|
|
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
|
|
|
|
|
|
name = "ha-now-playing";
|
|
|
|
inputsFrom = [ self.packages.${system}.ha-now-playing ];
|
2021-11-19 17:44:10 +01:00
|
|
|
};
|
2021-11-20 17:37:14 +01:00
|
|
|
|
|
|
|
});
|
2021-11-19 17:44:10 +01:00
|
|
|
|
|
|
|
}
|