spotify-adblock: init

This commit is contained in:
LavaDesu 2021-09-19 11:31:11 +07:00
parent 48f93d7b98
commit 00ceb3cf50
Signed by: cilly
GPG key ID: 6500251E087653C9
5 changed files with 210 additions and 0 deletions

17
flake.lock generated
View file

@ -444,6 +444,7 @@
"radialstatus": "radialstatus",
"rolecolor-everywhere": "rolecolor-everywhere",
"secrets": "secrets",
"spotify-adblock": "spotify-adblock",
"theme-toggler": "theme-toggler",
"tokyonight": "tokyonight",
"tree-sitter-glimmer": "tree-sitter-glimmer",
@ -471,6 +472,22 @@
"type": "github"
}
},
"spotify-adblock": {
"flake": false,
"locked": {
"lastModified": 1629619654,
"narHash": "sha256-We5lVQDLJTD2ect06poC9wJ0xDANcRbcGMHwqVCfvts=",
"owner": "abba23",
"repo": "spotify-adblock",
"rev": "d129a8d1e74df15f9f37e1da9612aa9d646b7f96",
"type": "github"
},
"original": {
"owner": "abba23",
"repo": "spotify-adblock",
"type": "github"
}
},
"theme-toggler": {
"flake": false,
"locked": {

View file

@ -21,6 +21,7 @@
# overlays
discord-tokyonight = { url = "github:DanisDGK/zelk-customizations"; flake = false; };
discover = { url = "github:trigg/Discover"; flake = false; };
spotify-adblock = { url = "github:abba23/spotify-adblock"; flake = false; };
tree-sitter-glimmer = { url = "github:alexlafroscia/tree-sitter-glimmer"; flake = false; };
tree-sitter-jsonc = { url = "gitlab:WhyNotHugo/tree-sitter-jsonc"; flake = false; };
@ -77,6 +78,7 @@
discord-tokyonight = callPackage ./packages/discord-tokyonight {};
discover-overlay = callPackage ./packages/discover {};
linux-lava = callPackage ./packages/linux-lava {};
spotify-adblock = callPackage ./packages/spotify-adblock {};
tree-sitter-glimmer = callPackage ./packages/tree-sitter-glimmer {};
tree-sitter-jsonc = callPackage ./packages/tree-sitter-jsonc {};
wine-osu = callPackage ./packages/wine-osu { inherit getPaths; };

View file

@ -0,0 +1,141 @@
From 002a25dd56233d599adda61b298d612a46267407 Mon Sep 17 00:00:00 2001
From: LavaDesu <me@lava.moe>
Date: Tue, 14 Sep 2021 08:34:05 +0700
Subject: [PATCH] cargo
---
Cargo.lock | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
create mode 100644 Cargo.lock
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 00000000000..b952e17ca90
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,122 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "aho-corasick"
+version = "0.7.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.101"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"
+
+[[package]]
+name = "memchr"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d"
+dependencies = [
+ "unicode-xid",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+
+[[package]]
+name = "serde"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "spotify-adblock"
+version = "1.0.0"
+dependencies = [
+ "lazy_static",
+ "libc",
+ "regex",
+ "serde",
+ "toml",
+]
+
+[[package]]
+name = "syn"
+version = "1.0.76"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
+]
+
+[[package]]
+name = "toml"
+version = "0.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
--
2.32.0

View file

@ -0,0 +1,32 @@
From 9a6d08d266a5e138c08e822a6ffb761db644aead Mon Sep 17 00:00:00 2001
From: LavaDesu <me@lava.moe>
Date: Sun, 19 Sep 2021 11:28:45 +0700
Subject: [PATCH] allow setting config from environment variable
---
src/lib.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lib.rs b/src/lib.rs
index 5a0d7bd961e..86f2ac04ebf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,6 +7,7 @@ use lazy_static::lazy_static;
use libc::{addrinfo, c_char, dlsym, EAI_FAIL, RTLD_NEXT};
use regex::Regex;
use serde::Deserialize;
+use std::env;
use std::ffi::CStr;
use std::fs::read_to_string;
use std::mem;
@@ -44,6 +45,7 @@ struct Config {
lazy_static! {
static ref CONFIG: Config = {
let config_paths = vec![
+ PathBuf::from(env::var("SPOTIFY_ADBLOCK_CONFIG").unwrap_or("".into())),
PathBuf::from("config.toml"),
#[allow(deprecated)] // std::env::home_dir() is only broken on Windows
std::env::home_dir().unwrap().join(".config/spotify-adblock/config.toml"),
--
2.32.0

View file

@ -0,0 +1,18 @@
{ inputs
, lib
, rustPlatform
}:
rustPlatform.buildRustPackage {
pname = "spotify-adblock";
version = "1.0";
src = inputs.spotify-adblock;
cargoSha256 = "1dabmqjvbxdgs8im7asilv4nnx6xzcbwbiy924sci1zbd5isxgfx";
cargoPatches = [ ./0001-cargo.patch ];
patches = [ ./0002-allow-setting-config-from-environment-variable.patch ];
postInstall = ''
cp ${inputs.spotify-adblock}/config.toml $out/lib
'';
}