ha-now-playing/flake.nix

94 lines
2.6 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-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 = "flake-utils";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, naersk, rust-overlay, pre-commit-hooks }:
flake-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;
in
{
formatter = pkgs.nixpkgs-fmt;
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;
apps.ha-now-playing = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
};
apps.default = self.apps.${system}.ha-now-playing;
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;
};
};
};
devShells.default = with pkgs; mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
name = "ha-now-playing";
inputsFrom = [ self.packages.${system}.ha-now-playing ];
};
});
}