1
0
mirror of https://github.com/kmein/niveum synced 2026-03-21 20:31:07 +01:00

3 Commits

16 changed files with 187 additions and 114 deletions

View File

@@ -1,46 +1,45 @@
{ pkgs, lib, config, ... }:
let
inherit (import <niveum/lib>) colours;
colourNames =
[ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
colourPairs = lib.getAttrs colourNames colours;
alacrittyConfig = {
background_opacity = 0.9;
colors = {
primary = { inherit (colours) background foreground; };
normal = lib.mapAttrs (_: colour: colour.dark) colourPairs;
bright = lib.mapAttrs (_: colour: colour.bright) colourPairs;
};
font = {
normal.family = "Monospace";
size = 6;
};
key_bindings = [
{
key = "Add";
mods = "Control";
action = "IncreaseFontSize";
}
{
key = "Minus";
mods = "Control";
action = "DecreaseFontSize";
}
{
key = "Key0";
mods = "Control";
action = "ResetFontSize";
}
];
};
in {
{
environment.variables.TERMINAL = "alacritty";
environment.systemPackages = [
pkgs.alacritty
];
home-manager.users.me.xdg.configFile = {
"alacritty/alacritty.yml".text = builtins.toJSON alacrittyConfig;
home-manager.users.me.xdg.configFile =
let
inherit (import <niveum/lib>) colours;
colourNames = [ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
colourPairs = lib.getAttrs colourNames colours;
in {
"alacritty/alacritty.yml".source = (pkgs.formats.yaml {}).generate "alacritty.yml" {
background_opacity = 0.9;
colors = {
primary = { inherit (colours) background foreground; };
normal = lib.mapAttrs (_: colour: colour.dark) colourPairs;
bright = lib.mapAttrs (_: colour: colour.bright) colourPairs;
};
font = {
normal.family = "Monospace";
size = 6;
};
key_bindings = [
{
key = "Add";
mods = "Control";
action = "IncreaseFontSize";
}
{
key = "Minus";
mods = "Control";
action = "DecreaseFontSize";
}
{
key = "Key0";
mods = "Control";
action = "ResetFontSize";
}
];
};
};
}

View File

@@ -1,12 +1,10 @@
{ config, lib, pkgs, ... }: {
imports = [
<niveum/modules/seafile.nix>
<niveum/modules/dropbox.nix>
];
niveum = {
dropbox.enable = true;
seafile.enable = true;
};
system.activationScripts.home-symlinks = ''

View File

@@ -36,7 +36,6 @@ in {
(self: super: {
scripts = import <niveum/packages/scripts> { pkgs = super; lib = super.lib; };
})
(import <niveum/overlays/toml.nix>)
(import <stockholm/krebs/5pkgs/haskell>)
(import <stockholm/submodules/nix-writers/pkgs>)
(import <stockholm/krebs/5pkgs/override>)
@@ -237,6 +236,7 @@ in {
./retiolum.nix
./rofi.nix
./spacetime.nix
./seafile.nix
./ssh.nix
./sshd.nix
./sudo.nix

View File

@@ -143,7 +143,7 @@ in {
};
};
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${
pkgs.writeTOML (import <niveum/lib/i3status-rust.nix> {
(pkgs.formats.toml {}).generate "i3status-rust.toml" (import <niveum/lib/i3status-rust.nix> {
inherit (config.niveum) batteryName wirelessInterface;
inherit colours;
inherit pkgs;

View File

@@ -1,47 +1,6 @@
{ pkgs, lib, ... }:
let
bridgeBotToken = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
config = {
general = {
RemoteNickFormat = "[{NICK}] ";
Charset = "utf-8";
};
telegram.kmein.Token = bridgeBotToken;
irc.freenode = {
Server = "irc.freenode.net:6667";
Nick = "ponte";
StripMarkdown = true;
};
mumble.lassulus = {
Server = "lassul.us:64738";
Nick = "krebs_bridge";
SkipTLSVerify = true;
};
gateway = [
{
name = "krebs-bridge";
enable = true;
inout = [
{
account = "irc.freenode";
channel = "#krebs";
}
{
account = "telegram.kmein";
channel = "-330372458";
}
{
account = "mumble.lassulus";
channel = 6; # "nixos"
}
];
}
];
};
in
{
nixpkgs.overlays = [
(import <niveum/overlays/toml.nix>)
(self: super: {
matterbridge = (import (super.fetchFromGitHub {
owner = "NixOS";
@@ -54,6 +13,44 @@ in
services.matterbridge = {
enable = true;
configPath = toString (pkgs.writeTOML config);
configPath =
let bridgeBotToken = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
in toString ((pkgs.formats.toml {}).generate "config.toml" {
general = {
RemoteNickFormat = "[{NICK}] ";
Charset = "utf-8";
};
telegram.kmein.Token = bridgeBotToken;
irc.freenode = {
Server = "irc.freenode.net:6667";
Nick = "ponte";
StripMarkdown = true;
};
mumble.lassulus = {
Server = "lassul.us:64738";
Nick = "krebs_bridge";
SkipTLSVerify = true;
};
gateway = [
{
name = "krebs-bridge";
enable = true;
inout = [
{
account = "irc.freenode";
channel = "#krebs";
}
{
account = "telegram.kmein";
channel = "-330372458";
}
{
account = "mumble.lassulus";
channel = 6; # "nixos"
}
];
}
];
});
};
}

View File

@@ -47,7 +47,7 @@ in
systemd.services.mpd-fm-stations =
let
stations = lib.lists.imap0 (id: {desc ? "", logo ? "https://picsum.photos/seed/${builtins.hashString "md5" stream}/300", stream, station}: { inherit id desc logo stream station; }) streams;
stationsJson = pkgs.writeText "stations.json" (builtins.toJSON stations);
stationsJson = (pkgs.formats.json {}).generate "stations.json" stations;
in {
wantedBy = [ "mpd-fm.service" ];
startAt = "hourly";

View File

@@ -119,6 +119,7 @@ in {
scripts.playlist
scripts.devanagari
scripts.betacode # ancient greek betacode to unicode converter
scripts.meteo
nur.repos.kmein.mahlzeit
# nur.repos.kmein.slide
nur.repos.kmein.vimv

View File

@@ -10,8 +10,9 @@
'';
# :def unpl \x -> return $ ":!${pkgs.haskellPackages.pointful}/bin/pointful \"" ++ x ++ "\""
# :def pl \x -> return $ ":!${pkgs.haskellPackages.pointfree}/bin/pointfree -v \"" ++ x ++ "\""
".stack/config.yaml".text = let inherit (import <niveum/lib>) kieran;
in builtins.toJSON {
".stack/config.yaml".source =
let inherit (import <niveum/lib>) kieran;
in (pkgs.formats.yaml {}).generate "config.yaml" {
templates.params = {
author-name = kieran.name;
author-email = kieran.email;

20
configs/seafile.nix Normal file
View File

@@ -0,0 +1,20 @@
{ pkgs, config, ... }:
{
services.xserver.displayManager.sessionCommands = "${pkgs.seafile-client}/bin/seafile-applet";
home-manager.users.me.xdg.configFile = {
"Seafile/Seafile Client.conf".source = (pkgs.formats.ini {}).generate "Seafile Client.conf" {
Behavior = {
hideDockIcon = false;
hideMainWindowWhenStarted = true;
};
Settings = {
computerName = config.networking.hostName;
lastShiburl = "https://box.hu-berlin.de";
};
UsedServerAddresses.main = "https://box.hu-berlin.de";
};
};
environment.systemPackages = [ pkgs.seafile-client pkgs.seafile-shared ];
}

View File

@@ -66,7 +66,7 @@ let
}
];
configFile = pkgs.writeText "urlwatch.yaml" (builtins.toJSON {
configFile = (pkgs.formats.yaml {}).generate "urlwatch.yaml" {
display = {
error = true;
new = true;
@@ -100,7 +100,7 @@ let
# chat_id = [ "18980945" ];
# };
};
});
};
urlwatch = pkgs.urlwatch.overrideAttrs (attrs: {
patches = [ <niveum/packages/urlwatch-insecure.patch> ];
});

View File

@@ -3,6 +3,5 @@
./constants.nix
./dropbox.nix
./retiolum.nix
./seafile.nix
];
}

View File

@@ -44,7 +44,7 @@ in {
stationsFile = mkOption {
type = types.path;
default = pkgs.writeText "stations.json" (builtins.toJSON cfg.stations);
default = (pkgs.formats.json {}).generate "stations.json" cfg.stations;
};
package = mkOption {

View File

@@ -1,17 +0,0 @@
{ pkgs, config, lib, ... }:
with lib;
let cfg = config.niveum.seafile;
in {
options.niveum.seafile = { enable = mkEnableOption "Seafile"; };
config = mkIf cfg.enable {
systemd.user.services.seafile = {
description = "Seafile synchronisation service";
after = [ "network.target" ];
wantedBy = [ "default.target" ];
script = "${pkgs.seafile-client}/bin/seafile-applet";
};
environment.systemPackages = [ pkgs.seafile-client pkgs.seafile-shared ];
};
}

View File

@@ -1,7 +0,0 @@
(self: super: {
writeTOML = object: super.runCommand "writeTOML" {} ''
echo '${builtins.toJSON object}' | ${super.remarshal}/bin/json2toml > $out
'';
toTOML = object: builtins.readFile (self.writeTOML object);
writeJSON = path: object: super.writeText path (builtins.toJSON object);
})

View File

@@ -94,6 +94,12 @@ in rec {
name = "tag";
};
meteo = wrapScript {
packages = [ pkgs.jq pkgs.curl pkgs.xdotool pkgs.sxiv pkgs.gnused ];
script = ./meteo.sh;
name = "meteo";
};
booksplit = wrapScript {
packages = [ pkgs.ffmpeg tag ];
script = "${voidrice}/.local/bin/booksplit";

76
packages/scripts/meteo.sh Executable file
View File

@@ -0,0 +1,76 @@
#! /bin/sh
# usage: meteo --list
# usage: meteo --update
# usage: meteo STATION
set -efu
# TODO XDG
CONFIG_DIR=$HOME/.config/wetter
STATIONS_FILE=$CONFIG_DIR/stations.json
case ${1-} in
--list)
sed -n 's/^\s*\(--[^)]\+\))$/\1/p' "$0"
jq -r -n \
--slurpfile stations_file "$STATIONS_FILE" \
'
$stations_file[0] as $known_stations |
$known_stations | keys[]
'
exit
;;
--update)
mkdir -p "$(dirname "$STATIONS_FILE")"
exec >"$STATIONS_FILE"
curl -fsS http://wetterstationen.meteomedia.de/ |
jq -Rrs '
def decodeHTML:
gsub("&auml;";"ä") |
gsub("&ouml;";"ö") |
gsub("&uuml;";"ü") |
gsub("&Auml;";"Ä") |
gsub("&Ouml;";"Ö") |
gsub("&Uuml;";"Ü") |
gsub("&szlig;";"ß")
;
[
match(".*<option value=\"/\\?map=Deutschland&station=(?<station>[0-9]+)\">(?<name>[^<]+)</option>";"g")
.captures |
map({"\(.name)":(.string)}) |
add |
{"\(.name|decodeHTML)":(.station|tonumber)}
] |
add
'
exit
;;
esac
# set -x
station=${1-103840}
station=$(jq -e -n \
--arg station "$station" \
--slurpfile stations_file "$STATIONS_FILE" \
'
$stations_file[0] as $known_stations |
$station |
if test("^[0-9]+$") then
tonumber
else
$known_stations[.]
end
')
cache="/tmp/${LOGNAME}_wetter_$station.png"
curl -sS \
"http://wetterstationen.meteomedia.de/messnetz/vorhersagegrafik/$station.png" \
-o "$cache"
if window_id=$(xdotool search --name "^sxiv - $cache$"); then
xdotool key --window "$window_id" r
else
sxiv "$cache" &
fi