refactorings

This commit is contained in:
Ingolf Wagner 2023-06-09 02:32:28 +02:00
parent 761bdf91a0
commit 3361247e7e
Signed by: palo
GPG key ID: 76BF5F1928B9618B
6 changed files with 87 additions and 136 deletions

View file

@ -1,8 +1,9 @@
{
imports = [
./gui
./mainUser.nix
./media
./network
./terminal
./mainUser.nix
];
}

View file

@ -0,0 +1,13 @@
{ pkgs, lib, ... }:
with lib;
{
options.components.media = {
enable = lib.mkEnableOption "Media configurations";
};
imports = [ ./icecast.nix ];
config = mkIf config.components.media.enable {
# todo extract xorg stuff to prepare wayland
};
}

View file

@ -0,0 +1,71 @@
# --------------------------------------------------
# How to use?
# * start the icecast
# * connect via mixxx to it.
# * add the podcast to mpd in the same network
# --------------------------------------------------
{ pkgs, config, lib, ... }:
with lib;
let
# todo : make option
user = "username";
password = "password";
mountPoint = "/radio.mp3";
maxListeners = 20;
in
{
options.components.media.icecast.enable = mkOption {
type = lib.types.bool;
#default = config.components.media.enable;
default = false;
};
config = mkIf (config.components.media.icecast.enable) {
services.icecast = {
enable = true;
hostname = config.networking.hostName;
admin = {
user = "palo";
password = "palo";
};
# http://icecast.org/docs/icecast-2.4.1/config-file.html
extraConf = ''
<mount type="normal">
<mount-name>${mountPoint}</mount-name>
<username>${user}</username>
<password>${password}</password>
<max-listeners>${toString maxListeners}</max-listeners>
<max-listener-duration>3600</max-listener-duration>
<charset>UTF8</charset>
<public>1</public>
<stream-name>Palos Awesome Stream</stream-name>
<stream-description>Kick ass Tracks</stream-description>
<stream-url>https://ingolf-wagner.de</stream-url>
<genre>classical</genre>
<bitrate>320</bitrate>
<type>application/ogg</type>
<subtype>vorbis</subtype>
<hidden>1</hidden>
<burst-size>65536</burst-size>
<mp3-metadata-interval>4096</mp3-metadata-interval>
</mount>
'';
};
# use port which I can see in iptable -L -v -n
networking.firewall = {
allowedTCPPorts = [ config.services.icecast.listen.port ];
allowedUDPPorts = [ config.services.icecast.listen.port ];
};
# don't want to have the service running all the time
# ---------------------------------------------------
systemd.services.icecast.wantedBy = lib.mkForce [ ];
systemd.services.icecast.after = lib.mkForce [ ];
};
}

View file

@ -3,7 +3,7 @@
# networking.firewall.trustedInterfaces = [ "wg0" ];
networking.firewall.allowedUDPPorts = [ 51820 ];
sops.secrets.wireguard_private = { };
#boot.kernel.sysctl."net.ipv4.ip_forward" = true;
# Enable WireGuard
networking.wg-quick.interfaces = {

View file

@ -1,73 +0,0 @@
{ config, lib, pkgs, ... }:
let
library = import ../../library { inherit pkgs lib; };
mixxxBin = pkgs.writeShellScriptBin "mixxx"
"${pkgs.mixxx}/bin/mixxx --settingsPath ${config.users.users.mainUser.home}/music-library/mixxx";
mixxxDesktop = library.desktopFile mixxxBin { longName = "Mixxx"; };
mixxxFreeBin = pkgs.writeShellScriptBin "mixxx-free"
"${pkgs.mixxx}/bin/mixxx --settingsPath ${config.users.users.mainUser.home}/music-library-free/mixxx";
mixxxFreeDesktop = library.desktopFile mixxxFreeBin { longName = "Mixxx"; };
in
{
system.custom.audio = {
enable = true;
sinks = [{
name = "movieLimiterSink";
queue = [
{
# compress all sounds
plugin = "dyson_compress_1403";
label = "dysonCompress";
control = [
"0" # peak limit (dB)
"1" # release time (secons)
"0.2" # fast compression ration (unknown what that means)
"0.8" # compression ratio
];
}
{
# limit sound
plugin = "fast_lookahead_limiter_1913";
label = "fastLookaheadLimiter";
control = [
"20" # input gain (db)
"-10" # limit (db)
"1.1" # release time (s)
];
}
{
# avoid deep sounds
plugin = "dj_eq_1901";
label = "dj_eq";
control = [
"-9" # low gain (db) (100Hz)
"0" # mid gain (db) (1000Hz)
"0" # high gain (db) (10000Hz)
];
}
];
}];
};
programs.custom = {
easytag.enable = true;
espeak.enable = true;
};
environment.systemPackages = with pkgs; [
audacious
sox
id3v2
mixxxBin
mixxxDesktop
mixxxFreeBin
mixxxFreeDesktop
];
}

View file

@ -1,61 +0,0 @@
# --------------------------------------------------
# How to use?
# * start the icecast
# * connect via mixxx to it.
# * add the podcast to mpd in the same network
# --------------------------------------------------
{ pkgs, config, lib, ... }:
let
user = "username";
password = "password";
mountPoint = "/radio.mp3";
maxListeners = 20;
in
{
services.icecast = {
enable = true;
hostname = config.networking.hostName;
admin = {
user = "palo";
password = "palo";
};
# http://icecast.org/docs/icecast-2.4.1/config-file.html
extraConf = ''
<mount type="normal">
<mount-name>${mountPoint}</mount-name>
<username>${user}</username>
<password>${password}</password>
<max-listeners>${toString maxListeners}</max-listeners>
<max-listener-duration>3600</max-listener-duration>
<charset>UTF8</charset>
<public>1</public>
<stream-name>Palos Awesome Stream</stream-name>
<stream-description>Kick ass Tracks</stream-description>
<stream-url>https://ingolf-wagner.de</stream-url>
<genre>classical</genre>
<bitrate>320</bitrate>
<type>application/ogg</type>
<subtype>vorbis</subtype>
<hidden>1</hidden>
<burst-size>65536</burst-size>
<mp3-metadata-interval>4096</mp3-metadata-interval>
</mount>
'';
};
# use port which I can see in iptable -L -v -n
networking.firewall = {
allowedTCPPorts = [ config.services.icecast.listen.port ];
allowedUDPPorts = [ config.services.icecast.listen.port ];
};
# don't want to have the service running all the time
# ---------------------------------------------------
systemd.services.icecast.wantedBy = lib.mkForce [ ];
systemd.services.icecast.after = lib.mkForce [ ];
}