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",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"pre-commit-hooks": "pre-commit-hooks",
|
"pre-commit-hooks": "pre-commit-hooks",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
@ -182,6 +183,26 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"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",
|
"root": "root",
|
||||||
|
|
101
flake.nix
101
flake.nix
|
@ -7,33 +7,43 @@
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.flake-utils.follows = "flake-utils";
|
|
||||||
};
|
};
|
||||||
pre-commit-hooks = {
|
pre-commit-hooks = {
|
||||||
url = "github:cachix/pre-commit-hooks.nix";
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
inputs.flake-utils.follows = "flake-utils";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
crane = {
|
crane.url = "github:ipetkov/crane";
|
||||||
url = "github:ipetkov/crane";
|
|
||||||
|
treefmt-nix = {
|
||||||
|
url = "github:numtide/treefmt-nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
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 }:
|
outputs =
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
rust-overlay,
|
||||||
|
pre-commit-hooks,
|
||||||
|
crane,
|
||||||
|
treefmt-nix,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
rustToolchain =
|
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
||||||
|
|
||||||
crane-lib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
crane-lib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
||||||
src = crane-lib.cleanCargoSource ./.;
|
src = crane-lib.cleanCargoSource ./.;
|
||||||
buildInputs = with pkgs; [
|
buildInputs =
|
||||||
] ++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
|
with pkgs;
|
||||||
|
[
|
||||||
|
]
|
||||||
|
++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
pkgconf
|
pkgconf
|
||||||
];
|
];
|
||||||
|
@ -43,12 +53,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
ha-now-playing = crane-lib.buildPackage {
|
ha-now-playing = crane-lib.buildPackage {
|
||||||
inherit cargoArtifacts src buildInputs nativeBuildInputs;
|
inherit
|
||||||
|
cargoArtifacts
|
||||||
|
src
|
||||||
|
buildInputs
|
||||||
|
nativeBuildInputs
|
||||||
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
formatter = pkgs.nixpkgs-fmt;
|
formatter = self.checks.${system}.formatting.config.build.wrapper;
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
inherit ha-now-playing;
|
inherit ha-now-playing;
|
||||||
|
@ -68,7 +83,12 @@
|
||||||
inherit ha-now-playing;
|
inherit ha-now-playing;
|
||||||
|
|
||||||
ha-now-playing-clippy = crane-lib.cargoClippy {
|
ha-now-playing-clippy = crane-lib.cargoClippy {
|
||||||
inherit cargoArtifacts src buildInputs nativeBuildInputs;
|
inherit
|
||||||
|
cargoArtifacts
|
||||||
|
src
|
||||||
|
buildInputs
|
||||||
|
nativeBuildInputs
|
||||||
|
;
|
||||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,11 +96,19 @@
|
||||||
inherit src;
|
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 {
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
nixpkgs-fmt.enable = true;
|
nixfmt-rfc-style.enable = true;
|
||||||
statix.enable = true;
|
|
||||||
deadnix.enable = true;
|
deadnix.enable = true;
|
||||||
rust-overlay-clippy = {
|
rust-overlay-clippy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -97,26 +125,29 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.default = with pkgs; mkShell {
|
devShells.default =
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
with pkgs;
|
||||||
|
mkShell {
|
||||||
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||||
|
|
||||||
name = "ha-now-playing";
|
name = "ha-now-playing";
|
||||||
inputsFrom = [ self.packages.${system}.ha-now-playing ];
|
inputsFrom = [ self.packages.${system}.ha-now-playing ];
|
||||||
packages = [
|
packages = [
|
||||||
rustToolchain
|
rustToolchain
|
||||||
cargo-edit
|
cargo-edit
|
||||||
cargo-diet
|
cargo-diet
|
||||||
cargo-feature
|
cargo-feature
|
||||||
cargo-outdated
|
cargo-outdated
|
||||||
pre-commit
|
pre-commit
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
taplo
|
taplo
|
||||||
gitflow
|
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,
|
tooltip: self.tooltip,
|
||||||
class: self.class,
|
class: self.class,
|
||||||
percentage: self.percentage,
|
percentage: self.percentage,
|
||||||
muted: self.muted
|
muted: self.muted,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue