Merge branch 'main' into develop

This commit is contained in:
Erwin Boskma 2022-11-28 14:49:03 +01:00
commit b7a7638474
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
5 changed files with 142 additions and 68 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
.direnv
result
/.pre-commit-config.yaml

View file

@ -1,7 +1,10 @@
(import (
(import
(
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
}
)
{
src = ./.;
}).defaultNix
}).defaultNix

View file

@ -1,5 +1,20 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
@ -23,11 +38,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1667482890,
"narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=",
"lastModified": 1668671332,
"narHash": "sha256-6QW9sTuLDcBLoR5EY+6LR7Y1k0dFVEMqcWY4jYOuiqM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8",
"rev": "54be84c3ac0122c2b2272fc68a9015304bc0bb73",
"type": "github"
},
"original": {
@ -37,29 +52,65 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1667292599,
"narHash": "sha256-7ISOUI1aj6UKMPIL+wwthENL22L3+A9V+jS8Is3QsRo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ef2f213d9659a274985778bff4ca322f3ef3ac68",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1667992213,
"narHash": "sha256-8Ens8ozllvlaFMCZBxg6S7oUyynYx2v7yleC5M0jJsE=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "ebcbfe09d2bd6d15f68de3a0ebb1e4dcb5cd324b",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"utils": "utils"
"pre-commit-hooks": "pre-commit-hooks",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"utils"
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1667616267,
"narHash": "sha256-EYzGCJaTNTSbUk5sa2i4/dn71YtE6uvZb9syL8GH1U0=",
"lastModified": 1668739305,
"narHash": "sha256-BJNiTOWWBMdDXMUrl1ysDr+62nqIayf8SprK/blaFM0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a785c5db0ab1b10e6ba04b7240628aea9615e9ad",
"rev": "f0ddbb639e2f23529ced79602cee6eb3903fc888",
"type": "github"
},
"original": {
@ -67,21 +118,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -2,7 +2,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nmattia/naersk/master";
inputs.nixpkgs.follows = "nixpkgs";
@ -10,52 +10,83 @@
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "utils";
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, utils, naersk, rust-overlay }:
utils.lib.eachDefaultSystem (system:
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);
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
buildInputs = [
rustToolchain
pkgs.openssl
];
nativeBuildInputs = [
pkgs.pkgconf
];
in
rec {
packages.ha-now-playing = (naersk-lib.override {
{
formatter = pkgs.nixpkgs-fmt;
packages = {
ha-now-playing = (naersk-lib.override {
cargo = rustToolchain;
rustc = rustToolchain;
}).buildPackage
{
inherit buildInputs nativeBuildInputs;
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 = packages.ha-now-playing;
apps.ha-now-playing = utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
apps.default = apps.ha-now-playing;
packages.default = self.packages.${system}.ha-now-playing;
overlays = final: prev: {
ha-now-playing = packages.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 buildInputs;
nativeBuildInputs = [ cargo-edit cargo-expand cargo-diet cargo-feature cargo-outdated rust-analyzer pre-commit jq gitflow ] ++ nativeBuildInputs;
inherit (self.checks.${system}.pre-commit-check) shellHook;
name = "ha-now-playing";
inputsFrom = [ self.packages.${system}.ha-now-playing ];
};
});

View file

@ -1,7 +1,10 @@
(import (
(import
(
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
}
)
{
src = ./.;
}).shellNix
}).shellNix