Created
September 13, 2022 09:12
-
-
Save eatb33ts/dd5a45854e26a2aa434964decdf698e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: Mopidy, purple(pidgin), mpd, and others. maybe | |
{ pkgs, lib, config, ... }: | |
let | |
unstable = <nixos-unstable>; | |
nitterFQDN = "nitter.${config.networking.fqdn}"; | |
libredditFQDN = "libreddit.${config.networking.fqdn}"; | |
invidiousFQDN = "invidious.${config.networking.fqdn}"; | |
searxFQDN = "searx.${config.networking.fqdn}"; | |
# These are only installed if you have an x server enabled. | |
xtools = if config.services.xserver.enable then with unstable; [ | |
# Youtube | |
freetube | |
gtk-pipe-viewer | |
minitube | |
tartube-yt-dlp | |
# Youtube music | |
ytmdesktop | |
audiotube | |
cawbird | |
giara | |
# Imgur | |
imgur-screenshot | |
# Spotify | |
spotify-qt | |
spot | |
psst | |
# Translate | |
crow-translate | |
# Facebook Messenger | |
caprine-bin | |
# Other | |
# Music player (uses reddit and youtube as sources and needs api key from youtube) | |
# https://github.com/headsetapp/headset-electron | |
headset | |
] else []; | |
in { | |
# Add to your hosts file so you can access it locally or serve your DNS on the network | |
networking.hosts = { | |
"127.0.0.1" = [ | |
"${libredditFQDN}" | |
"${invidiousFQDN}" | |
"${nitterFQDN}" | |
"${searxFQDN}" | |
]; | |
}; | |
# Adds apps to your environment | |
environment.systemPackages = with unstable; [ | |
# Terminal based apps | |
# Youtube | |
mps-youtube | |
pipe-viewer | |
yt-dlp | |
ytfzf | |
ytcc | |
# Youtube music | |
ytmdl | |
oysttyer | |
rainbowstream | |
t | |
turses | |
tweet-hs | |
reddsaver | |
tui | |
# Imgur | |
imgurbash2 | |
# Spotify | |
spotifyd | |
spotify-tui | |
downonspot | |
ncspot | |
spotdl | |
# Internet Searches | |
surfraw | |
# Translation | |
translate-shell | |
# "hacker" "news" | |
haxor-news | |
# Other | |
gallery-dl | |
] ++ xtools; | |
# Libreddit | |
services.libreddit = { | |
enable = lib.mkDefault true; | |
port = 3357; | |
}; | |
# Invidious | |
services.invidious = { | |
enable = lib.mkDefault true; | |
port = 3255; | |
domain = "${invidiousFQDN}"; | |
settings = { | |
https_only = config.security.acme.acceptTerms; | |
external_port = if config.security.acme.acceptTerms then 443 else 80; | |
}; | |
}; | |
# Nitter | |
services.nitter = { | |
enable = lib.mkDefault true; | |
server = { | |
hostname = "${nitterFQDN}"; | |
address = "127.0.0.1"; | |
https = config.security.acme.acceptTerms; | |
}; | |
preferences = { | |
replaceTwitter = "${nitterFQDN}"; | |
replaceInstagram = "farside.link/bibliogram"; | |
# Use your invidious instance if it is enabled. | |
replaceYouTube = if config.services.invidious.enable then "${config.services.invidious.domain}" else "farside.link/invidious"; | |
}; | |
}; | |
# Searx | |
services.searx = { | |
enable = true; | |
settings = { | |
general = { | |
debug = false; | |
instance_name = "${fqdn}"; | |
}; | |
ui = { | |
default_theme = "simple"; | |
}; | |
server = { | |
port = 8980; | |
bind_address = "127.0.0.1"; | |
secret_key = "CHANGEmeTHISisSuPpOsEd624329852984561TObeSECRET9824398r7t"; | |
base_url = if config.security.acme.acceptTerms then "https://${fqdn}" else "http://${fqdn}"; | |
}; | |
}; | |
}; | |
services.nginx = { | |
enable = lib.mkDefault true; | |
virtualHosts."${libredditFQDN}" = { | |
enableACME = config.security.acme.acceptTerms; | |
forceSSL = config.security.acme.acceptTerms; | |
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.libreddit.port}"; | |
}; | |
virtualHosts."${invidiousFQDN}" = { | |
enableACME = config.security.acme.acceptTerms; | |
forceSSL = config.security.acme.acceptTerms; | |
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.invidious.port}"; | |
}; | |
virtualHosts."${nitterFQDN}" = { | |
enableACME = config.security.acme.acceptTerms; | |
forceSSL = config.security.acme.acceptTerms; | |
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.nitter.server.port}"; | |
}; | |
virtualHosts."${searxFQDN}" = { | |
enableACME = config.security.acme.acceptTerms; | |
forceSSL = config.security.acme.acceptTerms; | |
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.searx.settings.server.port}"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment