2 Commits

Author SHA1 Message Date
phundrak 971ce23e49 feat(streamlink): add streamlink 2026-06-07 19:04:53 +02:00
phundrak 88e31d3ce4 feat(opencode): add opencode configuration 2026-06-07 18:28:59 +02:00
5 changed files with 34 additions and 22 deletions
+1 -21
View File
@@ -10,25 +10,7 @@ with lib; let
cfg = config.home.dev.ai.opencode; cfg = config.home.dev.ai.opencode;
defaultPackageCli = inputs.opencode.packages.${system}.opencode; defaultPackageCli = inputs.opencode.packages.${system}.opencode;
defaultPackageDesktop = inputs.opencode.packages.${system}.desktop; defaultPackageDesktop = inputs.opencode.packages.${system}.desktop;
corsString = cors:
{
null = "";
string = v: trim v;
path = v: trim (readFile v);
}
.${
if cors == null
then "null"
else typeOf cors
};
corsList = domains: lists.remove "" (lists.forEach (strings.splitString "," domains) trim); corsList = domains: lists.remove "" (lists.forEach (strings.splitString "," domains) trim);
corsDomains = domains:
lists.flatten (
lists.forEach (lists.remove "" (lists.forEach (strings.splitString "," domains) trim)) (domain: [
"--cors"
domain
])
);
in { in {
options.home.dev.ai.opencode = { options.home.dev.ai.opencode = {
enable = mkEnableOption "Enables OpenCode"; enable = mkEnableOption "Enables OpenCode";
@@ -87,9 +69,7 @@ in {
inherit (cfg) enable tui; inherit (cfg) enable tui;
enableMcpIntegration = true; enableMcpIntegration = true;
extraPackages = with pkgs; [uv]; extraPackages = with pkgs; [uv];
settings = let settings =
cors = corsString cfg.web.cors;
in
{ {
server = mkIf cfg.web.mdns.enable { server = mkIf cfg.web.mdns.enable {
mdns = true; mdns = true;
+2
View File
@@ -12,6 +12,7 @@ in {
./mpd-mpris.nix ./mpd-mpris.nix
./mpv.nix ./mpv.nix
./ncmpcpp.nix ./ncmpcpp.nix
./streamlink.nix
]; ];
options.home.media.fullDesktop = mkEnableOption "Enables everything"; options.home.media.fullDesktop = mkEnableOption "Enables everything";
@@ -20,5 +21,6 @@ in {
mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable); mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable);
mpv.enable = mkDefault cfg.fullDesktop; mpv.enable = mkDefault cfg.fullDesktop;
ncmpcpp.enable = mkDefault config.home.media.mpd.enable; ncmpcpp.enable = mkDefault config.home.media.mpd.enable;
streamlink.enable = mkDefault config.home.media.mpv.enable;
}; };
} }
+17
View File
@@ -0,0 +1,17 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
cfg = config.home.media.streamlink;
in {
options.home.media.streamlink.enable = mkEnableOption "Enable Streamlink";
config.programs.streamlink = mkIf cfg.enable {
enable = true;
settings = {
player = "${pkgs.mpv}/bin/mpv";
};
};
}
+2
View File
@@ -30,6 +30,8 @@
}; };
permission = { permission = {
"*" = "ask"; "*" = "ask";
glob = "allow";
grep = "allow";
read = { read = {
"*" = "allow"; "*" = "allow";
"*.env" = "deny"; "*.env" = "deny";
+12 -1
View File
@@ -1,4 +1,4 @@
{ {pkgs, ...}: {
config.home.desktop.firefox = { config.home.desktop.firefox = {
enable = true; enable = true;
useZen = true; useZen = true;
@@ -13,6 +13,16 @@
smothscroll = "true"; smothscroll = "true";
}; };
extraConfig = '' extraConfig = ''
command openTwitchInMpv js -d@\
const url = new URL(document.location.href);\
const cleanUrl = url.hostname + url.pathname;\
const token = document.cookie.split("; ")\
.find(item => item.startsWith("auth-token="))?.split("=")[1];\
const auth = "--twitch-api-header=Authorization=OAuth " + token;\
const cmd = `${pkgs.streamlink}/bin/streamlink "''${auth}" "''${cleanUrl}" best`;\
tri.native.run(cmd)\
@
unbind h unbind h
unbind j unbind j
unbind k unbind k
@@ -69,6 +79,7 @@
bind < urlincrement -1 bind < urlincrement -1
bind > urlincrement 1 bind > urlincrement 1
bind ypt openTwitchInMpv
bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`) bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`)
bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`) bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`)
''; '';