diff --git a/flake.lock b/flake.lock index 65c7845..14f3061 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "audiomenu": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714848092, + "narHash": "sha256-qR7IxBDjZpy7svaHSir8qVfuyGctAFTq5bqgyinAFyk=", + "owner": "jalil-salame", + "repo": "audiomenu", + "rev": "6b4954a8771570dec9b33caccdd6460cc8f01cca", + "type": "github" + }, + "original": { + "owner": "jalil-salame", + "repo": "audiomenu", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -418,6 +438,7 @@ }, "root": { "inputs": { + "audiomenu": "audiomenu", "devshell": "devshell", "flake-utils": "flake-utils", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index 60510b2..d59774d 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,11 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-24.05"; unstable.url = "nixpkgs/nixos-unstable"; + # Software + audiomenu = { + url = "github:jalil-salame/audiomenu"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Lix lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz"; @@ -62,6 +67,7 @@ stylix, home-manager, nixos-hardware, + audiomenu, nixvim, lix-module, ... @@ -83,8 +89,8 @@ } ); overlays = builtins.attrValues self.overlays; - scripts = import ./scripts; - scripts_overlay = final: scripts; + scripts_pkgs = import ./scripts; + scripts = final: prev: scripts_pkgs final; in { checks = forEachSupportedSystem ( @@ -115,7 +121,7 @@ packages = forEachSupportedSystem ( { pkgs, system }: - scripts pkgs + scripts_pkgs pkgs // { inherit (import ./docs { inherit pkgs lib; }) docs @@ -133,8 +139,9 @@ # Provide necessary overlays overlays = { - scripts = scripts_overlay; + inherit scripts; nixvim = nixvim.overlays.default; + audiomenu = audiomenu.overlays.default; unstable = final: prev: let diff --git a/scripts/audiomenu/.gitignore b/scripts/audiomenu/.gitignore deleted file mode 100644 index ea8c4bf..0000000 --- a/scripts/audiomenu/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/scripts/audiomenu/Cargo.lock b/scripts/audiomenu/Cargo.lock deleted file mode 100644 index 7c1755e..0000000 --- a/scripts/audiomenu/Cargo.lock +++ /dev/null @@ -1,661 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anstream" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "anstyle-parse" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - -[[package]] -name = "audiomenu" -version = "0.1.0" -dependencies = [ - "clap", - "duct", - "miette", - "serde", - "serde_json", -] - -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "backtrace-ext" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" -dependencies = [ - "backtrace", -] - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "cc" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "4.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" - -[[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - -[[package]] -name = "duct" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c" -dependencies = [ - "libc", - "once_cell", - "os_pipe", - "shared_child", -] - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "is_ci" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "miette" -version = "7.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" -dependencies = [ - "backtrace", - "backtrace-ext", - "cfg-if", - "miette-derive", - "owo-colors", - "supports-color", - "supports-hyperlinks", - "supports-unicode", - "terminal_size", - "textwrap", - "thiserror", - "unicode-width", -] - -[[package]] -name = "miette-derive" -version = "7.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "object" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "os_pipe" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d73ba8daf8fac13b0501d1abeddcfe21ba7401ada61a819144b6c2a4f32209" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "owo-colors" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "shared_child" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "smawk" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "supports-color" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9829b314621dfc575df4e409e79f9d6a66a3bd707ab73f23cb4aa3a854ac854f" -dependencies = [ - "is_ci", -] - -[[package]] -name = "supports-hyperlinks" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0a1e5168041f5f3ff68ff7d95dcb9c8749df29f6e7e89ada40dd4c9de404ee" - -[[package]] -name = "supports-unicode" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" - -[[package]] -name = "syn" -version = "2.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" -dependencies = [ - "smawk", - "unicode-linebreak", - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - -[[package]] -name = "unicode-width" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/scripts/audiomenu/Cargo.toml b/scripts/audiomenu/Cargo.toml deleted file mode 100644 index 31a45c1..0000000 --- a/scripts/audiomenu/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "audiomenu" -description = "fuzzel script to select the default audio device for pipewire+wireplumber" -version = "0.1.0" -edition = "2021" - -[dependencies] -clap = { version = "4.5.9", features = ["derive", "env"] } -duct = "0.13.7" -miette = { version = "7.2.0", features = ["fancy"] } -serde = { version = "1.0.204", features = ["derive"] } -serde_json = "1.0.120" diff --git a/scripts/audiomenu/package.nix b/scripts/audiomenu/package.nix deleted file mode 100644 index 88636da..0000000 --- a/scripts/audiomenu/package.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ lib, rustPlatform }: -let - cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); - inherit (cargoToml.package) name version description; - pname = name; - src = lib.cleanSourceWith { - src = ./.; - name = "${pname}-source"; - # Adapted from - # no need to pull in crane for just this - filter = - orig_path: type: - let - path = toString orig_path; - base = baseNameOf path; - parentDir = baseNameOf (dirOf path); - matchesSuffix = lib.any (suffix: lib.hasSuffix suffix base) [ - # Rust sources - ".rs" - # TOML files are often used to configure cargo based tools (e.g. .cargo/config.toml) - ".toml" - ]; - isCargoLock = base == "Cargo.lock"; - # .cargo/config.toml is captured above - isOldStyleCargoConfig = parentDir == ".cargo" && base == "config"; - in - type == "directory" || matchesSuffix || isCargoLock || isOldStyleCargoConfig; - }; -in -rustPlatform.buildRustPackage { - inherit pname version src; - cargoLock.lockFile = ./Cargo.lock; - useNextest = true; - meta = { - inherit description; - license = lib.licenses.mit; - homepage = "https://github.com/jalil-salame/configuration.nix"; - mainProgram = name; - }; -} diff --git a/scripts/audiomenu/src/main.rs b/scripts/audiomenu/src/main.rs deleted file mode 100644 index a542fd4..0000000 --- a/scripts/audiomenu/src/main.rs +++ /dev/null @@ -1,231 +0,0 @@ -use std::{ - fmt::{Display, Write as _}, - io::{Read, Write as _}, - process::{Command, Stdio}, -}; - -use clap::Parser; -use duct::cmd; -use miette::{bail, Context, IntoDiagnostic, Result}; -use serde::Deserialize; - -fn main() -> Result<()> { - miette::set_panic_hook(); - Opts::parse().run() -} - -/// fuzzel script to select the default audio device for pipewire+wireplumber -#[derive(Debug, Parser)] -struct Opts { - #[clap(subcommand)] - cmd: Cmd, -} - -impl Opts { - fn run(self) -> Result<()> { - self.cmd.run() - } -} - -#[derive(Debug, clap::Subcommand)] -enum Cmd { - /// Select audio sink (speakers/headphones) - SelectSink, - /// Select audio source (microphone) - SelectSource, -} - -impl Cmd { - fn run(self) -> Result<()> { - let id = match self { - Cmd::SelectSink => { - let devices = get_sinks().wrap_err("failed to get sinks")?; - let selected = select( - devices.iter().map(|dev| dev.name.as_ref()), - Some("Select input>"), - ) - .wrap_err("failed to select a default sink")?; - if selected.is_empty() { - eprintln!("did not select a device"); - return Ok(()); - } - let Some(dev) = devices.into_iter().find(|dev| dev.name == selected) else { - bail!("couldn't find a device matching `{selected}`"); - }; - dev.id - } - Cmd::SelectSource => { - let devices = get_sources().wrap_err("failed to get sinks")?; - let selected = select( - devices.iter().map(|dev| dev.name.as_ref()), - Some("Select output>"), - ) - .wrap_err("failed to select a default source")?; - if selected.is_empty() { - eprintln!("did not select a device"); - return Ok(()); - } - let Some(dev) = devices.into_iter().find(|dev| dev.name == selected) else { - bail!("couldn't find a device matching `{selected}`"); - }; - dev.id - } - }; - cmd!("wpctl", "set-default", id.to_string()) - .run() - .map(drop) - .into_diagnostic() - .wrap_err("failed to set default input") - } -} - -#[derive(Debug, Deserialize)] -struct PWNode { - #[serde(rename = "type")] - node_type: Box, - #[serde(default)] - info: PWNodeInfo, - // json ignores the rest of the fields by default -} - -#[derive(Debug, Deserialize, Default)] -struct PWNodeInfo { - props: PWNodeProps, - // json ignores the rest of the fields by default -} - -#[derive(Debug, Deserialize, Default)] -struct PWNodeProps { - #[serde(rename = "object.id")] - object_id: u32, - #[serde(rename = "node.description", default)] - node_description: Box, - #[serde(rename = "media.class", default)] - media_class: Box, - // json ignores the rest of the fields by default -} - -struct AudioDevice { - id: u32, - name: Box, - _side: S, -} - -/// Output (e.g. speakers) -struct AudioSink; - -/// Input (e.g. microphone) -struct AudioSource; - -fn get_sinks() -> Result>> { - get_devices() -} - -fn get_sources() -> Result>> { - get_devices() -} - -fn get_devices() -> Result>> -where - AudioDevice: TryFrom, -{ - Ok(get_nodes()? - .into_iter() - .filter_map(|node| AudioDevice::::try_from(node).ok()) - .collect()) -} - -impl TryFrom for AudioDevice { - type Error = miette::Report; - - fn try_from(value: PWNode) -> std::result::Result { - if value.node_type.as_ref() != "PipeWire:Interface:Node" { - bail!( - "invalid type: `{}`, expected `PipeWire:Interface:Node`", - value.node_type - ) - } - let class = value.info.props.media_class; - match class.as_ref() { - "Audio/Source" => Ok(Self { - id: value.info.props.object_id, - name: value.info.props.node_description, - _side: AudioSource, - }), - _ => bail!("invalid media.class: `{class}`, expected `Audio/Source`"), - } - } -} - -impl TryFrom for AudioDevice { - type Error = miette::Report; - - fn try_from(value: PWNode) -> std::result::Result { - if value.node_type.as_ref() != "PipeWire:Interface:Node" { - bail!( - "invalid type: `{}`, expected `PipeWire:Interface:Node`", - value.node_type - ) - } - let class = value.info.props.media_class; - match class.as_ref() { - "Audio/Sink" => Ok(Self { - id: value.info.props.object_id, - name: value.info.props.node_description, - _side: AudioSink, - }), - _ => bail!("invalid media.class: `{class}`, expected `Audio/Sink`"), - } - } -} - -fn get_nodes() -> Result> { - let dump = cmd!("pw-dump") - .read() - .into_diagnostic() - .wrap_err("failed to get devices with pw-dump")?; - serde_json::from_str(&dump) - .into_diagnostic() - .wrap_err("failed to parse pw-dump output") -} - -fn select(options: It, prompt: Option<&str>) -> Result> -where - T: Display, - It: IntoIterator, -{ - let append_line = |mut s: String, it| { - writeln!(s, "{it}").unwrap(); - s - }; - let options = options.into_iter().fold(String::new(), append_line); - let mut menu = Command::new("fuzzel"); - menu.arg("--dmenu"); - if let Some(prompt) = prompt { - menu.arg(format!("--prompt={prompt}")); - } - Ok(pipe_to_stdin_and_return_stdout(&mut menu, options)? - .trim() - .into()) -} - -fn pipe_to_stdin_and_return_stdout(cmd: &mut Command, data: impl Display) -> Result { - let mut child = cmd - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .spawn() - .into_diagnostic() - .wrap_err_with(|| format!("failed to run {cmd:?}"))?; - let mut stdin = child.stdin.take().expect("stdin not piped"); - write!(stdin, "{data}") - .into_diagnostic() - .wrap_err("failed to send data to process' stdin")?; - drop(stdin); - let mut stdout = child.stdout.take().expect("stdout not piped"); - let mut buf = String::new(); - stdout - .read_to_string(&mut buf) - .into_diagnostic() - .wrap_err("failed to retrieve output from process")?; - Ok(buf) -}