Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
3dc0fb36c2
|
@@ -10,7 +10,25 @@ with lib; let
|
||||
cfg = config.home.dev.ai.opencode;
|
||||
defaultPackageCli = inputs.opencode.packages.${system}.opencode;
|
||||
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);
|
||||
corsDomains = domains:
|
||||
lists.flatten (
|
||||
lists.forEach (lists.remove "" (lists.forEach (strings.splitString "," domains) trim)) (domain: [
|
||||
"--cors"
|
||||
domain
|
||||
])
|
||||
);
|
||||
in {
|
||||
options.home.dev.ai.opencode = {
|
||||
enable = mkEnableOption "Enables OpenCode";
|
||||
@@ -69,7 +87,9 @@ in {
|
||||
inherit (cfg) enable tui;
|
||||
enableMcpIntegration = true;
|
||||
extraPackages = with pkgs; [uv];
|
||||
settings =
|
||||
settings = let
|
||||
cors = corsString cfg.web.cors;
|
||||
in
|
||||
{
|
||||
server = mkIf cfg.web.mdns.enable {
|
||||
mdns = true;
|
||||
|
||||
@@ -12,7 +12,6 @@ in {
|
||||
./mpd-mpris.nix
|
||||
./mpv.nix
|
||||
./ncmpcpp.nix
|
||||
./streamlink.nix
|
||||
];
|
||||
|
||||
options.home.media.fullDesktop = mkEnableOption "Enables everything";
|
||||
@@ -21,6 +20,5 @@ in {
|
||||
mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable);
|
||||
mpv.enable = mkDefault cfg.fullDesktop;
|
||||
ncmpcpp.enable = mkDefault config.home.media.mpd.enable;
|
||||
streamlink.enable = mkDefault config.home.media.mpv.enable;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
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";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -30,8 +30,6 @@
|
||||
};
|
||||
permission = {
|
||||
"*" = "ask";
|
||||
glob = "allow";
|
||||
grep = "allow";
|
||||
read = {
|
||||
"*" = "allow";
|
||||
"*.env" = "deny";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{pkgs, ...}: {
|
||||
{
|
||||
config.home.desktop.firefox = {
|
||||
enable = true;
|
||||
useZen = true;
|
||||
@@ -13,16 +13,6 @@
|
||||
smothscroll = "true";
|
||||
};
|
||||
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 j
|
||||
unbind k
|
||||
@@ -79,7 +69,6 @@
|
||||
|
||||
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 ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`)
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user