Clean up unused stuff, add treefmt-nix
This commit is contained in:
parent
f5b39be7c1
commit
f861550625
6 changed files with 89 additions and 69 deletions
10
default.nix
10
default.nix
|
@ -1,10 +0,0 @@
|
|||
(import
|
||||
(
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
||||
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
||||
}
|
||||
)
|
||||
{
|
||||
src = ./.;
|
||||
}).defaultNix
|
12
dprint.json
12
dprint.json
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"$schema": "https://dprint.dev/schemas/v0.json",
|
||||
"incremental": true,
|
||||
"markdown": {
|
||||
},
|
||||
"includes": ["**/*.{md,rs}"],
|
||||
"excludes": [],
|
||||
"plugins": [
|
||||
"https://plugins.dprint.dev/markdown-0.9.2.wasm",
|
||||
"https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2"
|
||||
]
|
||||
}
|
23
flake.lock
23
flake.lock
|
@ -145,7 +145,8 @@
|
|||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks",
|
||||
"rust-overlay": "rust-overlay"
|
||||
"rust-overlay": "rust-overlay",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
@ -182,6 +183,26 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732894027,
|
||||
"narHash": "sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII+oAc=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "6209c381904cab55796c5d7350e89681d3b2a8ef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
101
flake.nix
101
flake.nix
|
@ -7,33 +7,43 @@
|
|||
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";
|
||||
};
|
||||
|
||||
crane = {
|
||||
url = "github:ipetkov/crane";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
inputs.rust-overlay.follows = "rust-overlay";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay, pre-commit-hooks, crane }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
rust-overlay,
|
||||
pre-commit-hooks,
|
||||
crane,
|
||||
treefmt-nix,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
rustToolchain =
|
||||
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
crane-lib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
||||
src = crane-lib.cleanCargoSource ./.;
|
||||
buildInputs = with pkgs; [
|
||||
] ++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
|
||||
buildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
]
|
||||
++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkgconf
|
||||
];
|
||||
|
@ -43,12 +53,17 @@
|
|||
};
|
||||
|
||||
ha-now-playing = crane-lib.buildPackage {
|
||||
inherit cargoArtifacts src buildInputs nativeBuildInputs;
|
||||
inherit
|
||||
cargoArtifacts
|
||||
src
|
||||
buildInputs
|
||||
nativeBuildInputs
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
formatter = self.checks.${system}.formatting.config.build.wrapper;
|
||||
|
||||
packages = {
|
||||
inherit ha-now-playing;
|
||||
|
@ -68,7 +83,12 @@
|
|||
inherit ha-now-playing;
|
||||
|
||||
ha-now-playing-clippy = crane-lib.cargoClippy {
|
||||
inherit cargoArtifacts src buildInputs nativeBuildInputs;
|
||||
inherit
|
||||
cargoArtifacts
|
||||
src
|
||||
buildInputs
|
||||
nativeBuildInputs
|
||||
;
|
||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
};
|
||||
|
||||
|
@ -76,11 +96,19 @@
|
|||
inherit src;
|
||||
};
|
||||
|
||||
formatting = treefmt-nix.lib.evalModule pkgs {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
nixfmt.enable = true;
|
||||
deadnix.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
nixpkgs-fmt.enable = true;
|
||||
statix.enable = true;
|
||||
nixfmt-rfc-style.enable = true;
|
||||
deadnix.enable = true;
|
||||
rust-overlay-clippy = {
|
||||
enable = true;
|
||||
|
@ -97,26 +125,29 @@
|
|||
};
|
||||
};
|
||||
|
||||
devShells.default = with pkgs; mkShell {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
devShells.default =
|
||||
with pkgs;
|
||||
mkShell {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
|
||||
name = "ha-now-playing";
|
||||
inputsFrom = [ self.packages.${system}.ha-now-playing ];
|
||||
packages = [
|
||||
rustToolchain
|
||||
cargo-edit
|
||||
cargo-diet
|
||||
cargo-feature
|
||||
cargo-outdated
|
||||
pre-commit
|
||||
rust-analyzer
|
||||
taplo
|
||||
gitflow
|
||||
name = "ha-now-playing";
|
||||
inputsFrom = [ self.packages.${system}.ha-now-playing ];
|
||||
packages = [
|
||||
rustToolchain
|
||||
cargo-edit
|
||||
cargo-diet
|
||||
cargo-feature
|
||||
cargo-outdated
|
||||
pre-commit
|
||||
rust-analyzer
|
||||
taplo
|
||||
gitflow
|
||||
|
||||
dsniff # has the tcpkill command to test dropped connections
|
||||
];
|
||||
};
|
||||
dsniff # has the tcpkill command to test dropped connections
|
||||
];
|
||||
};
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
10
shell.nix
10
shell.nix
|
@ -1,10 +0,0 @@
|
|||
(import
|
||||
(
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
||||
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
||||
}
|
||||
)
|
||||
{
|
||||
src = ./.;
|
||||
}).shellNix
|
|
@ -56,7 +56,7 @@ impl WaybarBuilder {
|
|||
tooltip: self.tooltip,
|
||||
class: self.class,
|
||||
percentage: self.percentage,
|
||||
muted: self.muted
|
||||
muted: self.muted,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue