Compare commits

..

2 commits

Author SHA1 Message Date
f861550625
Clean up unused stuff, add treefmt-nix 2024-12-02 12:53:16 +01:00
f5b39be7c1
flake.lock: Update
Flake lock file updates:

• Updated input 'crane':
    'github:ipetkov/crane/117ac48319c0dbcff5540781c7c5b18166e33f6a?narHash=sha256-Cho%2BTPHCIfx/sVo5scjNDP2XUCpUxcyKvoMlJ8w9dgQ%3D' (2023-10-13)
  → 'github:ipetkov/crane/76d64e779e2fbaf172110038492343a8c4e29b55?narHash=sha256-Hh0khbqBeCtiNS0SJgqdWrQDem9WlPEc2KF5pAY%2Bst0%3D' (2024-12-01)
• Removed input 'crane/flake-compat'
• Removed input 'crane/flake-utils'
• Removed input 'crane/nixpkgs'
• Removed input 'crane/rust-overlay'
• Updated input 'flake-utils':
    'github:numtide/flake-utils/ff7b65b44d01cf9ba6a71320833626af21126384?narHash=sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt%2BxmY%3D' (2023-09-12)
  → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5e4c2ada4fcd54b99d56d7bd62f384511a7e2593?narHash=sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0%3D' (2023-10-11)
  → 'github:NixOS/nixpkgs/ac35b104800bff9028425fec3b6e8a41de2bbfff?narHash=sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE%2Bcrk%3D' (2024-12-01)
• Updated input 'pre-commit-hooks':
    'github:cachix/pre-commit-hooks.nix/42e1b6095ef80a51f79595d9951eb38e91c4e6ca?narHash=sha256-0hv4kbXxci2%2BpxhuXlVgftj/Jq79VSmtAyvfabCCtYk%3D' (2023-10-09)
  → 'github:cachix/pre-commit-hooks.nix/3308484d1a443fc5bc92012435d79e80458fe43c?narHash=sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE%3D' (2024-11-19)
• Updated input 'pre-commit-hooks/flake-compat':
    'github:edolstra/flake-compat/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9?narHash=sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm%2B504Ch3sNKLd8%3D' (2023-01-17)
  → 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04)
• Removed input 'pre-commit-hooks/flake-utils'
• Updated input 'pre-commit-hooks/gitignore':
    'github:hercules-ci/gitignore.nix/a20de23b925fd8264fd7fad6454652e142fd7f73?narHash=sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8%3D' (2022-08-14)
  → 'github:hercules-ci/gitignore.nix/637db329424fd7e46cf4185293b9cc8c88c95394?narHash=sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs%3D' (2024-02-28)
• Updated input 'pre-commit-hooks/nixpkgs':
    'github:NixOS/nixpkgs/df1eee2aa65052a18121ed4971081576b25d6b5c?narHash=sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ%2BnM40LkA%3D' (2023-07-13)
  → 'github:NixOS/nixpkgs/a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc?narHash=sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE%3D' (2024-11-05)
• Updated input 'pre-commit-hooks/nixpkgs-stable':
    'github:NixOS/nixpkgs/c37ca420157f4abc31e26f436c1145f8951ff373?narHash=sha256-otaSUoFEMM%2BLjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U%3D' (2023-06-03)
  → 'github:NixOS/nixpkgs/d063c1dd113c91ab27959ba540c0d9753409edf3?narHash=sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo%3D' (2024-11-04)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/dce60ca7fca201014868c08a612edb73a998310f?narHash=sha256-OmsnxNsjBB1DJlUuJyzDJJ7psbm4/VzokNT%2Bo0ajzFQ%3D' (2023-10-14)
  → 'github:oxalica/rust-overlay/e66c0d43abf5bdefb664c3583ca8994983c332ae?narHash=sha256-aJmAIjZfWfPSWSExwrYBLRgXVvgF5LP1vaeUGOOIQ98%3D' (2024-12-02)
• Removed input 'rust-overlay/flake-utils'
2024-12-02 12:31:14 +01:00
6 changed files with 118 additions and 132 deletions

View file

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

View file

@ -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"
]
}

View file

@ -1,24 +1,12 @@
{ {
"nodes": { "nodes": {
"crane": { "crane": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": [
"rust-overlay"
]
},
"locked": { "locked": {
"lastModified": 1697165857, "lastModified": 1733016477,
"narHash": "sha256-Cho+TPHCIfx/sVo5scjNDP2XUCpUxcyKvoMlJ8w9dgQ=", "narHash": "sha256-Hh0khbqBeCtiNS0SJgqdWrQDem9WlPEc2KF5pAY+st0=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "117ac48319c0dbcff5540781c7c5b18166e33f6a", "rev": "76d64e779e2fbaf172110038492343a8c4e29b55",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -30,27 +18,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696267196, "lastModified": 1696426674,
"narHash": "sha256-AAQ/2sD+0D18bb8hKuEEVpHUYD1GmO2Uh/taFamn6XQ=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "4f910c9827911b1ec2bf26b5a062cd09f8d89f85", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -64,11 +36,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1731533236,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -85,11 +57,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1660459072, "lastModified": 1709087332,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "gitignore.nix", "repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -100,11 +72,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1697059129, "lastModified": 1733015953,
"narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", "narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", "rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -116,27 +88,27 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1685801374, "lastModified": 1730741070,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373", "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixos-24.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1689261696, "lastModified": 1730768919,
"narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -148,20 +120,17 @@
}, },
"pre-commit-hooks": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat",
"flake-utils": [
"flake-utils"
],
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1696846637, "lastModified": 1732021966,
"narHash": "sha256-0hv4kbXxci2+pxhuXlVgftj/Jq79VSmtAyvfabCCtYk=", "narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "42e1b6095ef80a51f79595d9951eb38e91c4e6ca", "rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -176,24 +145,22 @@
"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": {
"inputs": { "inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1697249410, "lastModified": 1733106880,
"narHash": "sha256-OmsnxNsjBB1DJlUuJyzDJJ7psbm4/VzokNT+o0ajzFQ=", "narHash": "sha256-aJmAIjZfWfPSWSExwrYBLRgXVvgF5LP1vaeUGOOIQ98=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "dce60ca7fca201014868c08a612edb73a998310f", "rev": "e66c0d43abf5bdefb664c3583ca8994983c332ae",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -216,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
View file

@ -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
]; ];
}; };
}); }
);
} }

View file

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

View file

@ -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,
} }
} }
} }