1
0
mirror of https://github.com/kmein/niveum synced 2026-03-17 02:31:09 +01:00

1 Commits

Author SHA1 Message Date
9f0c8c7a73 wip: hass with nix 2023-02-08 10:09:24 +01:00
218 changed files with 4148 additions and 4223 deletions

View File

@@ -1,8 +0,0 @@
import sys
import unicodedata
for index, character in enumerate(sys.stdin.read().strip()):
try:
print(index, character, hex(ord(character)), unicodedata.category(character), unicodedata.name(character))
except:
print(index, character, hex(ord(character)))

View File

@@ -11,4 +11,4 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: cachix/install-nix-action@v16 - uses: cachix/install-nix-action@v16
- run: nix run .?submodules=1#apps.nixinate.${{matrix.system}}-dry-run - run: nix run .#build-${{matrix.system}}

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "secrets"]
path = secrets
url = ssh://gitea@code.kmein.de:22022/kfm/niveum-secrets.git

98
ci.nix Normal file
View File

@@ -0,0 +1,98 @@
{
inputs,
system,
name,
}: let
nixpkgs = inputs.nixos-stable;
pkgs = nixpkgs.legacyPackages.${system};
ensureFiles = paths:
pkgs.runCommand "directory" {} ''
set -efu
mkdir $out
cd $out
${
nixpkgs.lib.concatMapStringsSep "\n" (path: ''
mkdir -p "$(dirname ${nixpkgs.lib.escapeShellArg path})"
echo foo > ${nixpkgs.lib.escapeShellArg path}
'')
paths
}
'';
nixPath = nixpkgs.lib.concatStringsSep ":" ([
"niveum=${toString ./.}"
"nixos-config=${toString ./.}/systems/${name}/configuration.nix"
"system-secrets=${systemSecrets}"
"secrets=${sharedSecrets}"
"nixpkgs=${
toString (
if name == "kabsa" || name == "manakish"
then inputs.nixos-unstable
else inputs.nixos-stable
)
}"
]
++ nixpkgs.lib.mapAttrsToList (name: value: "${name}=${value}") inputs);
# cd ~/.password-store/shared && find * -type f | sed 's/.gpg$//'
sharedSecrets = ensureFiles [
"di.fm/key"
"eduroam/identity"
"eduroam/password"
"github/notification.token"
"hass/token"
"mail/cock"
"mail/fastmail"
"mail/gmail/amroplay"
"mail/gmail/kieran.meinhardt"
"mail/meinhaki"
"mail/dslalewa"
"mail/fsklassp"
"mail/posteo"
"mega/password"
"nextcloud-fysi/password"
"nextcloud/password"
"openweathermap.key"
"restic/password"
"traadfri.key"
"miniflux/password"
"wifi/Aether.psk"
"spotify/username"
"spotify/password"
];
systemSecrets = let
basic = ["retiolum.ed25519" "retiolum.key" "syncthing/cert.pem" "syncthing/key.pem" "ssh/passphrase"];
in
{
zaatar = ensureFiles (["moodle.token" "telegram/moodle-dl.token" "mpd-web.key"] ++ basic);
kabsa = ensureFiles basic;
manakish = ensureFiles basic;
tahina = ensureFiles basic;
tabula = ensureFiles basic;
ful = ensureFiles (["root.password"] ++ basic);
makanek = ensureFiles ([
"irc/retiolum"
"irc/hackint"
"irc/libera"
"irc/oftc"
"matrix/nibbana"
"maxmind/license.key"
"moodle-dl/faye.token"
"nextcloud/admin"
"nextcloud/database"
"telegram/nachtischsatan.token"
"telegram/reverse.token"
"telegram/odyssey.token"
"telegram/betacode.token"
"telegram/moodle-dl.token"
"telegram/proverb.token"
"telegram/menstruation.token"
"telegram/cool_village.token"
"telegram/kmein.token"
"telegram/krebs.token"
"telegram/prometheus.token"
"weechat/relay"
]
++ basic);
}
.${name};
in
toString (pkgs.writers.writeDash "build" "NIX_PATH=${nixPath} nix-build '<nixpkgs/nixos>' -A system --dry-run")

View File

@@ -1,394 +0,0 @@
{
pkgs,
config,
lib,
...
}: let
defaults = {
aerc.enable = true;
realName = "Kierán Meinhardt";
folders.inbox = "INBOX";
};
hu-defaults = {
imap.host = "mailbox.cms.hu-berlin.de";
imap.port = 993;
smtp.host = "mailhost.cms.hu-berlin.de";
smtp.port = 25;
smtp.tls.useStartTls = true;
};
in {
age.secrets = {
email-password-cock = {
file = ../secrets/email-password-cock.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-fysi = {
file = ../secrets/email-password-fysi.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-posteo = {
file = ../secrets/email-password-posteo.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-meinhark = {
file = ../secrets/email-password-meinhark.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-meinhaki = {
file = ../secrets/email-password-meinhaki.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-dslalewa = {
file = ../secrets/email-password-dslalewa.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-fsklassp = {
file = ../secrets/email-password-fsklassp.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
};
home-manager.users.me = {
services.mbsync = {
enable = true;
frequency = "daily";
preExec = "${pkgs.coreutils}/bin/mkdir -p ${config.home-manager.users.me.accounts.email.maildirBasePath}";
postExec = "${pkgs.notmuch}/bin/notmuch new";
};
programs.notmuch = {
enable = true;
extraConfig = {
database.path = config.home-manager.users.me.accounts.email.maildirBasePath;
new.tags = "";
user.name = defaults.realName;
user.primary_email = config.home-manager.users.me.accounts.email.accounts.posteo.address;
};
};
programs.mbsync = {
enable = true;
extraConfig = lib.concatStringsSep "\n\n" (lib.mapAttrsToList (name: account: ''
IMAPAccount ${name}
CertificateFile /etc/ssl/certs/ca-certificates.crt
Host ${account.imap.host}
PassCmd "${toString account.passwordCommand}"
User ${account.userName}
SSLType IMAPS
${lib.optionalString (lib.isInt account.imap.port) "Port ${toString account.imap.port}"}
IMAPStore ${name}-remote
Account ${name}
MaildirStore ${name}-local
Path ${config.home-manager.users.me.accounts.email.maildirBasePath}/${name}/
SubFolders Verbatim
Channel ${name}
Create Near
Expunge None
Far :${name}-remote:
Near :${name}-local:
Patterns *
Remove None
SyncState *
'')
config.home-manager.users.me.accounts.email.accounts);
};
accounts.email.accounts = rec {
hu-student =
lib.recursiveUpdate defaults
(lib.recursiveUpdate hu-defaults
rec {
userName = "meinhark";
address = "kieran.felix.meinhardt@hu-berlin.de";
aliases = ["${userName}@hu-berlin.de"];
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-meinhark.path}";
});
hu-student-cs =
lib.recursiveUpdate defaults
(lib.recursiveUpdate hu-defaults
rec {
userName = "meinhark";
address = "kieran.felix.meinhardt@informatik.hu-berlin.de";
aliases = ["${userName}@informatik.hu-berlin.de"];
imap.host = "mailbox.informatik.hu-berlin.de";
smtp.host = "mailhost.informatik.hu-berlin.de";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-meinhark.path}";
});
hu-employee =
lib.recursiveUpdate defaults
(lib.recursiveUpdate hu-defaults
rec {
userName = "meinhaki";
address = "kieran.meinhardt@hu-berlin.de";
aliases = ["${userName}@hu-berlin.de"];
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-meinhaki.path}";
aerc.extraAccounts.signature-file = toString (pkgs.writeText "signature" signature.text);
signature = {
showSignature = "append";
text = ''
${defaults.realName}
Studentische Hilfskraft / Administrator ALEW
Humboldt-Universität zu Berlin
Telefon: +49 (0)30 2093 9634
Raum 3.212, Dorotheenstraße 24, 10117 Berlin-Mitte
https://alew.hu-berlin.de
'';
};
});
hu-admin =
lib.recursiveUpdate defaults
(lib.recursiveUpdate hu-defaults
rec {
userName = "dslalewa";
address = "admin.alew.vglsprwi@hu-berlin.de";
aliases = ["${userName}@hu-berlin.de"];
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-dslalewa.path}";
inherit (hu-employee) signature;
aerc.extraAccounts.signature-file = toString (pkgs.writeText "signature" signature.text);
});
hu-fsi =
lib.recursiveUpdate defaults
(lib.recursiveUpdate hu-defaults
rec {
userName = "fsklassp";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-fsklassp.path}";
address = "${userName}@hu-berlin.de";
realName = "FSI Klassische Philologie";
aerc.extraAccounts.signature-file = toString (pkgs.writeText "signature" signature.text);
signature = {
showSignature = "append";
text = ''
Fachschafts-Initiative
Humboldt-Universität zu Berlin
Sprach- und literaturwissenschaftliche Fakultät
Institut für klassische Philologie
Unter den Linden 6
10099 Berlin
'';
};
});
fysi =
lib.recursiveUpdate defaults
rec {
address = "kieran@fysi.tech";
userName = address;
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-fysi.path}";
flavor = "fastmail.com";
};
cock =
lib.recursiveUpdate defaults
rec {
address = "2210@cock.li";
userName = address;
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-cock.path}";
realName = "";
imap.host = "mail.cock.li";
smtp.host = imap.host;
};
posteo =
lib.recursiveUpdate defaults
rec {
address = "kieran.meinhardt@posteo.net";
aliases = ["kmein@posteo.de"];
userName = address;
imap.host = "posteo.de";
smtp.host = imap.host;
primary = true;
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-posteo.path}";
# himalaya = { enable = true; backend = "imap"; sender = "smtp"; };
};
};
# programs.himalaya.enable = true;
programs.aerc = {
enable = true;
extraBinds = {
# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
global = {
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab <Enter>";
"<C-t>" = ":term<Enter>";
"?" = ":help keys<Enter>";
};
messages = {
q = ":quit<Enter>";
j = ":next <Enter>";
"<Down>" = ":next<Enter>";
"<C-d>" = ":next 50%<Enter>";
"<C-f>" = ":next 100%<Enter>";
"<PgDn>" = ":next 100%<Enter>";
k = ":prev <Enter>";
"<Up>" = ":prev<Enter>";
"<C-u>" = ":prev 50%<Enter>";
"<C-b>" = ":prev 100%<Enter>";
"<PgUp>" = ":prev 100%<Enter>";
g = ":select 0 <Enter>";
G = ":select -1<Enter>";
J = ":next-folder <Enter>";
K = ":prev-folder<Enter>";
H = ":collapse-folder<Enter>";
L = ":expand-folder<Enter>";
"<space>" = ":read -t<Enter>:next<Enter>";
v = ":mark -t<Enter>";
V = ":mark -v<Enter>";
F = ":flag -t<Enter>";
T = ":toggle-threads<Enter>";
"<Enter>" = ":view<Enter>";
d = ":prompt 'Delete? ' 'delete-message'<Enter>";
D = ":move Trash<Enter>";
A = ":archive flat<Enter>";
C = ":compose<Enter>";
rr = ":reply -a<Enter>";
rq = ":reply -aq<Enter>";
Rr = ":reply<Enter>";
Rq = ":reply -q<Enter>";
c = ":cf<space>";
"$" = ":term<space>";
"!" = ":term<space>";
"|" = ":pipe<space>";
"/" = ":search<space>";
"\\" = ":filter <space>";
n = ":next-result<Enter>";
N = ":prev-result<Enter>";
"<Esc>" = ":clear<Enter>";
"*" = ":filter -x Flagged<Enter>";
};
view = {
"/" = ":toggle-key-passthrough <Enter> /";
q = ":close<Enter>";
O = ":open<Enter>";
S = ":save<space>";
"|" = ":pipe<space>";
D = ":move Trash<Enter>";
A = ":archive flat<Enter>";
"<C-l>" = ":open-link <space>";
f = ":forward <Enter>";
rr = ":reply -a<Enter>";
rq = ":reply -aq<Enter>";
Rr = ":reply<Enter>";
Rq = ":reply -q<Enter>";
H = ":toggle-headers<Enter>";
"<C-k>" = ":prev-part<Enter>";
"<C-j>" = ":next-part<Enter>";
J = ":next <Enter>";
K = ":prev<Enter>";
};
"view::passthrough" = {
"$noinherit" = "true";
"$ex" = "<C-x>";
"<Esc>" = ":toggle-key-passthrough<Enter>";
};
compose = {
# Keybindings used when the embedded terminal is not selected in the compose
# view
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-k>" = ":prev-field<Enter>";
"<C-j>" = ":next-field<Enter>";
"<tab>" = ":next-field<Enter>";
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>";
};
"compose::editor" = {
# Keybindings used when the embedded terminal is selected in the compose view
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-k>" = ":prev-field<Enter>";
"<C-j>" = ":next-field<Enter>";
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>";
};
"compose::review" = {
# Keybindings used when reviewing a message to be sent
y = ":send <Enter>";
n = ":abort<Enter>";
p = ":postpone<Enter>";
q = ":choose -o d discard abort -o p postpone postpone<Enter>";
e = ":edit<Enter>";
a = ":attach<space>";
d = ":detach<space>";
};
terminal = {
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>";
};
};
extraConfig = {
ui.sort = "-r date";
ui.timestamp-format = "2006-01-02 15:04";
ui.mouse-enabled = true;
ui.spinner = ". , .";
general.unsafe-accounts-conf = true;
general.pgp-provider = "gpg";
viewer = {pager = "${pkgs.less}/bin/less -R";};
compose = {
address-book-cmd = "khard email --remove-first-line --parsable '%s'";
no-attachment-warning = "(attach|attached|attachments?|anbei|Anhang|angehängt)";
};
filters = {
"text/plain" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
"text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/calendar";
"text/html" = "${pkgs.aerc}/share/aerc/filters/html"; # Requires w3m, dante
# "text/html" =
# "${pkgs.aerc}/share/aerc/filters/html | ${pkgs.aerc}/share/aerc/filters/colorize";
# "text/*" =
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
"message/delivery-status" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
"message/rfc822" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
};
openers = let
as-pdf = pkgs.writers.writeDash "as-pdf" ''
d=$(mktemp -d)
trap clean EXIT
clean() {
rm -rf "$d"
}
${pkgs.libreoffice}/bin/libreoffice --headless --convert-to pdf "$1" --outdir "$d"
${pkgs.zathura}/bin/zathura "$d"/*.pdf
'';
in {
"image/*" = "${pkgs.nsxiv}/bin/nsxiv";
"application/pdf" = "${pkgs.zathura}/bin/zathura";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = toString as-pdf;
"application/vnd.oasis.opendocument.text" = toString as-pdf;
"video/*" = "${pkgs.mpv}/bin/mpv";
"audio/*" = "${pkgs.mpv}/bin/mpv";
};
};
templates = {
# new_message = "hello!";
};
};
};
}

View File

@@ -47,7 +47,7 @@
alacritty-pkg = pkgs.symlinkJoin { alacritty-pkg = pkgs.symlinkJoin {
name = "alacritty"; name = "alacritty";
paths = [ paths = [
(pkgs.writers.writeDashBin "alacritty" '' (pkgs.writeDashBin "alacritty" ''
${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yml msg create-window "$@" || ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yml msg create-window "$@" ||
${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yml "$@" ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yml "$@"
'') '')
@@ -62,7 +62,7 @@ in {
]; ];
environment.etc = { environment.etc = {
"themes/dark/alacritty.yml".source = alacritty-cfg (import ../lib/colours/owickstrom-dark.nix); "themes/dark/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/papercolor-dark.nix>);
"themes/light/alacritty.yml".source = alacritty-cfg (import ../lib/colours/owickstrom-light.nix); "themes/light/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/papercolor-light.nix>);
}; };
} }

View File

@@ -3,7 +3,7 @@
config, config,
... ...
}: let }: let
inherit (import ../lib) restic; inherit (import <niveum/lib>) restic;
in { in {
services.restic.backups.niveum = { services.restic.backups.niveum = {
initialize = true; initialize = true;
@@ -12,7 +12,7 @@ in {
OnCalendar = "8:00"; OnCalendar = "8:00";
RandomizedDelaySec = "1h"; RandomizedDelaySec = "1h";
}; };
passwordFile = config.age.secrets.restic.path; passwordFile = toString <secrets/restic/password>;
extraBackupArgs = [ extraBackupArgs = [
"--exclude=/home/kfm/projects/nixpkgs/.git" "--exclude=/home/kfm/projects/nixpkgs/.git"
"--exclude=node_modules" "--exclude=node_modules"
@@ -21,7 +21,6 @@ in {
"/home/kfm/work" "/home/kfm/work"
"/home/kfm/projects" "/home/kfm/projects"
"/home/kfm/notes" "/home/kfm/notes"
"/home/kfm/Maildir"
"/home/kfm/cloud" "/home/kfm/cloud"
"/home/kfm/.gnupg" "/home/kfm/.gnupg"
"/home/kfm/.ssh" "/home/kfm/.ssh"
@@ -39,7 +38,7 @@ in {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.writers.writeDashBin "restic-niveum" '' (pkgs.writers.writeDashBin "restic-niveum" ''
${pkgs.restic}/bin/restic -r ${restic.repository} -p ${config.age.secrets.restic.path} "$@" ${pkgs.restic}/bin/restic -r ${restic.repository} -p ${<secrets/restic/password>} "$@"
'') '')
(pkgs.writers.writeDashBin "restic-mount" '' (pkgs.writers.writeDashBin "restic-mount" ''
mountdir=$(mktemp -d) mountdir=$(mktemp -d)
@@ -47,7 +46,7 @@ in {
clean() { clean() {
rm -r "$mountdir" rm -r "$mountdir"
} }
${pkgs.restic}/bin/restic -r ${restic.repository} -p ${config.age.secrets.restic.path} mount "$mountdir" ${pkgs.restic}/bin/restic -r ${restic.repository} -p ${<secrets/restic/password>} mount "$mountdir"
'') '')
]; ];
} }

View File

@@ -4,8 +4,16 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (import ../lib) tmpfilesConfig; inherit (import <niveum/lib>) tmpfilesConfig;
in { in {
imports = [
<niveum/modules/dropbox.nix>
];
niveum = {
dropbox.enable = false;
};
systemd.tmpfiles.rules = map tmpfilesConfig [ systemd.tmpfiles.rules = map tmpfilesConfig [
{ {
type = "L+"; type = "L+";
@@ -47,13 +55,13 @@ in {
script = let script = let
kieran = { kieran = {
user = "kieran"; user = "kieran";
passwordFile = config.age.secrets.nextcloud-password-kieran.path; password = lib.fileContents <secrets/nextcloud/password>;
endpoint = "https://cloud.xn--kiern-0qa.de"; endpoint = "https://cloud.xn--kiern-0qa.de";
target = "${config.users.users.me.home}/notes"; target = "${config.users.users.me.home}/notes";
}; };
in '' in ''
mkdir -p ${lib.escapeShellArg kieran.target} mkdir -p ${lib.escapeShellArg kieran.target}
${pkgs.nextcloud-client}/bin/nextcloudcmd --non-interactive --user ${kieran.user} --password "$(cat ${kieran.passwordFile})" --path /Notes ${lib.escapeShellArg kieran.target} ${kieran.endpoint} ${pkgs.nextcloud-client}/bin/nextcloudcmd --non-interactive --user ${kieran.user} --password ${lib.escapeShellArg kieran.password} --path /Notes ${lib.escapeShellArg kieran.target} ${kieran.endpoint}
''; '';
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@@ -73,9 +81,9 @@ in {
(let (let
kieran = { kieran = {
user = "kieran.meinhardt@gmail.com"; user = "kieran.meinhardt@gmail.com";
passwordFile = config.age.secrets.mega-password.path; password = lib.fileContents <secrets/mega/password>;
}; };
megatools = command: ''${pkgs.megatools}/bin/megatools ${command} --username ${lib.escapeShellArg kieran.user} --password "$(cat ${kieran.passwordFile})"''; megatools = command: "${pkgs.megatools}/bin/megatools ${command} --username ${lib.escapeShellArg kieran.user} --password ${lib.escapeShellArg kieran.password}";
in in
pkgs.writers.writeDashBin "book-mega" '' pkgs.writers.writeDashBin "book-mega" ''
set -efu set -efu
@@ -96,13 +104,6 @@ in {
'') '')
]; ];
age.secrets.mega-password = {
file = ../secrets/mega-password.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
fileSystems."/media/moodle" = { fileSystems."/media/moodle" = {
device = "zaatar.r:/moodle"; device = "zaatar.r:/moodle";
fsType = "nfs"; fsType = "nfs";
@@ -119,9 +120,9 @@ in {
openDefaultPorts = true; openDefaultPorts = true;
configDir = "/home/kfm/.config/syncthing"; configDir = "/home/kfm/.config/syncthing";
dataDir = "/home/kfm/.config/syncthing"; dataDir = "/home/kfm/.config/syncthing";
cert = config.age.secrets.syncthing-cert.path; cert = toString <system-secrets/syncthing/cert.pem>;
key = config.age.secrets.syncthing-key.path; key = toString <system-secrets/syncthing/key.pem>;
inherit ((import ../lib).syncthing) devices; inherit ((import <niveum/lib>).syncthing) devices;
folders = let folders = let
cloud-dir = "${config.users.users.me.home}/cloud"; cloud-dir = "${config.users.users.me.home}/cloud";
in { in {

12
configs/compton.nix Normal file
View File

@@ -0,0 +1,12 @@
{
services.picom = {
enable = true;
activeOpacity = 1;
fade = true;
fadeDelta = 10;
inactiveOpacity = 0.8;
shadow = true;
menuOpacity = 0.9;
shadowOpacity = 0.3;
};
}

View File

@@ -2,27 +2,36 @@
pkgs, pkgs,
lib, lib,
config, config,
niveumPackages, options,
inputs,
... ...
}: let }: let
inherit (lib.strings) makeBinPath; inherit (lib.strings) makeBinPath;
inherit (import ../lib) localAddresses kieran; inherit (import <niveum/lib>) localAddresses kieran;
defaultApplications = (import ../lib).defaultApplications {inherit pkgs;}; scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
defaultApplications = (import <niveum/lib>).defaultApplications {inherit pkgs;};
in { in {
imports = [ imports = [
inputs.self.nixosModules.system-dependent <home-manager/nixos>
inputs.self.nixosModules.traadfri <niveum/modules/system-dependent.nix>
inputs.self.nixosModules.power-action
{ {
boot.supportedFilesystems = ["ntfs"]; boot.supportedFilesystems = ["ntfs"];
} }
{
nix.nixPath = [
"/var/src"
"nixpkgs-overlays=${toString ../overlays}"
];
}
{ {
nixpkgs = { nixpkgs = {
config = { config = {
allowUnfree = true; allowUnfree = true;
packageOverrides = pkgs: { packageOverrides = pkgs: {
dmenu = pkgs.writers.writeDashBin "dmenu" ''exec ${pkgs.rofi}/bin/rofi -dmenu "$@"''; dmenu = pkgs.writers.writeDashBin "dmenu" ''exec ${pkgs.rofi}/bin/rofi -dmenu "$@"'';
gfs-fonts = pkgs.callPackage <niveum/packages/gfs-fonts.nix> {};
tocharian-font = pkgs.callPackage <niveum/packages/tocharian-font.nix> {};
iolanguage = pkgs.callPackage <niveum/packages/iolanguage.nix> {};
ix = pkgs.callPackage <niveum/packages/ix.nix> {};
}; };
permittedInsecurePackages = [ permittedInsecurePackages = [
"qtwebkit-5.212.0-alpha4" "qtwebkit-5.212.0-alpha4"
@@ -34,22 +43,6 @@ in {
boot.cleanTmpDir = true; boot.cleanTmpDir = true;
boot.loader.timeout = 1; boot.loader.timeout = 1;
} }
{
age.secrets = {
di-fm-key = {
file = ../secrets/di-fm-key.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
restic = {
file = ../secrets/restic.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
};
}
{ {
home-manager.users.me = { home-manager.users.me = {
programs.zathura = { programs.zathura = {
@@ -93,7 +86,7 @@ in {
cd "$(mktemp -d)" cd "$(mktemp -d)"
pwd pwd
''; '';
swallow = command: "${niveumPackages.swallow}/bin/swallow ${command}"; swallow = command: "${scripts.swallow}/bin/swallow ${command}";
in { in {
"ß" = "${pkgs.util-linux}/bin/setsid"; "ß" = "${pkgs.util-linux}/bin/setsid";
cat = "${pkgs.bat}/bin/bat --style=plain"; cat = "${pkgs.bat}/bin/bat --style=plain";
@@ -226,13 +219,14 @@ in {
./bash.nix ./bash.nix
./beets.nix ./beets.nix
./bluetooth.nix ./bluetooth.nix
./aerc.nix
./ccc.nix ./ccc.nix
./khal.nix ./khal.nix
./chromium.nix ./chromium.nix
./clipboard.nix ./clipboard.nix
./cloud.nix ./cloud.nix
./compton.nix
./direnv.nix ./direnv.nix
./distrobump.nix
./docker.nix ./docker.nix
./dunst.nix ./dunst.nix
./flix.nix ./flix.nix
@@ -248,11 +242,11 @@ in {
./mpv.nix ./mpv.nix
./mime.nix ./mime.nix
./neovim.nix ./neovim.nix
./neomutt.nix
./nix.nix ./nix.nix
./newsboat.nix ./newsboat.nix
./flameshot.nix ./flameshot-once.nix
./packages.nix ./packages.nix
./picom.nix
./stardict.nix ./stardict.nix
./polkit.nix ./polkit.nix
./power-action.nix ./power-action.nix
@@ -268,9 +262,10 @@ in {
./sshd.nix ./sshd.nix
./sound.nix ./sound.nix
./sudo.nix ./sudo.nix
./nsxiv.nix
./themes.nix ./themes.nix
./tmux.nix ./tmux.nix
./traadfri.nix # ./traadfri.nix
./unclutter.nix ./unclutter.nix
./vscode.nix ./vscode.nix
./watson.nix ./watson.nix

View File

@@ -3,7 +3,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (import ../lib) defaultApplications colours theme; inherit (import <niveum/lib>) defaultApplications colours theme;
in { in {
home-manager.users.me.services.dunst = { home-manager.users.me.services.dunst = {
enable = true; enable = true;

View File

@@ -0,0 +1,52 @@
{
lib,
pkgs,
...
}: let
inherit (import <niveum/lib>) defaultApplications;
flameshot-once = pkgs.callPackage <stockholm/krebs/5pkgs/simple/flameshot-once> {};
in {
environment.systemPackages = [
(flameshot-once.override {
name = "flameshot-once-kmein";
config = {
imgur = {
enable = true;
createUrl = "http://p.r/image";
deleteUrl = "http://p.r/image/delete/%1";
xdg-open.browser = (defaultApplications pkgs).browser;
};
settings.General = {
autoCloseIdleDaemon = true;
drawColor = "#ff0000";
drawThickness = 2;
checkForUpdates = false;
showDesktopNotification = true;
disabledTrayIcon = true;
showHelp = false;
squareMagnifier = true;
uploadWithoutConfirmation = true;
buttons = [
"TYPE_ARROW"
"TYPE_CIRCLE"
"TYPE_CIRCLECOUNT"
"TYPE_COPY"
"TYPE_DRAWER"
"TYPE_EXIT"
"TYPE_IMAGEUPLOADER"
"TYPE_MARKER"
"TYPE_MOVESELECTION"
"TYPE_PENCIL"
"TYPE_PIXELATE"
"TYPE_RECTANGLE"
"TYPE_SAVE"
"TYPE_SELECTION"
# "TYPE_SELECTIONINDICATOR"
"TYPE_TEXT"
"TYPE_UNDO"
];
};
};
})
];
}

View File

@@ -1,23 +0,0 @@
{
lib,
pkgs,
...
}: {
home-manager.users.me = {
services.flameshot = {
enable = true;
settings.General = {
autoCloseIdleDaemon = true;
drawColor = "#ff0000";
drawThickness = 2;
checkForUpdates = false;
showDesktopNotification = true;
disabledTrayIcon = true;
showHelp = false;
squareMagnifier = true;
uploadWithoutConfirmation = true;
buttons = ''@Variant(\0\0\0\x7f\0\0\0\vQList<int>\0\0\0\0\x10\0\0\0\x2\0\0\0\x5\0\0\0\x13\0\0\0\xa\0\0\0\x1\0\0\0\xc\0\0\0\xd\0\0\0\x6\0\0\0\x8\0\0\0\0\0\0\0\xf\0\0\0\x4\0\0\0\xb\0\0\0\x3\0\0\0\x12\0\0\0\x9)'';
};
};
};
}

View File

@@ -4,16 +4,14 @@
... ...
}: let }: let
flixLocation = "/media/flix"; flixLocation = "/media/flix";
flixLocationNew = "/media/flix-new";
cacheLocation = "/var/cache/flix"; cacheLocation = "/var/cache/flix";
indexFilename = "index"; indexFilename = "index";
indexFilenameNew = "index-new";
flixUser = "flix"; flixUser = "flix";
flixGroup = "users"; flixGroup = "users";
inherit (import ../lib) tmpfilesConfig; inherit (import <niveum/lib>) tmpfilesConfig;
in { in {
fileSystems.${flixLocation} = { fileSystems.${flixLocation} = {
device = "prism.r:/export/download"; device = "prism.r:/export";
fsType = "nfs"; fsType = "nfs";
options = [ options = [
"noauto" "noauto"
@@ -28,20 +26,6 @@ in {
]; ];
}; };
fileSystems.${flixLocationNew} = {
device = "//yellow.r/public";
fsType = "cifs";
options = [
"guest"
"nofail"
"noauto"
"ro"
"x-systemd.automount"
"x-systemd.device-timeout=1"
"x-systemd.idle-timeout=1min"
];
};
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
(tmpfilesConfig { (tmpfilesConfig {
type = "d"; type = "d";
@@ -55,10 +39,7 @@ in {
systemd.services.flix-index = { systemd.services.flix-index = {
description = "Flix indexing service"; description = "Flix indexing service";
wants = ["network-online.target"]; wants = ["network-online.target"];
script = '' script = "cp ${flixLocation}/download/index ./${indexFilename}";
cp ${flixLocation}/index ./${indexFilename}
cp ${flixLocationNew}/index ./${indexFilenameNew}
'';
startAt = "hourly"; startAt = "hourly";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@@ -88,10 +69,11 @@ in {
'') '')
(pkgs.writers.writeDashBin "flixmenu" '' (pkgs.writers.writeDashBin "flixmenu" ''
set -efu set -efu
( cd "${flixLocation}/download"
${pkgs.gnused}/bin/sed 's#^\.#${flixLocation}#' ${cacheLocation}/${indexFilename}
${pkgs.gnused}/bin/sed 's#^\.#${flixLocationNew}#' ${cacheLocation}/${indexFilenameNew} [ -f "${cacheLocation}/${indexFilename}" ] || exit 1
) | ${pkgs.dmenu}/bin/dmenu -i -p flix -l 5 "$@" \
${pkgs.dmenu}/bin/dmenu -i -p flix -l 5 "$@" < ${cacheLocation}/${indexFilename} \
| ${pkgs.findutils}/bin/xargs -I '{}' ${pkgs.util-linux}/bin/setsid ${pkgs.xdg-utils}/bin/xdg-open '{}' | ${pkgs.findutils}/bin/xargs -I '{}' ${pkgs.util-linux}/bin/setsid ${pkgs.xdg-utils}/bin/xdg-open '{}'
'') '')
]; ];

View File

@@ -1,8 +1,4 @@
{ {pkgs, ...}: let
pkgs,
niveumPackages,
...
}: let
zip-font = name: arguments: let zip-font = name: arguments: let
directory = pkgs.fetchzip arguments; directory = pkgs.fetchzip arguments;
in in
@@ -80,7 +76,7 @@ in {
font-awesome font-awesome
galatia-sil galatia-sil
gentium gentium
niveumPackages.gfs-fonts gfs-fonts
gyre-fonts gyre-fonts
ibm-plex ibm-plex
jetbrains-mono jetbrains-mono
@@ -100,7 +96,7 @@ in {
source-sans-pro source-sans-pro
source-serif-pro source-serif-pro
theano theano
niveumPackages.tocharian-font tocharian-font
vistafonts vistafonts
vollkorn vollkorn
zilla-slab zilla-slab

View File

@@ -2,10 +2,9 @@
pkgs, pkgs,
config, config,
lib, lib,
inputs,
... ...
}: let }: let
inherit (import ../lib) kieran ignorePaths; inherit (import <niveum/lib>) kieran ignorePaths;
in { in {
environment.systemPackages = [ environment.systemPackages = [
pkgs.mr pkgs.mr
@@ -19,7 +18,7 @@ in {
pkgs.gitstats pkgs.gitstats
pkgs.patch pkgs.patch
pkgs.patchutils pkgs.patchutils
inputs.self.packages.x86_64-linux.git-preview pkgs.git-preview
]; ];
environment.shellAliases = { environment.shellAliases = {

View File

@@ -3,12 +3,11 @@
pkgs, pkgs,
... ...
}: { }: {
imports = [<niveum/modules/hledger.nix>];
environment.systemPackages = let environment.systemPackages = let
ledgerDirectory = "$HOME/projects/ledger"; timeLedger = "$HOME/projects/ledger/time.timeclock";
timeLedger = "${ledgerDirectory}/time.timeclock";
git = "${pkgs.git}/bin/git -C ${ledgerDirectory}";
in [ in [
pkgs.hledger
(pkgs.writers.writeDashBin "hora-edit" '' (pkgs.writers.writeDashBin "hora-edit" ''
$EDITOR + "${timeLedger}" && ${pkgs.git}/bin/git -C "$(${pkgs.coreutils}/bin/dirname ${timeLedger})" commit --all --message "$(${pkgs.coreutils}/bin/date -Im)" $EDITOR + "${timeLedger}" && ${pkgs.git}/bin/git -C "$(${pkgs.coreutils}/bin/dirname ${timeLedger})" commit --all --message "$(${pkgs.coreutils}/bin/date -Im)"
'') '')
@@ -22,18 +21,16 @@
| sed 's/(fillidefilla:\(.*\))/\1/g' \ | sed 's/(fillidefilla:\(.*\))/\1/g' \
| xsv select date,amount,total,account,description | xsv select date,amount,total,account,description
'') '')
(pkgs.writers.writeDashBin "hledger-git" ''
if [ "$1" = entry ]; then
${pkgs.hledger}/bin/hledger balance -V > "${ledgerDirectory}/balance.txt"
${git} add balance.txt
${git} commit --all --message="$(date -Im)"
else
${git} $*
fi
'')
(pkgs.writers.writeDashBin "hledger-edit" ''
$EDITOR ${ledgerDirectory}/current.journal
'')
]; ];
niveum.hledger = {
enable = true;
ledgerFile = "$HOME/projects/ledger/all.journal";
server = {
enable = false;
user = config.users.users.me;
package = pkgs.hledger-web;
};
package = pkgs.hledger;
};
} }

View File

@@ -5,7 +5,7 @@
... ...
}: let }: let
inherit (lib.strings) fileContents; inherit (lib.strings) fileContents;
inherit (import ../lib) sshPort; inherit (import <niveum/lib>) sshPort;
eduroam = { eduroam = {
identity = fileContents <secrets/eduroam/identity>; identity = fileContents <secrets/eduroam/identity>;
password = fileContents <secrets/eduroam/password>; password = fileContents <secrets/eduroam/password>;
@@ -15,9 +15,10 @@
"gid=${toString config.users.groups.users.gid}" "gid=${toString config.users.groups.users.gid}"
"sec=ntlmv2" "sec=ntlmv2"
"workgroup=german" "workgroup=german"
"credentials=${config.age.secrets.cifs-credentials-hu-berlin.path}" "username=meinhaki"
"password=${lib.strings.fileContents <secrets/mail/meinhaki>}"
"noauto" "noauto"
# "x-systemd.requires=hu-vpn.service" "x-systemd.requires=hu-vpn.service"
"x-systemd.automount" "x-systemd.automount"
"x-systemd.device-timeout=1" "x-systemd.device-timeout=1"
"x-systemd.idle-timeout=1min" "x-systemd.idle-timeout=1min"
@@ -35,8 +36,6 @@ in {
options = hu-berlin-cifs-options; options = hu-berlin-cifs-options;
}; };
age.secrets.cifs-credentials-hu-berlin.file = ../secrets/cifs-credentials-hu-berlin.age;
home-manager.users.me.programs.ssh = { home-manager.users.me.programs.ssh = {
matchBlocks = { matchBlocks = {
"alew.hu-berlin.de" = { "alew.hu-berlin.de" = {
@@ -66,21 +65,16 @@ in {
systemd.services.hu-vpn = { systemd.services.hu-vpn = {
enable = true; enable = true;
wants = ["network-online.target"]; wants = ["network-online.target"];
serviceConfig.LoadCredential = "password:${config.age.secrets.email-password-meinhark.path}";
script = '' script = ''
if ${pkgs.wirelesstools}/bin/iwgetid | ${pkgs.gnugrep}/bin/grep --invert-match eduroam ${pkgs.openfortivpn}/bin/openfortivpn -c ${
then
${pkgs.openfortivpn}/bin/openfortivpn \
--password="$(cat "$CREDENTIALS_DIRECTORY/password")" \
--config=${
pkgs.writeText "hu-berlin.config" '' pkgs.writeText "hu-berlin.config" ''
host = forti-ssl.vpn.hu-berlin.de host = forti-ssl.vpn.hu-berlin.de
port = 443 port = 443
username = meinhark trusted-cert = 42193a913d276d9eb86217612956e1e6464d6f07bed5393a4787c87adc4bd359
trusted-cert = 9e5dea8e077970d245900839f437ef7fb9551559501c7defd70af70ea568573d username = ${eduroam.identity}
password = ${eduroam.password}
'' ''
} }
fi
''; '';
}; };
} }

View File

@@ -2,12 +2,12 @@
config, config,
pkgs, pkgs,
lib, lib,
niveumPackages,
... ...
}: let }: let
inherit (import ../lib) defaultApplications colours; inherit (import <niveum/lib>) defaultApplications colours;
klem = niveumPackages.klem.override { scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
config.dmenu = "${pkgs.dmenu}/bin/dmenu -i -p klem"; klem = import <niveum/packages/scripts/klem.nix> {
inherit pkgs lib;
config.scripts = { config.scripts = {
"p.r" = pkgs.writers.writeDash "p.r" '' "p.r" = pkgs.writers.writeDash "p.r" ''
${pkgs.curl}/bin/curl -fSs http://p.r --data-binary @- \ ${pkgs.curl}/bin/curl -fSs http://p.r --data-binary @- \
@@ -36,10 +36,10 @@
${pkgs.coreutils}/bin/tr '[A-Za-z]' '[N-ZA-Mn-za-m]' ${pkgs.coreutils}/bin/tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
''; '';
"ipa" = pkgs.writers.writeDash "ipa" '' "ipa" = pkgs.writers.writeDash "ipa" ''
${niveumPackages.ipa}/bin/ipa ${scripts.ipa}/bin/ipa
''; '';
"betacode" = pkgs.writers.writeDash "betacode" '' "betacode" = pkgs.writers.writeDash "betacode" ''
${niveumPackages.betacode}/bin/betacode ${scripts.betacode}/bin/betacode
''; '';
"curl" = pkgs.writers.writeDash "curl" '' "curl" = pkgs.writers.writeDash "curl" ''
${pkgs.curl}/bin/curl -fSs "$(${pkgs.coreutils}/bin/cat)" ${pkgs.curl}/bin/curl -fSs "$(${pkgs.coreutils}/bin/cat)"
@@ -47,9 +47,6 @@
ocr = pkgs.writers.writeDash "ocr" '' ocr = pkgs.writers.writeDash "ocr" ''
${pkgs.tesseract4}/bin/tesseract -l eng+deu - stdout ${pkgs.tesseract4}/bin/tesseract -l eng+deu - stdout
''; '';
emojai = pkgs.writers.writeDash "emojai" ''
${pkgs.curl}/bin/curl https://www.emojai.app/api/generate -X POST -H 'Content-Type: application/json' --data-raw "$(${pkgs.jq}/bin/jq -sR '{emoji:.}')" | ${pkgs.jq}/bin/jq -r .result
'';
}; };
}; };
@@ -60,23 +57,6 @@
i3-msg move container to workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1)) i3-msg move container to workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
''; '';
in { in {
age.secrets = {
github-token-i3status-rust = {
file = ../secrets/github-token-i3status-rust.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
openweathermap-api-key = {
file = ../secrets/openweathermap-api-key.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
};
programs.slock.enable = true;
services.xserver = { services.xserver = {
displayManager.defaultSession = "none+i3"; displayManager.defaultSession = "none+i3";
windowManager.i3 = { windowManager.i3 = {
@@ -99,19 +79,14 @@ in {
''; '';
}; };
home-manager.users.me.xsession.windowManager.i3 = let home-manager.users.me.xsession.windowManager.i3 = {
modifier = "Mod4";
in {
enable = true; enable = true;
extraConfig = ''
bindsym --release ${modifier}+Shift+w exec /run/wrappers/bin/slock
'';
config = rec { config = rec {
fonts = { fonts = {
names = ["Sans"]; names = ["Sans"];
size = 10.0; size = 10.0;
}; };
inherit modifier; modifier = "Mod4";
window = { window = {
titlebar = false; titlebar = false;
border = 1; border = 1;
@@ -200,17 +175,13 @@ in {
text = colours.foreground; text = colours.foreground;
}; };
}; };
statusCommand = toString (pkgs.writers.writeDash "i3status-rust" '' statusCommand = "env I3RS_GITHUB_TOKEN=${lib.strings.fileContents <secrets/github/notification.token>} ${pkgs.i3status-rust}/bin/i3status-rs ${
export I3RS_GITHUB_TOKEN="$(cat ${config.age.secrets.github-token-i3status-rust.path})" (pkgs.formats.toml {}).generate "i3status-rust.toml" (import <niveum/lib/i3status-rust.nix> {
export OPENWEATHERMAP_API_KEY="$(cat ${config.age.secrets.openweathermap-api-key.path})" inherit (config.niveum) batteryName wirelessInterface;
${pkgs.i3status-rust}/bin/i3status-rs ${ inherit colours;
(pkgs.formats.toml {}).generate "i3status-rust.toml" (import ../lib/i3status-rust.nix { inherit pkgs;
inherit (config.niveum) batteryName wirelessInterface; })
inherit (config.home-manager.users.me.accounts.email) accounts; }";
inherit colours;
inherit pkgs;
})
}'');
} }
]; ];
modes.resize = { modes.resize = {
@@ -264,8 +235,9 @@ in {
"${modifier}+Return" = "exec ${(defaultApplications pkgs).terminal}"; "${modifier}+Return" = "exec ${(defaultApplications pkgs).terminal}";
"${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}"; "${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}";
"${modifier}+y" = "exec ${(defaultApplications pkgs).browser}"; "${modifier}+y" = "exec ${(defaultApplications pkgs).browser}";
"${modifier}+0" = "exec ${niveumPackages.menu-calc}/bin/="; "${modifier}+0" = "exec ${scripts.menu-calc}/bin/=";
"${modifier}+Shift+w" = "exec ${scripts.k-lock}/bin/k-lock";
"${modifier}+d" = "exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}"; "${modifier}+d" = "exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}";
"${modifier}+Shift+d" = "exec ${ "${modifier}+Shift+d" = "exec ${
pkgs.writers.writeDash "notemenu" '' pkgs.writers.writeDash "notemenu" ''
@@ -288,22 +260,16 @@ in {
}"; }";
"${modifier}+p" = "exec rofi-pass"; "${modifier}+p" = "exec rofi-pass";
"${modifier}+Shift+p" = "exec rofi-pass --insert"; "${modifier}+Shift+p" = "exec rofi-pass --insert";
"${modifier}+u" = "exec ${niveumPackages.unicodmenu}/bin/unicodmenu"; "${modifier}+u" = "exec ${scripts.unicodmenu}/bin/unicodmenu";
"${modifier}+F6" = "exec ${pkgs.xorg.xkill}/bin/xkill"; "${modifier}+F6" = "exec ${pkgs.xorg.xkill}/bin/xkill";
"${modifier}+F7" = "exec ${pkgs.writers.writeDash "showkeys-toggle" '' "${modifier}+F7" = "exec ${scripts.showkeys-toggle}/bin/showkeys-toggle";
if ${pkgs.procps}/bin/pgrep screenkey; then
exec ${pkgs.procps}/bin/pkill screenkey
else
exec ${pkgs.screenkey}/bin/screenkey
fi
''}";
"${modifier}+F8" = "exec switch-theme toggle"; "${modifier}+F8" = "exec switch-theme toggle";
"${modifier}+F9" = "exec ${pkgs.redshift}/bin/redshift -O 4000 -b 0.85"; "${modifier}+F9" = "exec ${pkgs.redshift}/bin/redshift -O 4000 -b 0.85";
"${modifier}+F10" = "exec ${pkgs.redshift}/bin/redshift -x"; "${modifier}+F10" = "exec ${pkgs.redshift}/bin/redshift -x";
"${modifier}+F11" = "exec ${pkgs.xcalib}/bin/xcalib -invert -alter"; "${modifier}+F11" = "exec ${pkgs.xcalib}/bin/xcalib -invert -alter";
"${modifier}+F12" = "exec ${klem}/bin/klem"; "${modifier}+F12" = "exec ${klem}/bin/klem";
"Print" = "exec flameshot gui"; "Print" = "exec flameshot-once";
"XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5"; "XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5";
"XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t"; "XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t";
"XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5"; "XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5";
@@ -313,9 +279,9 @@ in {
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
"XF86ScreenSaver" = "exec ${niveumPackages.k-lock}/bin/k-lock"; "XF86ScreenSaver" = "exec ${scripts.k-lock}/bin/k-lock";
"XF86Display" = "exec ${niveumPackages.dmenu-randr}/bin/dmenu-randr"; "XF86Display" = "exec ${scripts.dmenurandr}/bin/dmenurandr";
# key names detected with xorg.xev: # key names detected with xorg.xev:
# XF86WakeUp (fn twice) # XF86WakeUp (fn twice)

View File

@@ -8,29 +8,14 @@
kmeinCloud = { kmeinCloud = {
davEndpoint = "https://cloud.xn--kiern-0qa.de/remote.php/dav"; davEndpoint = "https://cloud.xn--kiern-0qa.de/remote.php/dav";
username = "kieran"; username = "kieran";
passwordFile = config.age.secrets.nextcloud-password-kieran.path; password = lib.fileContents <secrets/nextcloud/password>;
}; };
fysiCloud = { fysiCloud = {
davEndpoint = "https://nextcloud.fysi.dev/remote.php/dav"; davEndpoint = "https://nextcloud.fysi.dev/remote.php/dav";
username = "kmein"; username = "kmein";
passwordFile = config.age.secrets.nextcloud-password-fysi.path; password = lib.fileContents <secrets/nextcloud-fysi/password>;
}; };
in { in {
age.secrets = {
nextcloud-password-kieran = {
file = ../secrets/nextcloud-password-kieran.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
nextcloud-password-fysi = {
file = ../secrets/nextcloud-password-fysi.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
};
environment.systemPackages = [ environment.systemPackages = [
pkgs.khal pkgs.khal
pkgs.vdirsyncer pkgs.vdirsyncer
@@ -182,19 +167,19 @@ in {
type = "carddav" type = "carddav"
url = "${kmeinCloud.davEndpoint}/addressbooks/users/${kmeinCloud.username}/" url = "${kmeinCloud.davEndpoint}/addressbooks/users/${kmeinCloud.username}/"
username = "${kmeinCloud.username}" username = "${kmeinCloud.username}"
password.fetch = ["command", "cat", "${kmeinCloud.passwordFile}"] password = "${kmeinCloud.password}"
[storage kalender_cloud] [storage kalender_cloud]
type = "caldav" type = "caldav"
url = "${kmeinCloud.davEndpoint}/calendars/${kmeinCloud.username}/" url = "${kmeinCloud.davEndpoint}/calendars/${kmeinCloud.username}/"
username = "${kmeinCloud.username}" username = "${kmeinCloud.username}"
password.fetch = ["command", "cat", "${kmeinCloud.passwordFile}"] password = "${kmeinCloud.password}"
[storage fysi_cloud] [storage fysi_cloud]
type = "caldav" type = "caldav"
url = "${fysiCloud.davEndpoint}/calendars/${fysiCloud.username}/" url = "${fysiCloud.davEndpoint}/calendars/${fysiCloud.username}/"
username = "${fysiCloud.username}" username = "${fysiCloud.username}"
password.fetch = ["command", "cat", "${fysiCloud.passwordFile}"] password = "${fysiCloud.password}"
''; '';
}; };
}; };

View File

@@ -2,10 +2,10 @@
pkgs, pkgs,
lib, lib,
config, config,
niveumPackages,
... ...
}: let }: let
swallow = command: "${niveumPackages.swallow}/bin/swallow ${command}"; scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
swallow = command: "${scripts.swallow}/bin/swallow ${command}";
in { in {
environment.shellAliases.smpv = swallow "mpv"; environment.shellAliases.smpv = swallow "mpv";
@@ -23,7 +23,6 @@ in {
ytdl-raw-options = lib.concatStringsSep "," [''sub-lang="de,en"'' "write-sub=" "write-auto-sub="]; ytdl-raw-options = lib.concatStringsSep "," [''sub-lang="de,en"'' "write-sub=" "write-auto-sub="];
screenshot-template = "%F-%wH%wM%wS-%#04n"; screenshot-template = "%F-%wH%wM%wS-%#04n";
script-opts = "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp"; script-opts = "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp";
ao = "pulse"; # no pipewire for me :(
}; };
bindings = { bindings = {
"Alt+RIGHT" = "add video-rotate 90"; "Alt+RIGHT" = "add video-rotate 90";
@@ -37,7 +36,7 @@ in {
}; };
scripts = [ scripts = [
pkgs.mpvScripts.youtube-quality pkgs.mpvScripts.youtube-quality
niveumPackages.mpv-visualizer (pkgs.callPackage <niveum/packages/mpv-visualizer.nix> {})
]; ];
}; };
}; };

172
configs/neomutt.nix Normal file
View File

@@ -0,0 +1,172 @@
{
pkgs,
lib,
...
}: let
mainMailbox = "posteo";
accounts = import <niveum/lib/email.nix> {inherit lib mainMailbox;};
neomuttConfig = emailAccounts: let
as-pdf = pkgs.writers.writeDash "as-pdf" ''
d=$(mktemp -d)
trap clean EXIT
clean() {
rm -rf "$d"
}
${pkgs.libreoffice}/bin/libreoffice --headless --convert-to pdf "$1" --outdir "$d"
${pkgs.zathura}/bin/zathura "$d"/*.pdf
'';
in ''
set mailcap_path = ${
pkgs.writeText "mailcap" ''
text/plain; $EDITOR %s ;
text/html; ${pkgs.lynx}/bin/lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput;
image/*; ${pkgs.nsxiv}/bin/nsxiv %s ;
video/*; ${pkgs.util-linux}/bin/setsid ${pkgs.mpv}/bin/mpv --quiet %s &; copiousoutput
audio/*; ${pkgs.mpv}/bin/mpv %s ;
application/pdf; ${pkgs.zathura}/bin/zathura %s ;
application/pgp-encrypted; ${pkgs.gnupg}/bin/gpg -d '%s'; copiousoutput;
application/pgp-keys; ${pkgs.gnupg}/bin/gpg --import '%s'; copiousoutput;
application/vnd.openxmlformats-officedocument.wordprocessingml.document; ${as-pdf} %s;
application/vnd.oasis.opendocument.text; ${as-pdf} %s;
application/vnd.openxmlformats*; ${pkgs.libreoffice}/bin/soffice '%s';
''
}:$mailcap_path
set sidebar_visible
set sidebar_format = "%D%?F? [%F]?%* %?N?%N/?%S"
set sidebar_width = 25 # Plenty of space
set sidebar_divider_char = '' # Pretty line-drawing character
set mail_check_stats
set index_format="%2C %Z %D %-15.15L %s"
set date_format="%F %R"
set sort = 'reverse-date'
set sleep_time = 0 # Pause 0 seconds for informational messages
set markers = no # Disables the `+` displayed at line wraps
set mark_old = no # Unread mail stay unread until read
set wait_key = no # mutt won't ask "press key to continue"
set fast_reply # skip to compose when replying
set forward_format = "Fwd: %s" # format of subject when forwarding
set reverse_name # reply as whomever it was to
set include=ask-no # don't include message in replies
auto_view text/html # automatically show html (mailcap uses lynx)
auto_view application/pgp-encrypted
alternative_order text/plain text/enriched text/html
set abort_noattach abort_noattach_regex="\<(attach|attached|attachments?|anbei|Anhang|angehängt)\>"
set attach_save_dir=/tmp
set fast_reply
set narrow_tree # narrow threads for more depth
bind index,pager B sidebar-toggle-visible # Use 'B' to switch the Sidebar on and off
bind index,pager \Ck sidebar-prev
bind index,pager \Cj sidebar-next
bind index,pager \Co sidebar-open
bind index,pager \Cp sidebar-prev-new
bind index,pager \Cn sidebar-next-new
macro index * <limit>~F\r
macro index + <limit>all\r
set query_command = "khard email --parsable %s"
bind editor <Tab> complete-query
bind editor ^T complete
set mail_check = 90
set timeout = 15
# set imap_check_subscribed
set use_from
set header_cache="~/.cache/mutt" message_cachedir="~/.cache/mutt"
source ${
pkgs.writeText "accounts.neomuttrc" ''
set realname = "Kierán Meinhardt"
account-hook . 'unset imap_user imap_pass smtp_user smtp_pass'
# set accordingly: postponed trash record
${
lib.concatStringsSep "\n\n" (lib.mapAttrsToList (name: account: let
imapRoot = "imaps://${account.user}@${account.imap}";
in ''
account-hook ${account.user}@${account.imap} 'set imap_user="${account.user}" imap_pass="${account.password}"'
account-hook ${account.user}@${account.smtp} 'set smtp_user="${account.user}" smtp_pass="${account.password}"'
folder-hook ${account.user}@${account.imap} 'set smtp_url="${account.smtpSettings "${account.user}@${account.smtp}"}" from="${account.address}" record="${imapRoot}/${account.folders.sent}" postponed="${imapRoot}/${account.folders.drafts}" trash="${imapRoot}/${account.folders.trash}"'
named-mailboxes "${name}" "${imapRoot}" "${name}" "${imapRoot}/${account.folders.sent}"
'')
emailAccounts)
}
''
}
set spoolfile="${mainMailbox}"
source ${
pkgs.writeText "colors.neomuttrc" ''
# Default index colors:
color index_number blue default
color index red default '.*'
color index_flags lightcyan default '.*'
color index_author yellow default '.*'
color index_subject default default '.*'
# New mail is boldened:
color index_author lightyellow default "~N"
color index_subject lightwhite default "~N"
# Flagged mail is highlighted:
color index_flags lightmagenta default '~F'
# Other colors and aesthetic settings:
mono bold bold
mono underline underline
mono error bold
mono indicator reverse
# color sidebar_flagged red black
mono sidebar_new bold
color error red default
color message cyan default
color search brightmagenta default
color hdrdefault lightblack default
color quoted green default
color quoted1 blue default
color quoted2 cyan default
color quoted3 yellow default
color quoted4 red default
color quoted5 brightred default
color signature lightblack default
color tree color235 default
# Regex highlighting:
color header red default "^(Date)"
color header yellow default "^(From)"
color header white default "^(B?CC)"
color header brightwhite default "^(Subject)"
color body cyan default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
color body red default "(BAD signature)|^gpg: BAD signature from.*"
color body brightgreen default "(Good signature)|^gpg: Good signature .*"
color body brightyellow default "^gpg: "
mono body bold "^gpg: Good signature"
mono body bold "^gpg: BAD signature from.*"
color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
''
}
'';
in {
environment.systemPackages = [pkgs.neomutt];
environment.shellAliases =
lib.mapAttrs' (accountName: account:
lib.nameValuePair
"mua-${accountName}"
"${pkgs.neomutt}/bin/neomutt -F ${pkgs.writeText "neomuttrc-${accountName}" (neomuttConfig {"${accountName}" = accounts.${accountName};})}")
accounts
// {mua = "${pkgs.neomutt}/bin/neomutt -f ${mainMailbox}";};
home-manager.users.me.xdg.configFile."neomutt/neomuttrc".text = neomuttConfig accounts;
}

View File

@@ -1,22 +1,30 @@
{ {pkgs, ...}: {
pkgs,
niveumPackages,
...
}: {
environment.variables.EDITOR = pkgs.lib.mkForce "nvim"; environment.variables.EDITOR = pkgs.lib.mkForce "nvim";
environment.shellAliases.vi = "nvim"; environment.shellAliases.vi = "nvim";
environment.shellAliases.vim = "nvim"; environment.shellAliases.vim = "nvim";
environment.shellAliases.view = "nvim -R"; environment.shellAliases.view = "nvim -R";
nixpkgs.config.packageOverrides = pkgs: {
vimPlugins =
pkgs.vimPlugins
// {
cheat-sh-vim = pkgs.callPackage <niveum/packages/vimPlugins/cheat-sh.nix> {};
vim-fetch = pkgs.callPackage <niveum/packages/vimPlugins/vim-fetch.nix> {};
vim-colors-paramount = pkgs.callPackage <niveum/packages/vimPlugins/vim-colors-paramount.nix> {};
vim-256noir = pkgs.callPackage <niveum/packages/vimPlugins/vim-256noir.nix> {};
icalendar-vim = pkgs.callPackage <niveum/packages/vimPlugins/icalendar-vim.nix> {};
jq-vim = pkgs.callPackage <niveum/packages/vimPlugins/jq-vim.nix> {};
vim-fsharp = pkgs.callPackage <niveum/packages/vimPlugins/vim-fsharp.nix> {};
vim-reason-plus = pkgs.callPackage <niveum/packages/vimPlugins/vim-reason-plus.nix> {};
vim-mail = pkgs.callPackage <niveum/packages/vimPlugins/vim-mail.nix> {};
};
};
environment.systemPackages = [ environment.systemPackages = [
(pkgs.writers.writeDashBin "vim" ''neovim "$@"'') (pkgs.writers.writeDashBin "vim" ''neovim "$@"'')
(pkgs.neovim.override { (pkgs.neovim.override {
configure = { configure = {
customRC = '' customRC = builtins.readFile <niveum/lib/vim/init.vim>;
source ${../lib/vim/init.vim}
luafile ${../lib/vim/init.lua}
'';
packages.nvim = with pkgs.vimPlugins; { packages.nvim = with pkgs.vimPlugins; {
start = [ start = [
ale ale
@@ -26,12 +34,11 @@
undotree undotree
tabular tabular
# vimwiki # vimwiki
niveumPackages.vimPlugins-vim-colors-paramount vim-colors-paramount
nvim-lspconfig
vim-commentary vim-commentary
vim-css-color vim-css-color
vim-eunuch vim-eunuch
niveumPackages.vimPlugins-vim-fetch vim-fetch
vim-fugitive vim-fugitive
vim-gitgutter vim-gitgutter
vim-repeat vim-repeat
@@ -54,8 +61,8 @@
elm-vim elm-vim
emmet-vim emmet-vim
haskell-vim haskell-vim
niveumPackages.vimPlugins-icalendar-vim icalendar-vim
niveumPackages.vimPlugins-jq-vim jq-vim
rust-vim rust-vim
typescript-vim typescript-vim
vim-javascript vim-javascript
@@ -64,7 +71,7 @@
vimtex vimtex
vim-pandoc vim-pandoc
vim-pandoc-syntax vim-pandoc-syntax
niveumPackages.vimPlugins-vim-256noir vim-256noir
]; ];
}; };
}; };

View File

@@ -42,6 +42,8 @@
}; };
}; };
in { in {
imports = [<niveum/modules/networkmanager-declarative.nix>];
programs.nm-applet.enable = true; programs.nm-applet.enable = true;
networking.networkmanager = { networking.networkmanager = {
@@ -53,6 +55,39 @@ in {
wifi.macAddress = "random"; wifi.macAddress = "random";
ethernet.macAddress = "random"; ethernet.macAddress = "random";
unmanaged = ["docker*"]; unmanaged = ["docker*"];
profiles = lib.mapAttrs profile {
Aether = {
connection.uuid = "7138bb0f-1aeb-4905-890e-a6628427aa21";
ipv6.addr-gen-mode = "stable";
wifi.cloned-mac-address = "stable";
wifi-security = {
psk = lib.strings.fileContents <secrets/wifi/Aether.psk>;
auth-alg = "open";
key-mgmt = "wpa-psk";
};
};
FactoryCommunityGuest = {
connection.uuid = "fb1f2e52-651e-48b5-a72c-1accddf31afb";
connection.timestamp = "1631885129";
wifi.seen-bssids = "54:EC:2F:19:30:DC;54:EC:2F:19:5C:9C;54:EC:2F:58:E4:3C;";
wifi-security = {
psk = "Factory4ever";
auth-alg = "open";
key-mgmt = "wpa-psk";
};
};
o2-WLAN66 = {
connection.uuid = "c563aec3-f344-4ffb-8d1c-60a6cdac8fe0";
wifi-security = {
psk = "PK3468KV488T934U";
auth-alg = "open";
key-mgmt = "wpa-psk";
};
};
"WIFI@DB".connection.uuid = "4eff4e94-8850-4e9f-a338-1787d0d90479";
eduroam = eduroamProfile;
eduroam_5GHz = eduroamProfile;
};
}; };
users.users.me.extraGroups = ["networkmanager"]; users.users.me.extraGroups = ["networkmanager"];

View File

@@ -4,6 +4,8 @@
lib, lib,
... ...
}: let }: let
scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
ytdl-format = "'bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best'"; ytdl-format = "'bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best'";
youtube-download = "${pkgs.ts}/bin/ts ${pkgs.yt-dlp}/bin/yt-dlp -f ${ytdl-format} --add-metadata"; youtube-download = "${pkgs.ts}/bin/ts ${pkgs.yt-dlp}/bin/yt-dlp -f ${ytdl-format} --add-metadata";

View File

@@ -1,9 +1,13 @@
{pkgs, ...}: { {pkgs, ...}: {
nixpkgs = { nixpkgs = {
config.allowUnfree = true; config.allowUnfree = true;
overlays = [
(import <nix-writers/pkgs>)
(import <stockholm/krebs/5pkgs>)
];
}; };
nix = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixUnstable;
extraOptions = "experimental-features = nix-command flakes"; extraOptions = "experimental-features = nix-command flakes";
}; };
} }

66
configs/nsxiv.nix Normal file
View File

@@ -0,0 +1,66 @@
{
pkgs,
lib,
...
}: let
important-directories = pkgs.writeText "directories" ''
h ~/
d ~/cloud/Dropbox/
g ~/cloud/gdrive/
s ~/cloud/Seafile/
kk ~/cloud/keybase/private/kmein/
kp ~/cloud/keybase/public/kmein/
t /tmp
D ~/Downloads
cf ''${XDG_CONFIG_HOME:-$HOME/.config}
'';
in {
environment.systemPackages = [pkgs.nsxiv];
# TODO fix
home-manager.users.me.xdg.configFile."nsxiv/exec/key-handler".source = pkgs.writers.writeDash "key-handler" ''
PATH=$PATH:${
lib.makeBinPath [
pkgs.gnused
pkgs.gawk
pkgs.dmenu
pkgs.coreutils
pkgs.libnotify
pkgs.imagemagick
pkgs.xclip
]
}
echo >&2 key "$1" pressed
while read file; do
case "$1" in
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${important-directories} | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${important-directories} | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
;;
"r")
convert -rotate 90 "$file" "$file" ;;
"R")
convert -rotate -90 "$file" "$file" ;;
"f")
convert -flop "$file" "$file" ;;
"y")
echo -n "$file" | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
readlink -f "$file" | xclip -selection clipboard &&
notify-send "$(readlink -f "$file") copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
esac
done
'';
}

View File

@@ -1,12 +1,14 @@
{ {
config,
pkgs, pkgs,
lib, lib,
inputs,
niveumPackages,
... ...
}: let }: let
worldradio = pkgs.callPackage ../packages/worldradio.nix {}; hc = pkgs.callPackage <stockholm/tv/5pkgs/simple/hc.nix> {utillinux = pkgs.util-linux;};
worldradio = pkgs.callPackage <niveum/packages/worldradio.nix> {};
menstruation = pkgs.callPackage <menstruation-backend> {};
pandoc-doc = pkgs.callPackage <niveum/packages/man/pandoc.nix> {};
scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
zoteroStyle = { zoteroStyle = {
name, name,
@@ -53,6 +55,8 @@
' $out/astrolog/astrolog.as ' $out/astrolog/astrolog.as
''; '';
}); });
recht = pkgs.callPackage <recht> {};
in { in {
home-manager.users.me.home.file = { home-manager.users.me.home.file = {
".csl".source = cslDirectory; ".csl".source = cslDirectory;
@@ -75,7 +79,6 @@ in {
ffmpeg ffmpeg
imagemagick imagemagick
exiftool exiftool
nsxiv
# ARCHIVE TOOLS # ARCHIVE TOOLS
unzip unzip
unrar unrar
@@ -134,65 +137,68 @@ in {
okular # the word is nucular okular # the word is nucular
xournalpp # for annotating pdfs xournalpp # for annotating pdfs
pdfpc # presenter console for pdf slides pdfpc # presenter console for pdf slides
niveumPackages.hc # print files as qr codes hc # print files as qr codes
yt-dlp yt-dlp
espeak espeak
bc # calculator bc # calculator
pari # gp -- better calculator pari # gp -- better calculator
rink # unit converter rink # unit converter
niveumPackages.auc scripts.auc
niveumPackages.cheat-sh scripts.stackoverflow
niveumPackages.infschmv scripts.infschmv
niveumPackages.qrpaste scripts.qrpaste
niveumPackages.ttspaste scripts.ttspaste
niveumPackages.new-mac # get a new mac address scripts.new-mac # get a new mac address
niveumPackages.scanned scripts.scanned
niveumPackages.default-gateway scripts.default-gateway
niveumPackages.kirciuoklis scripts.showkeys-toggle
niveumPackages.image-convert-favicon scripts.kirciuoklis
niveumPackages.heuretes scripts.favicon
niveumPackages.ipa # XSAMPA to IPA converter scripts.heuretes
niveumPackages.pls scripts.ipa # XSAMPA to IPA converter
niveumPackages.mpv-tv scripts.playlist
niveumPackages.devanagari scripts.mpv-tv
niveumPackages.betacode # ancient greek betacode to unicode converter scripts.devanagari
niveumPackages.meteo scripts.betacode # ancient greek betacode to unicode converter
niveumPackages.mahlzeit scripts.meteo
niveumPackages.vimv scripts.mahlzeit
niveumPackages.swallow # window swallowing recht
niveumPackages.literature-quote scripts.vimv
scripts.swallow # window swallowing
scripts.literature-quote
jless # less(1) for json jless # less(1) for json
niveumPackages.booksplit scripts.notetags
niveumPackages.dmenu-randr scripts.booksplit
niveumPackages.dmenu-bluetooth scripts.dmenurandr
niveumPackages.manual-sort scripts.interdimensional-cable
niveumPackages.dns-sledgehammer scripts.dmenubluetooth
scripts.manual-sort
scripts.much-scripts
scripts.dns-sledgehammer
ts ts
niveumPackages.vg scripts.vg
niveumPackages.fkill scripts.fkill
niveumPackages.wttr scripts.wttr
niveumPackages.unicodmenu scripts.unicodmenu
niveumPackages.closest scripts.closest
niveumPackages.trans scripts.trans
(niveumPackages.mpv-radio.override { scripts.mpv-radio
di-fm-key-file = config.age.secrets.di-fm-key.path;
})
# kmein.slide # kmein.slide
termdown termdown
niveumPackages.image-convert-tolino scripts.alarm
niveumPackages.rfc scripts.tolino-screensaver
niveumPackages.tag scripts.rfc
niveumPackages.timer scripts.tag
niveumPackages.menu-calc scripts.timer
python3Packages.eyeD3
scripts.menu-calc
nix-prefetch-git nix-prefetch-git
niveumPackages.nix-git scripts.nix-git
nixfmt nixfmt
par par
qrencode qrencode
inputs.menstruation-backend.defaultPackage.x86_64-linux menstruation
inputs.agenix.packages.x86_64-linux.default
inputs.recht.defaultPackage.x86_64-linux
(pkgs.writers.writeDashBin "worldradio" '' (pkgs.writers.writeDashBin "worldradio" ''
shuf ${worldradio} | ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv --no-video shuf ${worldradio} | ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv --no-video
@@ -202,24 +208,24 @@ in {
${pkgs.openssh}/bin/ssh makanek "cd /var/lib/weechat/logs && grep --ignore-case --color=always --recursive $@" | ${pkgs.less}/bin/less --raw-control-chars ${pkgs.openssh}/bin/ssh makanek "cd /var/lib/weechat/logs && grep --ignore-case --color=always --recursive $@" | ${pkgs.less}/bin/less --raw-control-chars
'') '')
(pkgs.writers.writeDashBin "ncmpcpp-zaatar" ''MPD_HOST=${(import ../lib/local-network.nix).zaatar} exec ${pkgs.ncmpcpp}/bin/ncmpcpp "$@"'') (pkgs.writers.writeDashBin "ncmpcpp-zaatar" ''MPD_HOST=${(import <niveum/lib/local-network.nix>).zaatar} exec ${pkgs.ncmpcpp}/bin/ncmpcpp "$@"'')
(pkgs.writers.writeDashBin "mpc-zaatar" ''MPD_HOST=${(import ../lib/local-network.nix).zaatar} exec ${pkgs.mpc_cli}/bin/mpc "$@"'') (pkgs.writers.writeDashBin "mpc-zaatar" ''MPD_HOST=${(import <niveum/lib/local-network.nix>).zaatar} exec ${pkgs.mpc_cli}/bin/mpc "$@"'')
inputs.scripts.packages.x86_64-linux.alarm
spotify spotify
ncspot ncspot
playerctl playerctl
nix-index nix-index
niveumPackages.nix-index-update scripts.nix-index-update
#krebs #krebs
niveumPackages.dic dic
niveumPackages.cyberlocker-tools cyberlocker-tools
niveumPackages.untilport untilport
niveumPackages.kpaste kpaste
config.nur.repos.mic92.ircsink irc-announce
git-preview
ircaids
(python3.withPackages (py: [ (python3.withPackages (py: [
py.black py.black
@@ -233,13 +239,6 @@ in {
])) ]))
# python3Packages.poetry # python3Packages.poetry
# language servers
pyright
haskell-language-server
texlab
nil
rust-analyzer
html-tidy html-tidy
nodePackages.csslint nodePackages.csslint
nodePackages.jsonlint nodePackages.jsonlint
@@ -253,14 +252,14 @@ in {
latexrun latexrun
(aspellWithDicts (dict: [dict.de dict.en dict.en-computers])) (aspellWithDicts (dict: [dict.de dict.en dict.en-computers]))
# haskellPackages.pandoc-citeproc # haskellPackages.pandoc-citeproc
niveumPackages.text2pdf scripts.text2pdf
lowdown lowdown
glow # markdown to term glow # markdown to term
libreoffice libreoffice
# gnumeric # gnumeric
dia dia
pandoc pandoc
niveumPackages.man-pandoc pandoc-doc
# proselint # proselint
asciidoctor asciidoctor
wordnet wordnet
@@ -271,17 +270,11 @@ in {
shellcheck shellcheck
(pkgs.writers.writeDashBin "hass-cli" '' (pkgs.writers.writeDashBin "hass-cli" ''
HASS_SERVER=http://zaatar.r:8123 HASS_TOKEN="$(cat ${config.age.secrets.home-assistant-token.path})" exec ${pkgs.home-assistant-cli}/bin/hass-cli "$@" HASS_SERVER=http://zaatar.r:8123 HASS_TOKEN=${lib.strings.fileContents <secrets/hass/token>} exec ${pkgs.home-assistant-cli}/bin/hass-cli "$@"
'') '')
scripts.rofi-hass
]; ];
age.secrets.home-assistant-token = {
file = ../secrets/home-assistant-token.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
home-manager.users.me.xdg.configFile."pycodestyle".text = '' home-manager.users.me.xdg.configFile."pycodestyle".text = ''
[pycodestyle] [pycodestyle]
max-line-length = 110 max-line-length = 110

View File

@@ -1,25 +0,0 @@
{
services.picom = {
enable = true;
activeOpacity = 1;
fade = true;
fadeDelta = 1;
inactiveOpacity = 0.9;
shadow = true;
menuOpacity = 0.9;
shadowOpacity = 0.3;
fadeExclude = [
"class_g = 'slock'" # don't want a transparent lock screen!
"name *?= 'slock'"
"focused = 1"
];
opacityRules = [
# opacity-rule overrides both inactive and active opacity
# video in browser tabs
# substring /regex match of title bar text
"99:name *?= 'Youtube'"
"99:WM_CLASS@:s *= 'mpv$'"
];
};
}

View File

@@ -5,13 +5,15 @@
}: let }: let
suspend = pkgs.writers.writeDash "suspend" "${pkgs.systemd}/bin/systemctl suspend"; suspend = pkgs.writers.writeDash "suspend" "${pkgs.systemd}/bin/systemctl suspend";
in { in {
services.power-action = { imports = [<stockholm/krebs/3modules/power-action.nix>];
krebs.power-action = {
enable = true; enable = true;
plans.suspend = { plans.suspend = {
upperLimit = 7; upperLimit = 7;
lowerLimit = 0; lowerLimit = 0;
charging = false; charging = false;
action = pkgs.writers.writeDash "suspend-wrapper" '' action = pkgs.writeDash "suspend-wrapper" ''
/run/wrappers/bin/sudo ${suspend} /run/wrappers/bin/sudo ${suspend}
''; '';
}; };
@@ -19,6 +21,6 @@ in {
}; };
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
${config.services.power-action.user} ALL= (root) NOPASSWD: ${suspend} ${config.krebs.power-action.user} ALL= (root) NOPASSWD: ${suspend}
''; '';
} }

View File

@@ -1,5 +1,5 @@
{pkgs, ...}: let {pkgs, ...}: let
inherit (import ../lib) localAddresses; inherit (import <niveum/lib>) localAddresses;
hp-driver = pkgs.hplip; hp-driver = pkgs.hplip;
in { in {
services.printing = { services.printing = {

View File

@@ -3,10 +3,14 @@
pkgs, pkgs,
... ...
}: { }: {
imports = [
<retiolum/modules/retiolum>
];
networking.hosts = {"42:0:ca48:f98f:63d7:31ce:922b:245d" = ["go"];}; networking.hosts = {"42:0:ca48:f98f:63d7:31ce:922b:245d" = ["go"];};
services.tinc.networks.retiolum = { services.tinc.networks.retiolum = {
rsaPrivateKeyFile = config.age.secrets.retiolum-rsa.path; rsaPrivateKeyFile = toString <system-secrets/retiolum.key>;
ed25519PrivateKeyFile = config.age.secrets.retiolum-ed25519.path; ed25519PrivateKeyFile = toString <system-secrets/retiolum.ed25519>;
}; };
} }

View File

@@ -4,40 +4,24 @@
lib, lib,
... ...
}: let }: let
inherit (import ../lib) sshPort kieran; inherit (import <niveum/lib>) sshPort kieran;
externalNetwork = import ../lib/external-network.nix; externalNetwork = import <niveum/lib/external-network.nix>;
sshIdentity = name: "${config.users.users.me.home}/.ssh/${name}"; sshIdentity = name: "${config.users.users.me.home}/.ssh/${name}";
ssh-passphrase = lib.strings.fileContents <system-secrets/ssh/passphrase>;
in { in {
services.xserver.displayManager.sessionCommands = toString (pkgs.writeScript "ssh-add" ''
#!${pkgs.expect}/bin/expect -f
spawn ${pkgs.openssh}/bin/ssh-add
expect "Enter passphrase for *:"
send "${ssh-passphrase}\n";
expect "Identity added: *"
interact
'');
programs.ssh.startAgent = true;
users.users.me.openssh.authorizedKeys.keys = kieran.sshKeys pkgs; users.users.me.openssh.authorizedKeys.keys = kieran.sshKeys pkgs;
home-manager.users.me = {
services.gpg-agent = rec {
enable = true;
enableSshSupport = true;
defaultCacheTtlSsh = 2 * 60 * 60;
maxCacheTtlSsh = 4 * defaultCacheTtlSsh;
sshKeys = [
"568047C91DE03A23883E340F15A9C24D313E847C"
"BB3EE102DB8CD45540A78A6B18B511B67061F6B4" # kfm@manakish ed25519
"3F8986755818B5762A096BE212777EAAC441DD9D" # fysiweb rsa
"0E4ABD229432486CC432639BB0986B2CDE365105" # agenix ed25519
"A1E8D32CBFCDBD2DE798E2298D795CCFD785AE06" # kfm@kabsa ed25519
];
};
};
environment.extraInit = ''
if [[ -z "$SSH_AUTH_SOCK" ]]; then
export SSH_AUTH_SOCK="$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)"
fi
'';
environment.interactiveShellInit = ''
GPG_TTY="$(tty)"
export GPG_TTY
${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null
'';
home-manager.users.me.programs.ssh = { home-manager.users.me.programs.ssh = {
enable = true; enable = true;
matchBlocks = rec { matchBlocks = rec {
@@ -88,8 +72,6 @@ in {
hostname = "135.181.85.233"; hostname = "135.181.85.233";
user = "root"; user = "root";
}; };
"cms-dev.woc2023.app".identityFile = sshIdentity "fysiweb";
"cms-master.woc2023.app".identityFile = sshIdentity "fysiweb";
"fysi-dev1" = { "fysi-dev1" = {
hostname = "94.130.229.139"; hostname = "94.130.229.139";
user = "root"; user = "root";

View File

@@ -4,7 +4,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (import ../lib) sshPort kieran; inherit (import <niveum/lib>) sshPort kieran;
in { in {
users.motd = "Welcome to ${config.networking.hostName}!"; users.motd = "Welcome to ${config.networking.hostName}!";

View File

@@ -158,16 +158,6 @@
sha256 = "03f9wdmkgpjifpms7dyh10ma29wf3ka1j3zlp1av0cybhdldk2a8"; sha256 = "03f9wdmkgpjifpms7dyh10ma29wf3ka1j3zlp1av0cybhdldk2a8";
}; };
}; };
turkish = {
BabylonTurkishEnglish = pkgs.fetchzip {
url = "http://download.huzheng.org/babylon/bidirectional/stardict-babylon-Babylon_Turkish_English-2.4.2.tar.bz2";
sha256 = "17rv46r95nkikg7aszqmfrbgdhz9ny52w423m8n01g3p93shdb4i";
};
BabylonEnglishTurkish = pkgs.fetchzip {
url = "http://download.huzheng.org/babylon/bidirectional/stardict-babylon-Babylon_English_Turkish-2.4.2.tar.bz2";
sha256 = "063dl02s8ii8snsxgma8wi49xwr6afk6ysq0v986fygx5511353f";
};
};
}; };
makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: {inherit name path;}) dicts); makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: {inherit name path;}) dicts);
@@ -179,7 +169,7 @@
exec ${pkgs.sdcv}/bin/sdcv --color --only-data-dir --data-dir ${makeStardictDataDir dicts} "$@" exec ${pkgs.sdcv}/bin/sdcv --color --only-data-dir --data-dir ${makeStardictDataDir dicts} "$@"
''; '';
sdcvPager = pkgs.writers.writeDash "sdcvPager" '' sdcvPager = pkgs.writeDash "sdcvPager" ''
export PATH=${lib.makeBinPath [pkgs.gnused pkgs.ncurses pkgs.less]} export PATH=${lib.makeBinPath [pkgs.gnused pkgs.ncurses pkgs.less]}
sed " sed "
s!<sup>1</sup>!¹!gI s!<sup>1</sup>!¹!gI
@@ -302,8 +292,7 @@ in {
// dictionaries.sanskrit // dictionaries.sanskrit
// dictionaries.oed // dictionaries.oed
// dictionaries.russian // dictionaries.russian
// dictionaries.englishGerman // dictionaries.englishGerman));
// dictionaries.turkish));
environment.systemPackages = [ environment.systemPackages = [
# pkgs.goldendict # pkgs.goldendict
@@ -313,7 +302,6 @@ in {
(makeStardict "sd-russian" dictionaries.russian) (makeStardict "sd-russian" dictionaries.russian)
(makeStardict "sd" dictionaries.englishGerman) (makeStardict "sd" dictionaries.englishGerman)
(makeStardict "jbo" dictionaries.lojban) (makeStardict "jbo" dictionaries.lojban)
(makeStardict "sd-turkish" dictionaries.turkish)
]; ];
} }
/* /*

View File

@@ -4,6 +4,8 @@
lib, lib,
... ...
}: let }: let
unstable = import <nixos-unstable> {inherit (config.nixpkgs) config;};
toSymbols = pkgs.writers.writeDash "to-symbols" '' toSymbols = pkgs.writers.writeDash "to-symbols" ''
${pkgs.gnused}/bin/sed ' ${pkgs.gnused}/bin/sed '
s/\bTri\b//; s/\bTri\b//;
@@ -44,14 +46,14 @@ in {
niveum.telegramBots.transits = { niveum.telegramBots.transits = {
enable = true; enable = true;
time = "*:0/1"; time = "*:0/1";
tokenFile = config.age.secrets.telegram-token-kmein.path; token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["-1001796440545"]; chatIds = ["-1001796440545"];
command = toString (pkgs.writers.writeDash "common-transits" '' command = toString (pkgs.writers.writeDash "common-transits" ''
now=$(${pkgs.coreutils}/bin/date +%_H:%M | ${pkgs.gnused}/bin/sed 's/^\s*//') now=$(${pkgs.coreutils}/bin/date +%_H:%M | ${pkgs.gnused}/bin/sed 's/^\s*//')
date=$(${pkgs.coreutils}/bin/date +'%m %d %Y') date=$(${pkgs.coreutils}/bin/date +'%m %d %Y')
{ {
${pkgs.astrolog}/bin/astrolog -qd $date -zN Berlin -Yt -Yd -d -R Uranus Neptune Pluto "North Node" -A 2 ${unstable.astrolog}/bin/astrolog -qd $date -zN Berlin -Yt -Yd -d -R Uranus Neptune Pluto "North Node" -A 2
${pkgs.astrolog}/bin/astrolog -Yt -Yd -q 10 22 1999 6:32 -zN Kassel -td $date -R Uranus Neptune Pluto "North Node" ${unstable.astrolog}/bin/astrolog -Yt -Yd -q 10 22 1999 6:32 -zN Kassel -td $date -R Uranus Neptune Pluto "North Node"
} | ${toSymbols} | ${pkgs.coreutils}/bin/sort -n | ${pkgs.gnugrep}/bin/grep "^$now" || : } | ${toSymbols} | ${pkgs.coreutils}/bin/sort -n | ${pkgs.gnugrep}/bin/grep "^$now" || :
''); '');
}; };

View File

@@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
lib, lib,
config,
... ...
}: let }: let
autorenkalender-package = pkgs.fetchFromGitHub { autorenkalender-package = pkgs.fetchFromGitHub {
@@ -16,14 +15,12 @@ in {
niveum.telegramBots.autorenkalender = { niveum.telegramBots.autorenkalender = {
enable = true; enable = true;
time = "07:00"; time = "07:00";
tokenFile = config.age.secrets.telegram-token-kmein.path; token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@autorenkalender"]; chatIds = ["@autorenkalender"];
parseMode = "Markdown"; parseMode = "Markdown";
command = "${autorenkalender}/bin/autorenkalender"; command = "${autorenkalender}/bin/autorenkalender";
}; };
age.secrets.telegram-token-kmein.file = ../../secrets/telegram-token-kmein.age;
niveum.passport.services = [ niveum.passport.services = [
{ {
title = "Autorenkalender"; title = "Autorenkalender";

View File

@@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
lib, lib,
config,
... ...
}: let }: let
celan = pkgs.fetchzip { celan = pkgs.fetchzip {
@@ -12,7 +11,7 @@ in {
niveum.telegramBots.celan = { niveum.telegramBots.celan = {
enable = true; enable = true;
time = "08:00"; time = "08:00";
tokenFile = config.age.secrets.telegram-token-kmein.path; token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@PaulCelan"]; chatIds = ["@PaulCelan"];
command = toString (pkgs.writers.writeDash "random-celan" '' command = toString (pkgs.writers.writeDash "random-celan" ''
cd ${celan} cd ${celan}

View File

@@ -2,13 +2,17 @@
config, config,
pkgs, pkgs,
lib, lib,
inputs,
... ...
}: let }: let
telebots = inputs.telebots.defaultPackage.x86_64-linux; nixpkgs-21-11 = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-21.11.tar.gz") {
config.permittedInsecurePackages = [
"python3.9-poetry-1.1.12"
];
};
telebots = nixpkgs-21-11.callPackage <telebots> {};
reverseDirectory = "/run/telegram-reverse"; reverseDirectory = "/run/telegram-reverse";
proverbDirectory = "/run/telegram-proverb"; proverbDirectory = "/run/telegram-proverb";
inherit (import ../../lib) tmpfilesConfig; inherit (import <niveum/lib>) tmpfilesConfig;
in { in {
imports = [ imports = [
./literature-quote.nix ./literature-quote.nix
@@ -19,6 +23,7 @@ in {
./nachtischsatan.nix ./nachtischsatan.nix
./tlg-wotd.nix ./tlg-wotd.nix
./celan.nix ./celan.nix
<niveum/modules/telegram-bot.nix>
]; ];
systemd.tmpfiles.rules = map (path: systemd.tmpfiles.rules = map (path:
@@ -47,45 +52,33 @@ in {
} }
]; ];
age.secrets = {
telegram-token-reverse.file = ../../secrets/telegram-token-reverse.age;
telegram-token-betacode.file = ../../secrets/telegram-token-betacode.age;
telegram-token-proverb.file = ../../secrets/telegram-token-proverb.age;
};
systemd.services.telegram-reverse = { systemd.services.telegram-reverse = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
description = "Telegram reverse bot"; description = "Telegram reverse bot";
path = [pkgs.ffmpeg]; path = [pkgs.ffmpeg];
environment.TELEGRAM_BOT_TOKEN = lib.strings.fileContents <system-secrets/telegram/reverse.token>;
enable = true; enable = true;
script = '' script = "${telebots}/bin/telegram-reverse";
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${telebots}/bin/telegram-reverse
'';
serviceConfig.Restart = "always"; serviceConfig.Restart = "always";
serviceConfig.WorkingDirectory = reverseDirectory; serviceConfig.WorkingDirectory = reverseDirectory;
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-reverse.path}";
}; };
systemd.services.telegram-betacode = { systemd.services.telegram-betacode = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
description = "Telegram beta code bot"; description = "Telegram beta code bot";
environment.TELEGRAM_BOT_TOKEN = lib.strings.fileContents <system-secrets/telegram/betacode.token>;
enable = true; enable = true;
script = '' script = "${telebots}/bin/telegram-betacode";
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${telebots}/bin/telegram-betacode
'';
serviceConfig.Restart = "always"; serviceConfig.Restart = "always";
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-betacode.path}";
}; };
systemd.services.telegram-proverb = { systemd.services.telegram-proverb = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
description = "Telegram proverb bot"; description = "Telegram proverb bot";
environment.TELEGRAM_BOT_TOKEN = lib.strings.fileContents <system-secrets/telegram/proverb.token>;
enable = true; enable = true;
script = '' script = "${telebots}/bin/telegram-proverb";
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${telebots}/bin/telegram-proverb
'';
serviceConfig.Restart = "always"; serviceConfig.Restart = "always";
serviceConfig.WorkingDirectory = proverbDirectory; serviceConfig.WorkingDirectory = proverbDirectory;
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-proverb.path}";
}; };
} }

View File

@@ -1,16 +1,14 @@
{ {
pkgs, pkgs,
config,
inputs,
lib, lib,
... ...
}: let }: let
hesychius = inputs.scripts.outPath + "/hesychius/hesychius.txt"; hesychius = <scripts> + "/hesychius/hesychius.txt";
in { in {
niveum.telegramBots.hesychius = { niveum.telegramBots.hesychius = {
enable = true; enable = true;
time = "08:00"; time = "08:00";
tokenFile = config.age.secrets.telegram-token-kmein.path; token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@HesychiosAlexandreus"]; chatIds = ["@HesychiosAlexandreus"];
command = "${pkgs.coreutils}/bin/shuf -n1 ${hesychius}"; command = "${pkgs.coreutils}/bin/shuf -n1 ${hesychius}";
}; };

View File

@@ -1,16 +1,17 @@
{ {
pkgs, pkgs,
config,
lib, lib,
niveumPackages,
... ...
}: { }: let
scripts = import <niveum/packages/scripts> {inherit pkgs lib;};
inherit (scripts) literature-quote;
in {
niveum.telegramBots.quotebot = { niveum.telegramBots.quotebot = {
enable = true; enable = true;
time = "08/6:00"; time = "08/6:00";
tokenFile = config.age.secrets.telegram-token-kmein.path; token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["-1001760262519"]; chatIds = ["-1001760262519"];
command = "${niveumPackages.literature-quote}/bin/literature-quote"; command = "${literature-quote}/bin/literature-quote";
parseMode = "Markdown"; parseMode = "Markdown";
}; };

View File

@@ -1,10 +1,9 @@
{ {
pkgs, pkgs,
config,
lib, lib,
... ...
}: let }: let
nachtischsatan-bot = {tokenFile}: nachtischsatan-bot = {token}:
pkgs.writers.writePython3 "nachtischsatan-bot" { pkgs.writers.writePython3 "nachtischsatan-bot" {
libraries = [pkgs.python3Packages.python-telegram-bot]; libraries = [pkgs.python3Packages.python-telegram-bot];
} '' } ''
@@ -19,12 +18,11 @@
update.message.reply_text("*flubberflubber*") update.message.reply_text("*flubberflubber*")
with open('${tokenFile}', 'r') as tokenFile: updater = Updater('${token}')
updater = Updater(tokenFile.read().strip())
updater.dispatcher.add_handler(MessageHandler(Filters.all, flubber)) updater.dispatcher.add_handler(MessageHandler(Filters.all, flubber))
updater.start_polling() updater.start_polling()
updater.idle() updater.idle()
''; '';
in { in {
systemd.services.telegram-nachtischsatan = { systemd.services.telegram-nachtischsatan = {
@@ -32,13 +30,11 @@ in {
description = "*flubberflubber*"; description = "*flubberflubber*";
enable = true; enable = true;
script = toString (nachtischsatan-bot { script = toString (nachtischsatan-bot {
tokenFile = config.age.secrets.telegram-token-nachtischsatan.path; token = lib.strings.fileContents <system-secrets/telegram/nachtischsatan.token>;
}); });
serviceConfig.Restart = "always"; serviceConfig.Restart = "always";
}; };
age.secrets.telegram-token-nachtischsatan.file = ../../secrets/telegram-token-nachtischsatan.age;
niveum.passport.services = [ niveum.passport.services = [
{ {
title = "Nachtischsatan-Bot"; title = "Nachtischsatan-Bot";

View File

@@ -1,5 +1,4 @@
{ {
config,
pkgs, pkgs,
lib, lib,
... ...
@@ -7,7 +6,7 @@
niveum.telegramBots.smyth = { niveum.telegramBots.smyth = {
enable = true; enable = true;
time = "08:00"; time = "08:00";
tokenFile = config.age.secrets.telegram-token-kmein.path; token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@HerbertWeirSmyth"]; chatIds = ["@HerbertWeirSmyth"];
command = toString (pkgs.writers.writeDash "random-smyth" '' command = toString (pkgs.writers.writeDash "random-smyth" ''
set -efu set -efu

View File

@@ -1,14 +1,13 @@
{ {
pkgs, pkgs,
lib, lib,
config,
... ...
}: { }: {
niveum.telegramBots.tlg-wotd = { niveum.telegramBots.tlg-wotd = {
enable = true; enable = true;
time = "9:30"; time = "9:30";
token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@tlgwotd"]; chatIds = ["@tlgwotd"];
tokenFile = config.age.secrets.telegram-token-kmein.path;
command = toString (pkgs.writers.writeDash "tlg-wotd" '' command = toString (pkgs.writers.writeDash "tlg-wotd" ''
${pkgs.curl}/bin/curl -sSL http://stephanus.tlg.uci.edu/Iris/Wotd \ ${pkgs.curl}/bin/curl -sSL http://stephanus.tlg.uci.edu/Iris/Wotd \
| ${pkgs.recode}/bin/recode html..utf8 \ | ${pkgs.recode}/bin/recode html..utf8 \

View File

@@ -1,5 +1,4 @@
{pkgs, ...}: { {pkgs, ...}: {
services.tor.enable = true; services.tor.enable = true;
services.tor.client.enable = true; environment.systemPackages = [pkgs.tor];
environment.systemPackages = [pkgs.tor pkgs.torsocks];
} }

View File

@@ -1,12 +1,13 @@
{ {
config,
pkgs, pkgs,
lib, lib,
... ...
}: let }: let
inherit (import ../lib) localAddresses; inherit (import <niveum/lib>) localAddresses;
living-room-id = 131090; living-room-id = 131090;
in { in {
imports = [<niveum/modules/traadfri.nix>];
environment.systemPackages = [ environment.systemPackages = [
(pkgs.writers.writeDashBin "traadfri-party" '' (pkgs.writers.writeDashBin "traadfri-party" ''
while true; do while true; do
@@ -19,18 +20,11 @@ in {
'') '')
]; ];
age.secrets.traadfri-key = {
file = ../secrets/traadfri-key.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
niveum.traadfri = { niveum.traadfri = {
enable = true; enable = true;
user = "kmein"; user = "kmein";
host = localAddresses.tradfri; host = localAddresses.tradfri;
keyFile = config.age.secrets.traadfri-key.path; key = lib.strings.fileContents <secrets/traadfri.key>;
rooms = { rooms = {
corridor = 131080; corridor = 131080;
kitchen = 131081; kitchen = 131081;

View File

@@ -2,27 +2,18 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }: {
url = "http://prism.r/realwallpaper-krebs-stars-berlin.png"; imports = [<stockholm/krebs/3modules/fetchWallpaper.nix>];
stateDir = "~/.cache/wallpaper";
in {
systemd.user.services.wallpaper = {
wantedBy = ["graphical-session.target"];
after = ["network.target"];
script = ''
set -euf
mkdir -p ${stateDir} krebs.fetchWallpaper = {
chmod o+rx ${stateDir} enable = true;
cd ${stateDir} url = "http://prism.r/realwallpaper-krebs-stars-berlin.png";
(${pkgs.curl}/bin/curl -s -o wallpaper.tmp -z wallpaper.tmp ${lib.escapeShellArg url} && cp wallpaper.tmp wallpaper) || : };
${pkgs.feh}/bin/feh --no-fehbg --bg-scale wallpaper
''; users.users.fetchWallpaper.isSystemUser = true;
startAt = "*:00,10,20,30,40,50";
serviceConfig = { services.xserver = {
Restart = "always"; display = lib.mkForce 0; # needed for fetchWallpaper to find the X display
RestartSec = "15s"; displayManager.sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +LOCAL:";
StartLimitBurst = 0;
};
}; };
} }

View File

@@ -77,11 +77,7 @@
precmd () { precmd () {
vcs_info vcs_info
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] || [ -n "$SSH_CONNECTION" ]; then RPROMPT="$vcs_info_msg_0_"
RPROMPT="$(hostname)"
else
RPROMPT="$vcs_info_msg_0_"
fi
if [[ -n $IN_NIX_SHELL ]]; then if [[ -n $IN_NIX_SHELL ]]; then
PROMPT='%B%~%b %(?.%F{${promptColours.success}}.%F{${promptColours.failure}})λ%f ' PROMPT='%B%~%b %(?.%F{${promptColours.success}}.%F{${promptColours.failure}})λ%f '
else else

667
flake.lock generated
View File

@@ -1,194 +1,12 @@
{ {
"nodes": { "nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1680281360,
"narHash": "sha256-XdLTgAzjJNDhAG2V+++0bHpSzfvArvr2pW6omiFfEJk=",
"owner": "ryantm",
"repo": "agenix",
"rev": "e64961977f60388dd0b49572bb0fc453b871f896",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"blessings": {
"flake": false,
"locked": {
"lastModified": 1549397368,
"narHash": "sha256-YVIGRG+/ey4nFEZl1ZPHj7Hx/Of3rsUGnkLK4V4zZd0=",
"ref": "refs/heads/master",
"rev": "d94712a015636efe7ec79bc0a2eec6739d0be779",
"revCount": 18,
"type": "git",
"url": "https://cgit.krebsco.de/blessings"
},
"original": {
"type": "git",
"url": "https://cgit.krebsco.de/blessings"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1673295039,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1681202837, "lastModified": 1667395993,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401", "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_7": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_8": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_9": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -200,71 +18,56 @@
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixos-unstable"
], ],
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1681092193, "lastModified": 1675371293,
"narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=", "narHash": "sha256-LrCjtrAXj/WJphhGEMnHgZs7oTsfOlvPfOjFTIvg39k=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af", "rev": "d1c7730bb707bf8124d997952f7babd2a281ae68",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-22.11", "ref": "master",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"krops": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixos-stable"
]
},
"locked": {
"lastModified": 1661273257,
"narHash": "sha256-cywpSH3D291AwdO/ecJxHeN2Vuuz0cIy/NEXMsFT+Og=",
"owner": "kmein",
"repo": "krops",
"rev": "542bc544ec8b0b807933a812d098e601683b0956",
"type": "github"
},
"original": {
"owner": "kmein",
"repo": "krops",
"type": "github"
}
},
"menstruation-backend": { "menstruation-backend": {
"inputs": { "flake": false,
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": { "locked": {
"lastModified": 1677075142, "lastModified": 1667816906,
"narHash": "sha256-0RXVZcK2YtPckd/3+jb+yLpeXZ6jnQe25w9idztDXi8=", "narHash": "sha256-VdckYVSQZfqThPb06Y5TGSI+kkibgM/G9pH5SQHIybI=",
"owner": "kmein", "owner": "kmein",
"repo": "menstruation.rs", "repo": "menstruation.rs",
"rev": "e34af4393963cdbadb456b7b9ae2e95e6db7b8a3", "rev": "95c495d453c35f20a6a5641a88a862c668404acf",
"type": "github"
},
"original": {
"owner": "kmein",
"repo": "menstruation.rs",
"type": "github"
}
},
"menstruation-backend_2": {
"inputs": {
"flake-utils": [
"menstruation-telegram",
"menstruation-backend",
"rust-overlay",
"flake-utils"
],
"nixpkgs": [
"menstruation-telegram",
"menstruation-backend",
"rust-overlay",
"nixpkgs"
],
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1677075142,
"narHash": "sha256-0RXVZcK2YtPckd/3+jb+yLpeXZ6jnQe25w9idztDXi8=",
"owner": "kmein",
"repo": "menstruation.rs",
"rev": "e34af4393963cdbadb456b7b9ae2e95e6db7b8a3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -274,17 +77,13 @@
} }
}, },
"menstruation-telegram": { "menstruation-telegram": {
"inputs": { "flake": false,
"flake-utils": "flake-utils_3",
"menstruation-backend": "menstruation-backend_2",
"nixpkgs": "nixpkgs_3"
},
"locked": { "locked": {
"lastModified": 1677075205, "lastModified": 1667816918,
"narHash": "sha256-2+xuAhsS3y2qB0ObVPCHXrmnTsIZ8uI5HFI4+Ash8PY=", "narHash": "sha256-yQSl0iKqHm7qFLELY8e7OzRRdnqSBbzJmQIYgkXlJpQ=",
"owner": "kmein", "owner": "kmein",
"repo": "menstruation-telegram", "repo": "menstruation-telegram",
"rev": "f7ddb6d9610aacb50ec66a3ce1bdc49fe4664a49", "rev": "828872cf9c425442705a95019eceee397bc1c03f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -293,81 +92,29 @@
"type": "github" "type": "github"
} }
}, },
"nixinate": { "nix-writers": {
"inputs": { "flake": false,
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1671116920, "lastModified": 1675197881,
"narHash": "sha256-QmDGsUUmAGn77UTR7eQJmebl8f3IIUCtmbbAdJqKA3s=", "narHash": "sha256-gYtduNF59yqv4BgW4fC+tZHKE7cpOkZf+Y34psyFO5U=",
"owner": "matthewcroughan", "ref": "refs/heads/master",
"repo": "nixinate", "rev": "d1424777b5f2e12cbd80efd1b55335dcba7c32bd",
"rev": "b4d17b8e2a4abc47e93e1a1c466e0286a63640d8", "revCount": 38,
"type": "github" "type": "git",
"url": "https://cgit.krebsco.de/nix-writers"
}, },
"original": { "original": {
"owner": "matthewcroughan", "type": "git",
"repo": "nixinate", "url": "https://cgit.krebsco.de/nix-writers"
"type": "github"
} }
}, },
"nixpkgs": { "nixos-stable": {
"locked": { "locked": {
"lastModified": 1665296151, "lastModified": 1675237434,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", "narHash": "sha256-YoFR0vyEa1HXufLNIFgOGhIFMRnY6aZ0IepZF5cYemo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", "rev": "285b3ff0660640575186a4086e1f8dc0df2874b5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1669418739,
"narHash": "sha256-T86oFvcUIRwHWBWUt7WjaP4BP/3lDGbv5AppQSI1FkI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1681269223,
"narHash": "sha256-i6OeI2f7qGvmLfD07l1Az5iBL+bFeP0RHixisWtpUGo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "87edbd74246ccdfa64503f334ed86fa04010bab9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -377,112 +124,30 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixos-unstable": {
"locked": { "locked": {
"lastModified": 1677158633, "lastModified": 1675273418,
"narHash": "sha256-t7za78oRkDIjdFQF0PCilfCziFyhfowCgs9Ry+sEvE4=", "narHash": "sha256-tpYc4TEGvDzh9uRf44QemyQ4TpVuUbxb07b2P99XDbM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "129b6f78121802d18d215c9f9e04d7971c58ea0c", "rev": "4d7c2644dbac9cf8282c0afe68fca8f0f3e7b2db",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_6": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_8": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1669418739,
"narHash": "sha256-T86oFvcUIRwHWBWUt7WjaP4BP/3lDGbv5AppQSI1FkI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1681454031,
"narHash": "sha256-JOamj7vKkFRp5mJ7FKt5dPfCmWj33sZLnBGDt15c/sc=",
"owner": "nix-community",
"repo": "NUR",
"rev": "8a35714f0be00235e2a1c8b759e6dc3888763d8b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"recht": { "recht": {
"inputs": { "flake": false,
"blessings": "blessings",
"flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_5"
},
"locked": { "locked": {
"lastModified": 1677165419, "lastModified": 1669719044,
"narHash": "sha256-pjYpXg+09rayon6uhSNd30ryrT2zYLOlDLBHQ9pnGZg=", "narHash": "sha256-WsLWlTM2Hrurj9kVajybIOavV9QPYiJweMCOQR6h+YI=",
"owner": "kmein", "owner": "kmein",
"repo": "recht", "repo": "recht",
"rev": "5fa158ce21de797bd95a934dab8d4403b7531d20", "rev": "7c15b13328fb5cee01012c488ff235ee730cac70",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -493,11 +158,11 @@
}, },
"retiolum": { "retiolum": {
"locked": { "locked": {
"lastModified": 1681246809, "lastModified": 1675364416,
"narHash": "sha256-3RUAwk0ApPjq2Ms8KiAh+gG6EJKWurIur612w2m3Zu8=", "narHash": "sha256-u7kbHg/cp+GdW55B6V52GG0D9+zWOhmVI2nh/NiMxfw=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "c8ddb36f3d85be762aeb1893a79da36014f55658", "rev": "ae5112af96361acc314e1d270d0c9281984fc517",
"revCount": 296, "revCount": 280,
"type": "git", "type": "git",
"url": "https://git.thalheim.io/Mic92/retiolum" "url": "https://git.thalheim.io/Mic92/retiolum"
}, },
@@ -508,119 +173,32 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"krops": "krops",
"menstruation-backend": "menstruation-backend", "menstruation-backend": "menstruation-backend",
"menstruation-telegram": "menstruation-telegram", "menstruation-telegram": "menstruation-telegram",
"nixinate": "nixinate", "nix-writers": "nix-writers",
"nixpkgs": "nixpkgs_4", "nixos-stable": "nixos-stable",
"nur": "nur", "nixos-unstable": "nixos-unstable",
"recht": "recht", "recht": "recht",
"retiolum": "retiolum", "retiolum": "retiolum",
"scripts": "scripts", "scripts": "scripts",
"stockholm": "stockholm",
"telebots": "telebots", "telebots": "telebots",
"tinc-graph": "tinc-graph", "tinc-graph": "tinc-graph",
"traadfri": "traadfri", "traadfri": "traadfri",
"voidrice": "voidrice" "tuna": "tuna"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1677033035,
"narHash": "sha256-w6XsKaW46kZNEk2vVfuoNIBEq/YzDy9kNk8cU0xJZEQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "6c9e8ea3ba73a9fed29ddc1cc52ade8e5c946a8d",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1677033035,
"narHash": "sha256-w6XsKaW46kZNEk2vVfuoNIBEq/YzDy9kNk8cU0xJZEQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "6c9e8ea3ba73a9fed29ddc1cc52ade8e5c946a8d",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_3": {
"inputs": {
"flake-utils": "flake-utils_6",
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1677119371,
"narHash": "sha256-L0Da4eKzDZrsy8ysOS1lhgDjAgEqGvYGf/lXaRd5/YQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c67c79ea25664d66e74ae91a6fa0d6c65d12d3a7",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_4": {
"inputs": {
"flake-utils": "flake-utils_8",
"nixpkgs": "nixpkgs_8"
},
"locked": {
"lastModified": 1677119371,
"narHash": "sha256-L0Da4eKzDZrsy8ysOS1lhgDjAgEqGvYGf/lXaRd5/YQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c67c79ea25664d66e74ae91a6fa0d6c65d12d3a7",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
} }
}, },
"scripts": { "scripts": {
"inputs": { "flake": false,
"flake-utils": [
"scripts",
"rust-overlay",
"flake-utils"
],
"nixpkgs": [
"scripts",
"rust-overlay",
"nixpkgs"
],
"rust-overlay": "rust-overlay_3"
},
"locked": { "locked": {
"lastModified": 1677271864, "lastModified": 1675238486,
"narHash": "sha256-BghYMB/lauerExMsDtGZNGZGdoGuF7LPtbmpyh9ycyA=", "narHash": "sha256-Hs9NKK0UFaNqrui2VauBnMnV/14U3eNWaI12EmVYXWY=",
"owner": "kmein", "owner": "kmein",
"repo": "scripts", "repo": "scripts",
"rev": "79bffac7f9eda1b3be76f2a4ff18d81b44c74390", "rev": "5cefa5f112e7fe54e0302b7bc33bc06e1f762002",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -629,32 +207,30 @@
"type": "github" "type": "github"
} }
}, },
"systems": { "stockholm": {
"flake": false,
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1675564669,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Fd4wBl9b5Aqt4ctH2vJu/oPvgTOHD+ME8MUEu3oR2tE=",
"owner": "nix-systems", "ref": "refs/heads/master",
"repo": "default", "rev": "e44fe862f0bedc658aabd1daafb16376f188857e",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "revCount": 11353,
"type": "github" "type": "git",
"url": "https://cgit.krebsco.de/stockholm"
}, },
"original": { "original": {
"owner": "nix-systems", "type": "git",
"repo": "default", "url": "https://cgit.krebsco.de/stockholm"
"type": "github"
} }
}, },
"telebots": { "telebots": {
"inputs": { "flake": false,
"flake-utils": "flake-utils_7",
"nixpkgs": "nixpkgs_7"
},
"locked": { "locked": {
"lastModified": 1677156381, "lastModified": 1623510321,
"narHash": "sha256-OMhqYJO2bWtL6osTMpQhA4ySUl4gvJTI13m1agipHJ0=", "narHash": "sha256-MxYNNL81RXZkYLd4IgiNTSo1X80kTuDzsdGNSA0f1y8=",
"owner": "kmein", "owner": "kmein",
"repo": "telebots", "repo": "telebots",
"rev": "5527e359e8394f2f66067de7f61587eb65055209", "rev": "22931c9457e092c4e413555dbe61819d77844246",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -664,21 +240,13 @@
} }
}, },
"tinc-graph": { "tinc-graph": {
"inputs": { "flake": false,
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_4"
},
"locked": { "locked": {
"lastModified": 1677160040, "lastModified": 1666162569,
"narHash": "sha256-UhyZaIZ88vN/7fiBcamfV77eHjQnL8zSVznaqxLgbhs=", "narHash": "sha256-7ebWs/ryDebUMONkn6dPckNnUGrEuPQScoY+O/+vo+Q=",
"owner": "kmein", "owner": "kmein",
"repo": "tinc-graph", "repo": "tinc-graph",
"rev": "f705ca35e30ab0daf9cf52000e58931d7c5c42b5", "rev": "72a4b305fcb49cfd6d456103cda45888a6b34bbe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -688,16 +256,13 @@
} }
}, },
"traadfri": { "traadfri": {
"inputs": { "flake": false,
"flake-utils": "flake-utils_9",
"nixpkgs": "nixpkgs_9"
},
"locked": { "locked": {
"lastModified": 1677165914, "lastModified": 1640451803,
"narHash": "sha256-3N08NabgDwTUy1n5wxpT27iddFrgXW35E1x2UgAKkDQ=", "narHash": "sha256-zS/b93uFpPM9basNP7ngmm+YjYV0IUQAmNghetHA6Ss=",
"owner": "kmein", "owner": "kmein",
"repo": "traadfri", "repo": "traadfri",
"rev": "11571116ed5d2c6478c615d663d1f96f57a97ba9", "rev": "cf46bd09cd3263b90a09b0ca979aa705a4c3671c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -706,6 +271,22 @@
"type": "github" "type": "github"
} }
}, },
"tuna": {
"flake": false,
"locked": {
"lastModified": 1627117248,
"narHash": "sha256-OfqbWLblJY4BJlrCpn8EkHoP3baNJSDTbw45SPaX+0Q=",
"owner": "kmein",
"repo": "tuna",
"rev": "1cbed44069a3009738afdafecefe0a05316039a6",
"type": "github"
},
"original": {
"owner": "kmein",
"repo": "tuna",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1667395993,
@@ -720,22 +301,6 @@
"repo": "flake-utils", "repo": "flake-utils",
"type": "github" "type": "github"
} }
},
"voidrice": {
"flake": false,
"locked": {
"lastModified": 1681301489,
"narHash": "sha256-5Zz33Q3E4A9nsEmxPQikYeX7Rvu3hM+PlXx/0SIqG34=",
"owner": "Lukesmithxyz",
"repo": "voidrice",
"rev": "d4ff2ebaf3e88efe20cae0d1e592fddfc433c96e",
"type": "github"
},
"original": {
"owner": "Lukesmithxyz",
"repo": "voidrice",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

479
flake.nix
View File

@@ -2,316 +2,193 @@
description = "niveum: packages, modules, systems"; description = "niveum: packages, modules, systems";
inputs = { inputs = {
agenix.url = "github:ryantm/agenix"; nixos-stable.url = "github:NixOS/nixpkgs/nixos-22.11";
flake-utils.url = "github:numtide/flake-utils"; nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-22.11";
menstruation-backend.url = "github:kmein/menstruation.rs";
menstruation-telegram.url = "github:kmein/menstruation-telegram";
nixinate.url = "github:matthewcroughan/nixinate";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
nur.url = "github:nix-community/NUR";
recht.url = "github:kmein/recht";
scripts.url = "github:kmein/scripts";
retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum";
telebots.url = "github:kmein/telebots";
tinc-graph.url = "github:kmein/tinc-graph";
traadfri.url = "github:kmein/traadfri";
voidrice.url = "github:Lukesmithxyz/voidrice";
agenix.inputs.nixpkgs.follows = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager = {
menstruation-backend.inputs.flake-utils.follows = "flake-utils"; url = "github:nix-community/home-manager/master";
menstruation-backend.inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixos-unstable";
nixinate.inputs.nixpkgs.follows = "nixpkgs"; };
tinc-graph.inputs.flake-utils.follows = "flake-utils"; krops = {
tinc-graph.inputs.nixpkgs.follows = "nixpkgs"; url = "github:kmein/krops";
voidrice.flake = false; inputs.nixpkgs.follows = "nixos-stable";
inputs.flake-utils.follows = "flake-utils";
};
retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum";
# legacy
menstruation-backend = {
url = "github:kmein/menstruation.rs";
flake = false;
};
menstruation-telegram = {
url = "github:kmein/menstruation-telegram";
flake = false;
};
nix-writers = {
url = "git+https://cgit.krebsco.de/nix-writers";
flake = false;
};
recht = {
url = "github:kmein/recht";
flake = false;
};
scripts = {
url = "github:kmein/scripts";
flake = false;
};
stockholm = {
url = "git+https://cgit.krebsco.de/stockholm";
flake = false;
};
telebots = {
url = "github:kmein/telebots";
flake = false;
};
tinc-graph = {
url = "github:kmein/tinc-graph";
flake = false;
};
traadfri = {
url = "github:kmein/traadfri";
flake = false;
};
tuna = {
url = "github:kmein/tuna";
flake = false;
};
}; };
outputs = inputs @ { outputs = {
self, self,
nixpkgs,
nur,
home-manager,
nixinate,
agenix,
retiolum,
flake-utils, flake-utils,
... home-manager,
}: krops,
{ menstruation-backend,
apps = nixinate.nixinate.x86_64-linux self; menstruation-telegram,
nix-writers,
nixosModules = { nixos-unstable,
htgen = import modules/htgen.nix; nixos-stable,
moodle-dl = import modules/moodle-dl.nix; recht,
networkmanager-declarative = import modules/networkmanager-declarative.nix; retiolum,
passport = import modules/passport.nix; scripts,
panoptikon = import modules/panoptikon.nix; stockholm,
power-action = import modules/power-action.nix; telebots,
specus = import modules/specus.nix; tinc-graph,
system-dependent = import modules/system-dependent.nix; traadfri,
telegram-bot = import modules/telegram-bot.nix; tuna,
traadfri = import modules/traadfri.nix; } @ inputs: let
}; system = "x86_64-linux";
pkgs = nixos-stable.legacyPackages.${system};
lib = { home =
panoptikon = import lib/panoptikon.nix; if nixos-stable.lib.inPureEvalMode or false
}; then _: /nonexistent
else import lib/home.nix;
nixosConfigurations = { source = {
ful = nixpkgs.lib.nixosSystem rec { sources,
system = "aarch64-linux"; unstable,
specialArgs = { name,
niveumPackages = inputs.self.packages.${system}; }:
niveumLib = inputs.self.lib; {
inherit inputs; niveum.file = toString ./.;
}; nixos-config.symlink = "niveum/systems/${name}/configuration.nix";
modules = [ system-secrets.pass = {
dir = toString (home /.password-store);
name = "systems/${name}";
};
secrets.pass = {
dir = toString (home /.password-store);
name = "shared";
};
nixpkgs.git = {
url = "https://github.com/NixOS/nixpkgs";
ref =
(
if unstable
then inputs.nixos-unstable
else inputs.nixos-stable
)
.rev;
shallow = true;
};
}
// nixos-stable.lib.mapAttrs' (name: value: {
inherit name;
value.git = {
url = let
github = x: "https://github.com/${x}";
in
{ {
_module.args.nixinate = { home-manager = github "nix-community/home-manager";
host = "ful"; menstruation-backend = github "kmein/menstruation.rs";
sshUser = "root"; menstruation-telegram = github "kmein/menstruation-telegram";
buildOn = "remote"; nixos-unstable = github "NixOS/nixpkgs";
substituteOnTarget = true; nix-writers = "https://cgit.krebsco.de/nix-writers";
hermetic = false; recht = github "kmein/recht";
}; retiolum = "https://git.thalheim.io/Mic92/retiolum";
stockholm = "https://cgit.krebsco.de/stockholm";
scripts = github "kmein/scripts";
telebots = github "kmein/telebots";
tinc-graph = github "kmein/tinc-graph";
traadfri = github "kmein/traadfri";
} }
systems/ful/configuration.nix .${name};
agenix.nixosModules.default ref = value.rev;
inputs.self.nixosModules.passport shallow = true;
inputs.self.nixosModules.specus
inputs.self.nixosModules.panoptikon
retiolum.nixosModules.retiolum
nur.nixosModules.nur
];
}; };
zaatar = nixpkgs.lib.nixosSystem rec { }) (nixos-stable.lib.filterAttrs (name: _: builtins.elem name sources) inputs);
system = "x86_64-linux"; deployScriptFor = {
specialArgs = { name,
niveumPackages = inputs.self.packages.${system}; user ? "root",
inherit inputs; host,
unstable ? false,
sshPort ? (import ./lib/default.nix).sshPort,
sources,
}:
toString (krops.packages.${system}.writeDeploy "deploy-${name}" {
source = krops.lib.evalSource [(source {inherit sources unstable name;})];
target = "${user}@${host}:${toString sshPort}";
useNixOutputMonitor = true;
});
in {
apps.${system} = let
forSystems = f: builtins.listToAttrs (map f (builtins.attrNames (builtins.readDir ./systems)));
externalNetwork = import ./lib/external-network.nix;
deployScripts = forSystems (name: {
name = "deploy-${name}";
value = {
type = "app";
program = deployScriptFor {
inherit name;
host =
if externalNetwork ? name
then externalNetwork.${name}
else "${name}.r";
unstable = false; # name == "kabsa" || name == "manakish";
sources =
["nix-writers" "nixpkgs" "retiolum" "stockholm"]
++ {
zaatar = ["traadfri" "nixos-unstable"];
ful = [];
tahina = [];
tabula = [];
kabsa = ["traadfri" "nixos-unstable" "home-manager" "menstruation-backend" "recht"];
manakish = ["traadfri" "nixos-unstable" "home-manager" "menstruation-backend" "recht"];
makanek = ["nixos-unstable" "menstruation-telegram" "menstruation-backend" "scripts" "telebots" "tinc-graph"];
}
.${name};
}; };
modules = [
{
_module.args.nixinate = {
host = "zaatar";
sshUser = "root";
buildOn = "remote";
substituteOnTarget = true;
hermetic = false;
};
}
systems/zaatar/configuration.nix
inputs.self.nixosModules.moodle-dl
agenix.nixosModules.default
retiolum.nixosModules.retiolum
];
}; };
makanek = nixpkgs.lib.nixosSystem rec { });
system = "x86_64-linux"; ciScripts = forSystems (name: {
# for using inputs in other config files name = "build-${name}";
specialArgs = { value = {
niveumPackages = inputs.self.packages.${system}; type = "app";
inherit inputs; program = import ./ci.nix {inherit name system inputs;};
};
modules = [
{
_module.args.nixinate = {
host = "makanek";
sshUser = "root";
buildOn = "remote";
substituteOnTarget = true;
hermetic = false;
};
}
systems/makanek/configuration.nix
inputs.self.nixosModules.telegram-bot
inputs.self.nixosModules.htgen
inputs.self.nixosModules.passport
inputs.self.nixosModules.specus
agenix.nixosModules.default
retiolum.nixosModules.retiolum
nur.nixosModules.nur
];
}; };
tahina = nixpkgs.lib.nixosSystem { });
system = "x86_64-linux"; in
modules = [ deployScripts // ciScripts;
systems/tahina/configuration.nix };
agenix.nixosModules.default
retiolum.nixosModules.retiolum
];
};
tabula = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
systems/tabula/configuration.nix
agenix.nixosModules.default
retiolum.nixosModules.retiolum
];
};
manakish = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
niveumPackages = inputs.self.packages.${system};
inherit inputs;
};
modules = [
{
_module.args.nixinate = {
host = "manakish";
sshUser = "root";
buildOn = "remote";
substituteOnTarget = true;
hermetic = false;
};
}
systems/manakish/configuration.nix
agenix.nixosModules.default
retiolum.nixosModules.retiolum
home-manager.nixosModules.home-manager
nur.nixosModules.nur
];
};
kabsa = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
niveumPackages = inputs.self.packages.${system};
inherit inputs;
};
modules = [
{
_module.args.nixinate = {
host = "kabsa";
sshUser = "root";
buildOn = "remote";
substituteOnTarget = true;
hermetic = false;
};
}
systems/kabsa/configuration.nix
agenix.nixosModules.default
retiolum.nixosModules.retiolum
inputs.self.nixosModules.specus
home-manager.nixosModules.home-manager
nur.nixosModules.nur
];
};
};
}
// flake-utils.lib.eachSystem [flake-utils.lib.system.x86_64-linux flake-utils.lib.system.aarch64-linux] (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
nur.overlay
(self: super: {
mpv = super.mpv.override {scripts = [inputs.self.packages.${system}.mpv-visualizer];};
dmenu = super.writers.writeDashBin "dmenu" ''exec ${pkgs.rofi}/bin/rofi -dmenu "$@"'';
})
];
};
wrapScript = {
packages ? [],
name,
script,
}:
pkgs.writers.writeDashBin name ''PATH=$PATH:${nixpkgs.lib.makeBinPath (packages ++ [pkgs.findutils pkgs.coreutils pkgs.gnused pkgs.gnugrep])} ${script} "$@"'';
in {
packages = rec {
auc = pkgs.callPackage packages/auc.nix {};
betacode = pkgs.callPackage packages/betacode.nix {};
cheat-sh = pkgs.callPackage packages/cheat-sh.nix {};
closest = pkgs.callPackage packages/closest {};
cyberlocker-tools = pkgs.callPackage packages/cyberlocker-tools.nix {};
default-gateway = pkgs.callPackage packages/default-gateway.nix {};
depp = pkgs.callPackage packages/depp.nix {};
devanagari = pkgs.callPackage packages/devanagari {};
devour = pkgs.callPackage packages/devour.nix {};
dic = pkgs.callPackage packages/dic.nix {};
dirmir = pkgs.callPackage packages/dirmir.nix {};
dmenu-bluetooth = pkgs.callPackage packages/dmenu-bluetooth.nix {};
dmenu-scrot = pkgs.callPackage packages/dmenu-scrot.nix {};
dns-sledgehammer = pkgs.callPackage packages/dns-sledgehammer.nix {};
fkill = pkgs.callPackage packages/fkill.nix {};
fzfmenu = pkgs.callPackage packages/fzfmenu.nix {};
genius = pkgs.callPackage packages/genius.nix {};
gfs-fonts = pkgs.callPackage packages/gfs-fonts.nix {};
git-preview = pkgs.callPackage packages/git-preview.nix {};
hc = pkgs.callPackage packages/hc.nix {};
heuretes = pkgs.callPackage packages/heuretes.nix {};
htgen = pkgs.callPackage packages/htgen.nix {};
image-convert-favicon = pkgs.callPackage packages/image-convert-favicon.nix {};
image-convert-tolino = pkgs.callPackage packages/image-convert-tolino.nix {};
infschmv = pkgs.callPackage packages/infschmv.nix {};
iolanguage = pkgs.callPackage packages/iolanguage.nix {};
ipa = pkgs.writers.writePython3Bin "ipa" {flakeIgnore = ["E501"];} (builtins.readFile packages/ipa.py);
ix = pkgs.callPackage packages/ix.nix {};
jsesh = pkgs.callPackage packages/jsesh.nix {};
k-lock = pkgs.callPackage packages/k-lock.nix {};
kirciuoklis = pkgs.callPackage packages/kirciuoklis.nix {};
klem = pkgs.callPackage packages/klem.nix {};
kpaste = pkgs.callPackage packages/kpaste.nix {};
literature-quote = pkgs.callPackage packages/literature-quote.nix {};
mahlzeit = pkgs.haskellPackages.callPackage packages/mahlzeit.nix {};
man-pandoc = pkgs.callPackage packages/man/pandoc.nix {};
man-pdf = pkgs.callPackage packages/man-pdf.nix {};
mansplain = pkgs.callPackage packages/mansplain.nix {};
manual-sort = pkgs.callPackage packages/manual-sort.nix {};
menu-calc = pkgs.callPackage packages/menu-calc.nix {};
meteo = pkgs.callPackage packages/meteo.nix {};
mpv-radio = pkgs.callPackage packages/mpv-radio.nix {di-fm-key-file = "/dev/null";};
mpv-tv = pkgs.callPackage packages/mpv-tv.nix {};
mpv-visualizer = pkgs.callPackage packages/mpv-visualizer.nix {};
new-mac = pkgs.callPackage packages/new-mac.nix {};
nix-git = pkgs.callPackage packages/nix-git.nix {};
nix-index-update = pkgs.callPackage packages/nix-index-update.nix {inherit system;};
opustags = pkgs.callPackage packages/opustags.nix {};
pls = pkgs.callPackage packages/pls.nix {};
qrpaste = pkgs.callPackage packages/qrpaste.nix {};
rfc = pkgs.callPackage packages/rfc.nix {};
scanned = pkgs.callPackage packages/scanned.nix {};
swallow = pkgs.callPackage packages/swallow.nix {};
text2pdf = pkgs.callPackage packages/text2pdf.nix {};
timer = pkgs.callPackage packages/timer.nix {};
tocharian-font = pkgs.callPackage packages/tocharian-font.nix {};
trans = pkgs.callPackage packages/trans.nix {};
ttspaste = pkgs.callPackage packages/ttspaste.nix {};
unicodmenu = pkgs.callPackage packages/unicodmenu.nix {};
untilport = pkgs.callPackage packages/untilport.nix {};
vg = pkgs.callPackage packages/vg.nix {};
vimPlugins-cheat-sh-vim = pkgs.callPackage packages/vimPlugins/cheat-sh.nix {};
vimPlugins-icalendar-vim = pkgs.callPackage packages/vimPlugins/icalendar-vim.nix {};
vimPlugins-jq-vim = pkgs.callPackage packages/vimPlugins/jq-vim.nix {};
vimPlugins-vim-256noir = pkgs.callPackage packages/vimPlugins/vim-256noir.nix {};
vimPlugins-vim-colors-paramount = pkgs.callPackage packages/vimPlugins/vim-colors-paramount.nix {};
vimPlugins-vim-fetch = pkgs.callPackage packages/vimPlugins/vim-fetch.nix {};
vimPlugins-vim-fsharp = pkgs.callPackage packages/vimPlugins/vim-fsharp.nix {};
vimPlugins-vim-mail = pkgs.callPackage packages/vimPlugins/vim-mail.nix {};
vimPlugins-vim-reason-plus = pkgs.callPackage packages/vimPlugins/vim-reason-plus.nix {};
vimv = pkgs.callPackage packages/vimv.nix {};
weechat-declarative = pkgs.callPackage packages/weechat-declarative.nix {};
weechatScripts-hotlist2extern = pkgs.callPackage packages/weechatScripts/hotlist2extern.nix {};
wttr = pkgs.callPackage packages/wttr.nix {};
itl = pkgs.callPackage packages/itl.nix {};
itools = pkgs.callPackage packages/itools.nix {itl = itl;};
booksplit = wrapScript {
script = inputs.voidrice.outPath + "/.local/bin/booksplit";
name = "booksplit";
packages = [pkgs.ffmpeg pkgs.glibc.bin];
};
dmenu-randr = wrapScript {
script = inputs.voidrice.outPath + "/.local/bin/displayselect";
name = "dmenu-randr";
packages = [pkgs.dmenu pkgs.bc pkgs.psmisc pkgs.util-linux pkgs.xorg.xrandr pkgs.gawk pkgs.libnotify pkgs.arandr (pkgs.writers.writeDashBin "setbg" "")];
};
tag = wrapScript {
script = inputs.voidrice.outPath + "/.local/bin/tag";
name = "tag";
packages = [pkgs.ffmpeg];
};
};
});
} }

View File

@@ -40,7 +40,7 @@ rec {
sshPort = 22022; sshPort = 22022;
colours = import ./colours/owickstrom-dark.nix; colours = import ./colours/papercolor-dark.nix;
theme = pkgs: { theme = pkgs: {
gtk = { gtk = {
@@ -72,7 +72,7 @@ rec {
sshKeys = pkgs: sshKeys = pkgs:
pkgs.lib.strings.splitString "\n" (pkgs.lib.strings.fileContents (pkgs.fetchurl { pkgs.lib.strings.splitString "\n" (pkgs.lib.strings.fileContents (pkgs.fetchurl {
url = "https://github.com/kmein.keys"; url = "https://github.com/kmein.keys";
hash = "sha256-TvvPwplrH9cw7NE4GKqbE5ga+oBHM+TkjxYQ3b1fpLI="; sha256 = "09c6ny0rmpid1m0pc1wsmb3wyy9g721lf4kv55i4lrp42b3i2d5b";
})); }));
}; };

View File

@@ -1,7 +1,96 @@
{lib, ...}: { {
lib,
mainMailbox ? "posteo",
...
}: {
uni = {
user = "meinhark";
password = lib.strings.fileContents <secrets/eduroam/password>;
address = "kieran.felix.meinhardt@hu-berlin.de";
imap = "mailbox.cms.hu-berlin.de";
smtp = "mailhost.cms.hu-berlin.de";
smtpSettings = smtp: "smtp://${smtp}";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
uni-old = {
user = "meinhark";
password = lib.strings.fileContents <secrets/eduroam/password>;
address = "meinhark@informatik.hu-berlin.de";
imap = "mailbox.informatik.hu-berlin.de";
smtp = "mailhost.informatik.hu-berlin.de";
smtpSettings = smtp: "smtp://${smtp}";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
work-uni = {
user = "meinhaki";
password = lib.strings.fileContents <secrets/mail/meinhaki>;
address = "kieran.meinhardt@hu-berlin.de";
imap = "mailbox.cms.hu-berlin.de";
smtp = "mailhost.cms.hu-berlin.de";
smtpSettings = smtp: "smtp://${smtp}";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
work-admin = {
user = "dslalewa";
password = lib.strings.fileContents <secrets/mail/dslalewa>;
address = "admin.alew.vglsprwi@hu-berlin.de";
imap = "mailbox.cms.hu-berlin.de";
smtp = "mailhost.cms.hu-berlin.de";
smtpSettings = smtp: "smtp://${smtp}";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
uni-fsi = {
user = "fsklassp";
password = lib.strings.fileContents <secrets/mail/fsklassp>;
address = "fsklassp@hu-berlin.de";
imap = "mailbox.cms.hu-berlin.de";
smtp = "mailhost.cms.hu-berlin.de";
smtpSettings = smtp: "smtp://${smtp}";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
work-fysi = rec {
user = "kieran@fysi.tech";
address = user;
password = lib.strings.fileContents <secrets/mail/fastmail>;
imap = "imap.fastmail.com";
smtp = "smtp.fastmail.com";
smtpSettings = smtp: "smtps://${smtp}:465";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
cock = rec { cock = rec {
user = "2210@cock.li"; user = "2210@cock.li";
address = user; address = user;
password = lib.strings.fileContents <secrets/mail/cock>;
imap = "mail.cock.li"; imap = "mail.cock.li";
smtp = imap; smtp = imap;
smtpSettings = smtp: "smtp://${smtp}:587"; smtpSettings = smtp: "smtp://${smtp}:587";
@@ -11,4 +100,46 @@
trash = "Trash"; trash = "Trash";
}; };
}; };
"${mainMailbox}" = rec {
user = "kieran.meinhardt@posteo.net";
address = user;
password = lib.strings.fileContents <secrets/mail/posteo>;
imap = "posteo.de";
smtp = imap;
smtpSettings = smtp: "smtp://${smtp}";
folders = {
drafts = "Drafts";
sent = "Sent";
trash = "Trash";
};
};
google-amro = rec {
user = "amroplay@gmail.com";
address = user;
password = lib.strings.fileContents <secrets/mail/gmail/amroplay>;
imap = "imap.gmail.com";
smtp = "smtp.gmail.com";
smtpSettings = smtp: "smtps://${smtp}:465";
folders = {
drafts = "[Gmail]/Drafts";
sent = "[Gmail]/Sent Mail";
trash = "[Gmail]/Bin";
};
};
google-kieran = rec {
user = "kieran.meinhardt@gmail.com";
address = user;
password = lib.strings.fileContents <secrets/mail/gmail/kieran.meinhardt>;
imap = "imap.gmail.com";
smtp = "smtp.gmail.com";
smtpSettings = smtp: "smtps://${smtp}:465";
folders = {
drafts = "[Gmail]/Entwürfe";
sent = "[Gmail]/Gesendet";
trash = "[Gmail]/Papierkorb";
};
};
} }

View File

@@ -3,7 +3,6 @@
wirelessInterface, wirelessInterface,
colours, colours,
batteryName, batteryName,
accounts,
}: let }: let
inherit (pkgs) lib; inherit (pkgs) lib;
@@ -11,6 +10,8 @@
pkgs.writers.writeDash "setsid-command" '' pkgs.writers.writeDash "setsid-command" ''
${pkgs.util-linux}/bin/setsid ${script} ${pkgs.util-linux}/bin/setsid ${script}
''; '';
accounts = import <niveum/lib/email.nix> {inherit lib;};
in { in {
theme = { theme = {
name = "plain"; name = "plain";
@@ -21,6 +22,8 @@ in {
info_fg = colours.cyan.bright; info_fg = colours.cyan.bright;
warning_fg = colours.yellow.bright; warning_fg = colours.yellow.bright;
warning_bg = colours.background; warning_bg = colours.background;
alternating_tint_bg = colours.background;
alternating_tint_fg = colours.foreground;
critical_bg = colours.background; critical_bg = colours.background;
good_bg = colours.background; good_bg = colours.background;
idle_bg = colours.background; idle_bg = colours.background;
@@ -41,6 +44,7 @@ in {
format = "{location}: {temp}C"; format = "{location}: {temp}C";
service = { service = {
name = "openweathermap"; name = "openweathermap";
api_key = lib.strings.fileContents <secrets/openweathermap.key>;
city_id = "2950159"; city_id = "2950159";
units = "metric"; units = "metric";
}; };
@@ -49,7 +53,7 @@ in {
block = "custom"; block = "custom";
interval = 60 * 5; interval = 60 * 5;
command = let command = let
spacetime = import ../configs/spacetime.nix; spacetime = import <niveum/configs/spacetime.nix>;
in in
pkgs.writers.writePython3 "sun.py" { pkgs.writers.writePython3 "sun.py" {
libraries = [pkgs.python3Packages.astral]; libraries = [pkgs.python3Packages.astral];
@@ -110,8 +114,7 @@ in {
interval = 60 * 5; interval = 60 * 5;
command = let command = let
query-account = name: account: "${pkgs.writers.writeDash "query-imap-${name}" '' query-account = name: account: "${pkgs.writers.writeDash "query-imap-${name}" ''
password=$(${toString account.passwordCommand}) ${pkgs.coreutils}/bin/timeout 1 ${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg "${account.user}:${account.password}"} imaps://${account.imap} -X 'STATUS INBOX (UNSEEN)' \
${pkgs.coreutils}/bin/timeout 1 ${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg account.userName}:"$password" imaps://${account.imap.host} -X 'STATUS INBOX (UNSEEN)' \
| ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+' \ | ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+' \
| sed 's/^/{"${name}":/;s/$/}/' | sed 's/^/{"${name}":/;s/$/}/'
''} &"; ''} &";
@@ -127,7 +130,7 @@ in {
text: (if $sum > 0 then $sum | tostring else "" end), text: (if $sum > 0 then $sum | tostring else "" end),
icon: "mail", icon: "mail",
state: ( state: (
if .["hu-student"] > 0 or .["hu-employee"] > 0 or .posteo > 0 then if .uni > 0 or .["work-uni"] > 0 or .posteo > 0 then
"Warning" "Warning"
elif $sum > 0 then elif $sum > 0 then
"Info" "Info"

View File

@@ -1,45 +0,0 @@
{
pkgs,
lib,
niveumPackages,
config,
...
}: {
# watcher scripts
url = address:
pkgs.writers.writeDash "watch-url" ''
${pkgs.curl}/bin/curl -sSL ${lib.escapeShellArg address} \
| ${pkgs.python3Packages.html2text}/bin/html2text --decode-errors=ignore
'';
urlSelector = selector: address:
pkgs.writers.writeDash "watch-url-selector" ''
${pkgs.curl}/bin/curl -sSL ${lib.escapeShellArg address} \
| ${pkgs.htmlq}/bin/htmlq ${lib.escapeShellArg selector} \
| ${pkgs.python3Packages.html2text}/bin/html2text
'';
urlJSON = {jqScript ? "."}: address:
pkgs.writers.writeDash "watch-url-json" ''
${pkgs.curl}/bin/curl -sSL ${lib.escapeShellArg address} | ${pkgs.jq}/bin/jq -f ${pkgs.writeText "script.jq" jqScript}
'';
# reporter scripts
kpaste-irc = {
target,
retiolumLink ? false,
server ? "irc.r",
messagePrefix ? "change detected: ",
nick ? ''"$PANOPTIKON_WATCHER"-watcher'',
}:
pkgs.writers.writeDash "kpaste-irc-reporter" ''
${niveumPackages.kpaste}/bin/kpaste \
| ${pkgs.gnused}/bin/sed -n "${
if retiolumLink
then "2"
else "3"
}s/^/${messagePrefix}/p" \
| ${config.nur.repos.mic92.ircsink}/bin/ircsink \
--nick ${nick} \
--server ${server} \
--target ${target}
'';
}

View File

@@ -956,11 +956,6 @@ in
stream = soma-fm "scanner"; stream = soma-fm "scanner";
tags = [tags.soma tags.text]; tags = [tags.soma tags.text];
} }
{
station = "Al Jazeera Arabic";
stream = "https://live-hls-audio-web-aja.getaj.net/VOICE-AJA/01.m3u8";
tags = [tags.text tags.arabic];
}
{ {
desc = "Celebrating NASA and Space Explorers everywhere."; desc = "Celebrating NASA and Space Explorers everywhere.";
logo = "http://soma.fm/img/missioncontrol120.jpg"; logo = "http://soma.fm/img/missioncontrol120.jpg";
@@ -1847,127 +1842,71 @@ in
stream = dr "p8jazz"; stream = dr "p8jazz";
tags = [tags.jazz tags.danish]; tags = [tags.jazz tags.danish];
} }
{
station = "CNN morse code slow";
stream = "http://cw.dimebank.com:8080/CNNslow";
tags = [tags.text];
}
{
station = "CNN morse code fast";
stream = "http://cw.dimebank.com:8080/CNNfast";
tags = [tags.text];
}
{
station = "XXX orchestral";
stream = "http://orion.shoutca.st:8978/stream";
tags = [tags.classical];
}
{
station = "XXX greek";
stream = "http://radio.hostchefs.net:8046/stream?1520818130148";
tags = [tags.greek];
}
{
station = "XXX turkish or greek";
stream = "https://onairmediagroup.live24.gr/kralfm100xanthi";
tags = [tags.greek tags.turkish];
}
{
station = "Hard Rock Hell Radio";
tags = [tags.rock];
stream = "http://andromeda.shoutca.st:9254/stream";
}
{
station = "Divyavani";
tags = [tags.trad tags.indian];
stream = "https://divyavani.radioca.st/stream";
}
{
station = "XXX sanskrit radio";
tags = [tags.text tags.indian];
stream = "https://stream-23.zeno.fm/m08mkwsyw8quv?zs=0w7MJFPdRfavhR_zPt0M2g";
}
{
station = "Radio Mariam Arabic";
stream = "http://www.dreamsiteradiocp4.com:8014/stream";
tags = [tags.text tags.arabic];
}
{
station = "Kamchatka Live Rock";
stream = "https://radio.kamchatkalive.ru:8103/rock";
tags = [tags.rock];
}
{
station = "Kamchatka Live Chillout";
stream = "https://radio.kamchatkalive.ru:8103/chillout";
tags = [tags.chill];
}
{
station = "Kamchatka Live Dance";
stream = "https://radio.kamchatkalive.ru:8103/dance";
tags = [tags.party];
}
{
tags = [tags.arabic tags.text];
stream = "http://n02.radiojar.com/sxfbks1vfy8uv.mp3";
station = "Bahrain Radio 102.3 FM (Arabic Stories)";
}
{
tags = [tags.arabic tags.text tags.holy];
stream = "http://s2.voscast.com:12312/;";
station = "Bahrain Quran Radio";
}
{
tags = [tags.arabic tags.text tags.holy];
stream = "http://162.244.81.30:8224/;";
station = "Quran Radio Lebanon";
}
{
tags = [tags.arabic tags.text tags.holy];
station = "Coptic for God";
stream = "http://66.70.249.70:5832/stream";
}
{
stream = "http://stream-025.zeno.fm/5y95pu36sm0uv?";
station = "Hayat FM";
tags = [tags.arabic tags.text tags.holy];
}
{
stream = "http://uk2.internet-radio.com:8151/stream";
station = "The Quran Radio";
tags = [tags.arabic tags.text tags.holy];
}
] ]
++ map (name: {
stream = "https://${name}.stream.publicradio.org/${name}.aac";
station = "${name} | Your Classical";
tags = [tags.classical];
}) ["ycradio" "guitar" "cms" "relax" "lullabies" "choral" "favorites" "chambermusic" "concertband" "holiday"]
/* /*
(caster-fm "TODO" "noasrv" 10182) # https://github.com/cccruzr/albumsyoumusthear/blob/7e00baf575e4d357cd275d54d1aeb717321141a8/HLS/IBERO_90_1.m3u (caster-fm "TODO" "noasrv" 10182) # https://github.com/cccruzr/albumsyoumusthear/blob/7e00baf575e4d357cd275d54d1aeb717321141a8/HLS/IBERO_90_1.m3u
(caster-fm "TODO" "shaincast" 20866) # https://github.com/cccruzr/albumsyoumusthear/blob/7e00baf575e4d357cd275d54d1aeb717321141a8/HLS/IBERO_90_1.m3u (caster-fm "TODO" "shaincast" 20866) # https://github.com/cccruzr/albumsyoumusthear/blob/7e00baf575e4d357cd275d54d1aeb717321141a8/HLS/IBERO_90_1.m3u
CNN news in morse code
http://cw.dimebank.com:8080/CNNslow
http://cw.dimebank.com:8080/CNNfast
Orchestral
http://orion.shoutca.st:8978/stream
LoFi / Chill LoFi / Chill
http://ice55.securenetsystems.net/DASH76 http://ice55.securenetsystems.net/DASH76
News background music
https://c13014-l-hls.u.core.cdn.streamfarm.net/1000153copo/hk2.m3u8
?
http://94.23.221.158:9163/stream
Greek radio
http://radio.hostchefs.net:8046/stream?1520818130148
: http://audiokrishna.com/stations/japa2.mp3 : http://audiokrishna.com/stations/japa2.mp3
http://185.105.4.53:2339//;stream.mp3
http://cast5.servcast.net:1390/;stream.mp3
Hard rock
http://andromeda.shoutca.st:9254/stream
Rock alternative Rock alternative
http://icy.unitedradio.it/VirginRockAlternative.mp3 http://icy.unitedradio.it/VirginRockAlternative.mp3
American nautical weather news
http://ca.radioboss.fm:8149/stream
Christian radio in all languages Christian radio in all languages
https://jesuscomingfm.com/# https://jesuscomingfm.com/#
tamazight http://live.jesuscomingfm.com:8462/; tamazight http://live.jesuscomingfm.com:8462/;
supposedly good Greek radio
https://onairmediagroup.live24.gr/kralfm100xanthi
Somali Radio Somali Radio
http://n0b.radiojar.com/1pu7hhf8kfhvv http://n0b.radiojar.com/1pu7hhf8kfhvv
Sanskrit
https://stream-23.zeno.fm/m08mkwsyw8quv?zs=0w7MJFPdRfavhR_zPt0M2g
https://divyavani.radioca.st/stream
Chillout from kassel Chillout from kassel
https://server4.streamserver24.com:2199/tunein/ejanowsk.pls https://server4.streamserver24.com:2199/tunein/ejanowsk.pls
Radio Mariam Arabic (Rome)
http://www.dreamsiteradiocp4.com:8014/stream
https://radio.kamchatkalive.ru:8103/rock
https://radio.kamchatkalive.ru:8103/chillout
https://radio.kamchatkalive.ru:8103/dance
Fuā Stories (Bahrain Radio 102.3 FM)
http://n02.radiojar.com/sxfbks1vfy8uv.mp3
Bahrain Quran Radio
http://s2.voscast.com:12312/;
*/ */

View File

@@ -1,86 +0,0 @@
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
end
local lsp_flags = {
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
}
language_servers = {
pyright = {}, -- pyright
-- tsserver = {}, -- typescript-language-server
-- elmls = {}, -- elm-language-server
-- denols = {}, -- deno built in
-- bashls = {}, -- bash-language-server
hls = {}, -- haskell-language-server
-- html = {}, -- vscode-langservers-extracted
-- jsonls = {}, -- vscode-langservers-extracted
nil_ls = {}, -- github:oxalica/nil
-- rnix = {}, -- rnix-lsp
-- jqls = {}, -- jq-lsp
rust_analyzer = { ["rust-analyzer"] = {} },
-- eslint?
-- volar? vls?
texlab = {
texlab = {
auxDirectory = ".",
bibtexFormatter = "texlab",
build = {
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
executable = "latexmk",
forwardSearchAfter = false,
onSave = false
},
chktex = {
onEdit = false,
onOpenAndSave = false
},
diagnosticsDelay = 300,
formatterLineLength = 80,
forwardSearch = {
args = {}
},
latexFormatter = "latexindent",
latexindent = {
modifyLineBreaks = false
}
}
}
}
for server, settings in pairs(language_servers) do
require('lspconfig')[server].setup{
on_attach = on_attach,
flags = lsp_flags,
settings = settings,
}
end

34
modules/dropbox.nix Normal file
View File

@@ -0,0 +1,34 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.niveum.dropbox;
in {
options.niveum.dropbox = {enable = mkEnableOption "Dropbox";};
config = mkIf cfg.enable {
environment.systemPackages = [pkgs.dropbox-cli];
networking.firewall = {
allowedTCPPorts = [17500];
allowedUDPPorts = [17500];
};
systemd.user.services.dropbox = {
description = "Dropbox synchronisation service";
wantedBy = ["graphical-session.target"];
serviceConfig = {
ExecStart = "${pkgs.dropbox.out}/bin/dropbox";
ExecReload = "${pkgs.coreutils.out}/bin/kill -HUP $MAINPID";
KillMode = "control-group"; # upstream recommends process
Restart = "on-failure";
PrivateTmp = true;
ProtectSystem = "full";
Nice = 10;
};
};
};
}

86
modules/hledger.nix Normal file
View File

@@ -0,0 +1,86 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.niveum.hledger;
hledger-git = pkgs.writers.writeDashBin "hledger-git" ''
LEDGER_DIR="$(dirname $LEDGER_FILE)"
GIT="${pkgs.git}/bin/git -C ''${LEDGER_DIR}"
if [ "$1" = entry ]; then
${cfg.package}/bin/hledger balance -V > "$LEDGER_DIR/balance.txt"
$GIT add balance.txt
$GIT commit --all --message="$(date -Im)"
else
$GIT $*
fi
'';
hledger-edit = pkgs.writers.writeDashBin "hledger-edit" ''
LEDGER_DIR="$(dirname $LEDGER_FILE)"
$EDITOR ''${LEDGER_DIR}/current.journal
'';
in {
options.niveum.hledger = {
enable = mkEnableOption "hledger";
package = mkOption {
type = types.package;
default = pkgs.hledger;
};
ledgerFile = mkOption {
type = types.str;
default = null;
};
server = {
enable = mkEnableOption "hledger server";
port = mkOption {
type = types.port;
default = 5000;
};
host = mkOption {
type = types.str;
default = "127.0.0.1";
};
capabilities = mkOption {
type = types.listOf (types.enum ["view" "add" "manage"]);
default = ["view" "add"];
};
flags = mkOption {
type = types.listOf types.str;
default = [];
};
user = mkOption {type = types.attrs;};
package = mkOption {
type = types.package;
default = pkgs.hledger-web;
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [cfg.package hledger-git hledger-edit];
environment.variables.LEDGER_FILE =
mkIf (cfg.ledgerFile != null) cfg.ledgerFile;
systemd.services.hledger-web = mkIf cfg.server.enable {
description = "hledger server";
wantedBy = ["multi-user.target"];
serviceConfig = {
Restart = "always";
ExecStart = ''
${cfg.server.package}/bin/hledger-web \
--port=${toString cfg.server.port} \
--host=${cfg.server.host} \
--capabilities=${concatStringsSep "," cfg.server.capabilities} \
${concatStringsSep " " cfg.server.flags}
'';
User = cfg.server.user.name;
PrivateTemp = true;
RuntimeDirectory = "hledger-web";
WorkingDirectory = "%t/hledger-web";
};
};
};
}

View File

@@ -1,47 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
htgen = pkgs.callPackage ../packages/htgen.nix {};
in {
options.services.htgen = lib.mkOption {
default = {};
type = lib.types.attrsOf (lib.types.submodule ({config, ...}: {
options = {
enable = lib.mkEnableOption "htgen-${config._module.args.name}";
port = lib.mkOption {
type = lib.types.int;
};
script = lib.mkOption {
type = lib.types.str;
};
};
}));
};
config = {
systemd.services =
lib.mapAttrs' (
name: cfg:
lib.nameValuePair "htgen-${name}" {
wantedBy = ["multi-user.target"];
after = ["network.target"];
environment = {
HOME = "/var/lib/htgen-${name}";
HTGEN_PORT = toString cfg.port;
HTGEN_SCRIPT = cfg.script;
};
serviceConfig = {
SyslogIdentifier = "htgen-${name}";
DynamicUser = true;
StateDirectory = "htgen-${name}";
PrivateTmp = true;
Restart = "always";
ExecStart = "${htgen}/bin/htgen --serve";
};
}
)
config.services.htgen;
};
}

13
modules/minecraft.nix Normal file
View File

@@ -0,0 +1,13 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.niveum.minecraft;
in {
options.niveum.minecraft = {enable = mkEnableOption "Minecraft";};
config = mkIf cfg.enable {environment.systemPackages = [pkgs.minecraft];};
}

View File

@@ -23,13 +23,6 @@ in {
''; '';
}; };
tokensFile = mkOption {
type = types.path;
description = ''
Path to a JSON file containing a "token" key and, optionally, a "telegram"."token" key.
'';
};
notifyOnly = mkOption { notifyOnly = mkOption {
default = false; default = false;
type = types.bool; type = types.bool;
@@ -81,7 +74,7 @@ in {
Group = config.users.groups.moodle-dl.name; Group = config.users.groups.moodle-dl.name;
WorkingDirectory = cfg.directory; WorkingDirectory = cfg.directory;
ExecStart = "${cfg.package}/bin/moodle-dl ${lib.optionalString cfg.notifyOnly "--without-downloading-files"}"; ExecStart = "${cfg.package}/bin/moodle-dl ${lib.optionalString cfg.notifyOnly "--without-downloading-files"}";
ExecStartPre = pkgs.writers.writeDash "moodle-dl-config" "${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${toString moodle-dl-json} ${toString cfg.tokensFile} > ${cfg.directory}/config.json"; ExecStartPre = "${pkgs.coreutils}/bin/ln -sfn ${toString moodle-dl-json} ${cfg.directory}/config.json";
} }
(mkIf (cfg.directory == stateDirectoryDefault) {StateDirectory = "moodle-dl";}) (mkIf (cfg.directory == stateDirectoryDefault) {StateDirectory = "moodle-dl";})
]; ];

View File

@@ -1,130 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
options.services.panoptikon = {
enable = lib.mkEnableOption "Generic command output / website watcher";
watchers = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule (watcher: {
options = {
script = lib.mkOption {
type = lib.types.path;
description = ''
A script whose stdout is to be watched.
'';
example = ''
pkgs.writers.writeDash "github-meta" '''
''${pkgs.curl}/bin/curl -sSL https://api.github.com/meta | ''${pkgs.jq}/bin/jq
'''
'';
};
frequency = lib.mkOption {
type = lib.types.str;
description = ''
How often to run the script. See systemd.time(7) for more information about the format.
'';
example = "*:0/3";
default = "daily";
};
reporters = lib.mkOption {
type = lib.types.listOf lib.types.path;
description = ''
A list of scripts that take the diff (if any) via stdin and report it (e.g. to IRC, Telegram or Prometheus). The name of the watcher will be in the $PANOPTIKON_WATCHER environment variable.
'';
example = ''
[
(pkgs.writers.writeDash "telegram-reporter" '''
''${pkgs.curl}/bin/curl -X POST https://api.telegram.org/bot''${TOKEN}/sendMessage \
-d chat_id=123456 \
-d text="$(cat)"
''')
(pkgs.writers.writeDash "notify" '''
''${pkgs.libnotify}/bin/notify-send "$PANOPTIKON_WATCHER has changed."
''')
]
'';
};
};
config = {};
}));
};
};
config = let
cfg = config.services.panoptikon;
in
lib.mkIf cfg.enable {
users.extraUsers.panoptikon = {
isSystemUser = true;
createHome = true;
home = "/var/lib/panoptikon";
group = "panoptikon";
};
users.extraGroups.panoptikon = {};
systemd.timers = lib.attrsets.mapAttrs' (watcherName: _:
lib.nameValuePair "panoptikon-${watcherName}" {
timerConfig.RandomizedDelaySec = toString (60 * 60);
})
cfg.watchers;
systemd.services =
{
setup-panoptikon = {
enable = true;
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "oneshot";
User = "panoptikon";
Group = "panoptikon";
WorkingDirectory = "/var/lib/panoptikon";
Restart = "on-failure";
};
script = ''
${pkgs.git}/bin/git init --quiet
${pkgs.git}/bin/git config user.email "panoptikon@${config.networking.hostName}"
${pkgs.git}/bin/git config user.name Panoptikon
'';
};
}
// lib.attrsets.mapAttrs' (watcherName: watcherOptions:
lib.nameValuePair "panoptikon-${watcherName}" {
enable = true;
after = ["setup-panoptikon.service"];
startAt = watcherOptions.frequency;
serviceConfig = {
Type = "oneshot";
User = "panoptikon";
Group = "panoptikon";
WorkingDirectory = "/var/lib/panoptikon";
RestartSec = "60";
Restart = "on-failure";
};
unitConfig = {
StartLimitIntervalSec = "300";
StartLimitBurst = "5";
};
environment.PANOPTIKON_WATCHER = watcherName;
wants = ["network-online.target"];
script = ''
set -efu
${watcherOptions.script} > ${watcherName}
${pkgs.git}/bin/git add ${watcherName}
${pkgs.git}/bin/git commit --message "${watcherName} / $(${pkgs.coreutils}/bin/date -Is)" || :
if [ -n "$(${pkgs.git}/bin/git diff HEAD^ -- ${watcherName})" ]; then
${lib.strings.concatMapStringsSep "\n" (reporter: ''
${pkgs.git}/bin/git diff HEAD^ -- ${watcherName} | ${reporter}
'')
watcherOptions.reporters}
:
fi
'';
})
cfg.watchers;
};
}

View File

@@ -1,94 +0,0 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.power-action;
out = {
options.services.power-action = api;
config = lib.mkIf cfg.enable imp;
};
api = {
enable = mkEnableOption "power-action";
battery = mkOption {
type = types.str;
default = "BAT0";
};
user = mkOption {
type = types.str;
default = "power-action";
};
startAt = mkOption {
type = types.str;
default = "*:0/1";
};
plans = mkOption {
type = with types;
attrsOf (submodule {
options = {
charging = mkOption {
type = nullOr bool;
default = null;
description = ''
check for charging status.
null = don't care
true = only if system is charging or unknown
false = only if system is discharging
'';
};
upperLimit = mkOption {
type = int;
};
lowerLimit = mkOption {
type = int;
};
action = mkOption {
type = path;
};
};
});
};
};
imp = {
systemd.services.power-action = {
serviceConfig = rec {
ExecStart = startScript;
User = cfg.user;
};
startAt = cfg.startAt;
};
};
startScript = pkgs.writers.writeDash "power-action" ''
set -euf
power="$(${powerlvl})"
state="$(${state})"
${concatStringsSep "\n" (mapAttrsToList writeRule cfg.plans)}
'';
charging_check = plan:
if (plan.charging == null)
then ""
else if plan.charging
then ''&& [ "$state" = "true" ]''
else ''&& ! [ "$state" = "true" ]'';
writeRule = _: plan: "if [ $power -ge ${toString plan.lowerLimit} ] && [ $power -le ${toString plan.upperLimit} ] ${charging_check plan}; then ${plan.action}; fi";
powerlvl = pkgs.writers.writeDash "powerlvl" ''
cat /sys/class/power_supply/${cfg.battery}/capacity
'';
state = pkgs.writers.writeDash "state" ''
if [ "$(cat /sys/class/power_supply/${cfg.battery}/status)" = "Discharging" ]
then echo "false"
else echo "true"
fi
'';
in
out

View File

@@ -1,96 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
specusMachines = {
servers = {
makanek = {
ipv4 = "10.100.0.1";
publicKey = "KhcScd4fBpdhQzK8Vc+1mEHQMQBpbKBUPB4oZ7skeSk=";
};
ful = {
ipv4 = "10.100.0.2";
publicKey = "0Y7+zoXkWJGVOWWnMjvYjtwP+WpggAlmkRbgMw0z8Dk=";
};
};
clients = {
kabsa = {
ipv4 = "10.100.0.101";
publicKey = "nRkzoRi9crKHF7263U37lt4GGL7/8637NBSKjifI9hY=";
};
};
};
in {
options.services.specus = {
server = {
enable = lib.mkEnableOption "Specus private VPN (server)";
};
client = {
enable = lib.mkEnableOption "Specus private VPN (client)";
};
privateKeyFile = lib.mkOption {
type = lib.types.path;
description = "Private key file of the server/client machine";
};
};
config = let
cfg = config.services.specus;
specusPort = 22;
in
{
assertions = [
{
assertion =
!(cfg.server.enable && cfg.client.enable);
message = "specus: systems cannot be client and server at the same time";
}
];
}
// lib.mkIf cfg.server.enable {
networking.nat = {
enable = true;
externalInterface = "eth0"; # TODO
internalInterfaces = ["specus"];
};
networking.firewall.allowedUDPPorts = [specusPort];
networking.wireguard.interfaces.specus = {
ips = ["${specusMachines.servers.${config.networking.hostName}.ipv4}/24"];
# For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
listenPort = specusPort;
privateKeyFile = cfg.privateKeyFile;
peers =
lib.mapAttrsToList (clientName: clientConfig: {
publicKey = clientConfig.publicKey;
allowedIPs = ["${clientConfig.ipv4}/32"];
})
specusMachines.clients;
};
}
// lib.mkIf cfg.client.enable {
networking.firewall.allowedUDPPorts = [specusPort];
networking.wireguard.interfaces = lib.attrsets.mapAttrs' (serverName: serverConfig:
lib.nameValuePair "specus-${serverName}" {
ips = ["${specusMachines.clients.${config.networking.hostName}.ipv4}/24"];
listenPort = specusPort;
privateKeyFile = cfg.privateKeyFile;
peers = [
{
allowedIPs = ["0.0.0.0/0"];
endpoint = "${(import ../lib/external-network.nix).${serverName}}:${toString specusPort}";
persistentKeepalive = 25;
publicKey = serverConfig.publicKey;
}
];
})
specusMachines.servers;
};
}

64
modules/spotifyd.nix Normal file
View File

@@ -0,0 +1,64 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.spotifyd;
toml = pkgs.formats.toml {};
spotifydConf =
if cfg.settings != {}
then toml.generate "spotify.conf" cfg.settings
else pkgs.writeText "spotifyd.conf" cfg.config;
in {
options = {
services.spotifyd = {
enable = mkEnableOption "spotifyd, a Spotify playing daemon";
config = mkOption {
default = "";
type = types.lines;
description = ''
(Deprecated) Configuration for Spotifyd. For syntax and directives, see
<link xlink:href="https://github.com/Spotifyd/spotifyd#Configuration"/>.
'';
};
settings = mkOption {
default = {};
type = toml.type;
description = ''
Configuration for Spotifyd. For syntax and directives, see
<link xlink:href="https://github.com/Spotifyd/spotifyd#Configuration"/>.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = (cfg.config == "" && cfg.settings != {}) || (cfg.config != "" && cfg.settings == {});
message = "Using the stringly typed .config attribute is discouraged. Use the TOML typed .settings attribute instead.";
}
];
systemd.services.spotifyd = {
wantedBy = ["multi-user.target"];
after = ["network-online.target" "sound.target"];
description = "spotifyd, a Spotify playing daemon";
environment.SHELL = "/bin/sh";
serviceConfig = {
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache-path /var/cache/spotifyd --config-path ${spotifydConf}";
Restart = "always";
RestartSec = 12;
DynamicUser = true;
CacheDirectory = "spotifyd";
SupplementaryGroups = ["audio"];
};
};
};
meta.maintainers = [maintainers.anderslundstedt];
}

View File

@@ -11,27 +11,19 @@ with lib; let
nameValuePair "telegram-bot-${name}" { nameValuePair "telegram-bot-${name}" {
enable = bot.enable; enable = bot.enable;
startAt = bot.time; startAt = bot.time;
serviceConfig = { serviceConfig.Type = "oneshot";
Type = "oneshot";
LoadCredential = "token:${bot.tokenFile}";
};
wants = ["network-online.target"]; wants = ["network-online.target"];
script = '' script = strings.concatStringsSep "\n" (["QUOTE=$(${bot.command})" "if [ -n \"$QUOTE\" ]; then" "echo $QUOTE >&2"]
export TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ++ map (chatId: ''
QUOTE=$(${bot.command}) ${pkgs.curl}/bin/curl -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
if [ -n "$QUOTE" ]; then -d chat_id="${chatId}" \
echo $QUOTE >&2 -d text="$QUOTE" ${
${strings.concatStringsSep "\n" (map (chatId: '' lib.strings.optionalString (bot.parseMode != null)
${pkgs.curl}/bin/curl -X POST "https://api.telegram.org/bot''${TOKEN}/sendMessage" \ "-d parse_mode=${bot.parseMode}"
-d chat_id="${chatId}" \ } | ${pkgs.jq}/bin/jq -e .ok
-d text="$QUOTE" ${ '')
lib.strings.optionalString (bot.parseMode != null) bot.chatIds
"-d parse_mode=${bot.parseMode}" ++ ["fi"]);
} | ${pkgs.jq}/bin/jq -e .ok
'')
bot.chatIds)}
fi
'';
}; };
in { in {
options.niveum.telegramBots = mkOption { options.niveum.telegramBots = mkOption {
@@ -39,7 +31,7 @@ in {
options = { options = {
enable = mkEnableOption "Telegram bot"; enable = mkEnableOption "Telegram bot";
time = mkOption {type = types.str;}; time = mkOption {type = types.str;};
tokenFile = mkOption {type = types.path;}; token = mkOption {type = types.strMatching "[0-9A-Za-z:-]+";};
chatIds = mkOption { chatIds = mkOption {
type = types.listOf (types.strMatching "-?[0-9]+|@[A-Za-z0-9]+"); type = types.listOf (types.strMatching "-?[0-9]+|@[A-Za-z0-9]+");
}; };

View File

@@ -2,17 +2,19 @@
pkgs, pkgs,
lib, lib,
config, config,
inputs,
... ...
}: }:
with lib; let with lib; let
cfg = config.niveum.traadfri; cfg = config.niveum.traadfri;
traadfri = pkgs.callPackage <traadfri> {
libcoap = pkgs.callPackage <niveum/packages/libcoap.nix> {tls = true;};
};
in { in {
options.niveum.traadfri = { options.niveum.traadfri = {
enable = mkEnableOption "Trådfri CLI"; enable = mkEnableOption "Trådfri CLI";
user = mkOption {type = types.str;}; user = mkOption {type = types.str;};
host = mkOption {type = types.str;}; host = mkOption {type = types.str;};
keyFile = mkOption {type = types.path;}; key = mkOption {type = types.str;};
rooms = mkOption { rooms = mkOption {
type = types.attrsOf types.int; type = types.attrsOf types.int;
default = {}; default = {};
@@ -27,10 +29,10 @@ in {
environment.systemPackages = environment.systemPackages =
[ [
(pkgs.writers.writeDashBin "traadfri" '' (pkgs.writers.writeDashBin "traadfri" ''
export TRAADFRI_USER="${cfg.user}" TRAADFRI_USER="${cfg.user}" \
export TRAADFRI_KEY="$(cat ${lib.escapeShellArg cfg.keyFile})" TRAADFRI_KEY="${cfg.key}" \
export TRAADFRI_HUB="${cfg.host}" TRAADFRI_HUB="${cfg.host}" \
${inputs.traadfri.defaultPackage.x86_64-linux}/bin/traadfri $@ ${traadfri}/bin/traadfri $@
'') '')
] ]
++ lib.mapAttrsToList (name: value: ++ lib.mapAttrsToList (name: value:

103
modules/tuna.nix Normal file
View File

@@ -0,0 +1,103 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
tuna = pkgs.callPackage <tuna> {};
cfg = config.services.tuna;
in {
imports = [];
options.services.tuna = {
enable = mkEnableOption "Tuna, an MPD web UI for radio streams";
webPort = mkOption {
type = types.port;
default = 4200;
};
stations = mkOption {
default = [];
type = types.listOf (types.submodule {
options = {
id = mkOption {
type = types.int;
description = "A unique identifier of the station";
};
station = mkOption {
type = types.str;
description = "Name of the station that should be displayed";
};
desc = mkOption {
type = types.nullOr types.str;
description = "Short description of the station (optional)";
};
logo = mkOption {
type = types.str;
description = "URL to a logo of the station (any size)";
};
stream = mkOption {
type = types.str;
description = "URL to the stream of the radio station (in a format supported by MPD such as MP3, OGG, ...)";
};
};
});
};
stationsFile = mkOption {
type = types.path;
default = (pkgs.formats.json {}).generate "stations.json" cfg.stations;
};
package = mkOption {
type = types.package;
default = tuna;
};
mpd = {
host = mkOption {
type = types.str;
default = "localhost";
description = "The host where MPD is listening.";
example = "localhost";
};
port = mkOption {
type = types.port;
default = config.services.mpd.network.port;
description = "The port where MPD is listening.";
example = 6600;
};
};
};
config = mkIf cfg.enable {
users.users.tuna = {
isSystemUser = true;
group = "tuna";
};
users.groups.tuna = {};
# ref https://github.com/florianheinemann/MPD.FM/blob/9d037cf87597b26ae2f10ba9feea48946ad6cc68/service/MPD.FM.service
systemd.services.tuna = {
wantedBy = ["multi-user.target"];
after = ["mpd.service"];
script = "${cfg.package}/bin/tuna";
environment = {
NODE_ENV = "production";
MPD_HOST = cfg.mpd.host;
MPD_PORT = toString cfg.mpd.port;
PORT = toString cfg.webPort;
STATION_FILE = cfg.stationsFile;
};
serviceConfig = {
Restart = "always";
StandardOutput = "syslog";
StandardError = "syslog";
SyslogIdentifier = "tuna";
User = "tuna";
};
};
};
}

6
overlays/overlays.nix Normal file
View File

@@ -0,0 +1,6 @@
self: super:
with super.lib; let
eval = import <nixpkgs/nixos/lib/eval-config.nix>;
paths = (eval {modules = [(import <nixos-config>)];}).config.nixpkgs.overlays;
in
foldl' (flip extends) (_: super) paths self

View File

@@ -1,16 +0,0 @@
{
writers,
haskell,
haskellPackages,
}:
writers.writeHaskellBin "betacode" {
libraries = [
(haskell.lib.unmarkBroken (haskell.lib.doJailbreak haskellPackages.betacode))
haskellPackages.text
];
} ''
import qualified Data.Text.IO as T
import qualified Data.Text as T
import Text.BetaCode
main = T.interact (either (error . T.unpack) id . fromBeta)
''

View File

@@ -1,9 +0,0 @@
# https://nitter.net/igor_chubin/status/1557793569104183298
{
writers,
curl,
}:
writers.writeDashBin "so" ''
IFS=+
${curl}/bin/curl -sSL http://cht.sh/"$*"
''

View File

@@ -1,18 +0,0 @@
{
writers,
fetchurl,
haskellPackages,
}:
writers.writeDashBin "closest" ''
${
writers.writeHaskellBin "closest" {
libraries = with haskellPackages; [parallel optparse-applicative edit-distance];
ghcArgs = ["-O3" "-threaded"];
} (builtins.readFile ./distance.hs)
}/bin/closest +RTS -N4 -RTS --dictionary ${
fetchurl {
url = "https://gist.github.com/MarvinJWendt/2f4f4154b8ae218600eb091a5706b5f4/raw/36b70dd6be330aa61cd4d4cdfda6234dcb0b8784/wordlist-german.txt";
sha256 = "0vr4lmlckgvj4s8sk502sknq9pf3297rvasj5sqqm05zzbdgpppj";
}
} "$@"
''

View File

@@ -1,23 +0,0 @@
{pkgs}:
pkgs.symlinkJoin {
name = "cyberlocker-tools";
paths = [
(pkgs.writers.writeDashBin "cput" ''
set -efu
path=''${1:-$(hostname)}
path=$(echo "/$path" | sed -E 's:/+:/:')
url=http://c.r$path
${pkgs.curl}/bin/curl -fSs --data-binary @- "$url"
echo "$url"
'')
(pkgs.writers.writeDashBin "cdel" ''
set -efu
path=$1
path=$(echo "/$path" | sed -E 's:/+:/:')
url=http://c.r$path
${pkgs.curl}/bin/curl -f -X DELETE "$url"
'')
];
}

33
packages/daybook.nix Normal file
View File

@@ -0,0 +1,33 @@
{
lib,
stdenv,
makeWrapper,
pandoc,
fetchFromGitHub,
}:
stdenv.mkDerivation {
name = "daybook";
src = fetchFromGitHub {
owner = "kmein";
repo = "daybook";
rev = "db2c34830e09183c80f3381bf5e4c44d52f05d53";
sha256 = "0nbsv8f12qh5spq7zhimhdf3p7msk33xrb0ilqvlc6jmlkpislmv";
};
nativeBuildInputs = [makeWrapper];
buildInputs = [pandoc];
buildPhase = ''
mkdir -p $out/man/man1
pandoc --standalone --to man daybook.1.md -o $out/man/man1/daybook.1
'';
installPhase = ''
mkdir -p $out/bin
install daybook $out/bin
wrapProgram $out/bin/daybook --prefix PATH ":" ${pandoc}/bin ;
'';
meta = with lib; {
homepage = https://github.com/kmein/daybook;
description = "A diary writing utility in sh";
license = licenses.mit;
platforms = platforms.linux;
};
}

View File

@@ -1,8 +0,0 @@
{
writers,
iproute2,
jq,
}:
writers.writeDashBin "default-gateway" ''
${iproute2}/bin/ip -json route | ${jq}/bin/jq --raw-output '.[0].gateway'
''

View File

@@ -1,43 +0,0 @@
{
fetchgit,
lib,
stdenv,
coreutils,
curl,
gnugrep,
gnused,
util-linux,
}:
stdenv.mkDerivation {
name = "dic";
src = fetchgit {
url = https://cgit.ni.krebsco.de/dic;
rev = "refs/tags/v1.1.1";
sha256 = "1gbj967a5hj53fdkkxijqgwnl9hb8kskz0cmpjq7v65ffz3v6vag";
};
phases = [
"unpackPhase"
"installPhase"
];
installPhase = let
path = lib.makeBinPath [
coreutils
curl
gnused
gnugrep
util-linux
];
in ''
mkdir -p $out/bin
sed \
's,^main() {$,&\n PATH=${path}; export PATH,' \
< ./dic \
> $out/bin/dic
chmod +x $out/bin/dic
'';
}

View File

@@ -1,24 +0,0 @@
{writers}:
writers.writeDashBin "dirmir" ''
SOURCE="$1"
TARGET="$2"
if [ ! -d "$SOURCE" ] || [ $# -ne 2 ]; then
echo >/dev/stderr "Usage: dirmir SOURCE TARGET"
exit 1
fi
if [ -e "$TARGET" ]; then
echo >/dev/stderr "$TARGET" already exists. Please use a different name.
exit 1
fi
find "$SOURCE" | while read -r entry; do
if [ -d "$entry" ]; then
mkdir -p "$TARGET/$entry"
else
# create a file with the same permissions as $entry
install -m "$(stat -c %a "$entry")" /dev/null "$TARGET/$entry"
fi
done
''

View File

@@ -1,64 +0,0 @@
{
writers,
libnotify,
dmenu,
bluez5,
lib,
}:
writers.writeDashBin "dmenu-bluetooth" ''
# UI for connecting to bluetooth devices
set -efu
PATH=$PATH=${lib.makeBinPath [libnotify dmenu bluez5]}
bluetooth_notify() {
notify-send --app-name=" Bluetooth" "$@"
}
chose_device() {
# the output from `bluetoothctl {paired-,}devices` has a first column which always contains `Device` followed by a MAC address and the device name
cut -d ' ' -f2- | dmenu -i -l 5 -p "Bluetooth device"
}
bluetoothctl scan on &
case "$(printf "pair\nconnect\ndisconnect" | dmenu -i)" in
pair)
chosen="$(bluetoothctl devices | chose_device)"
chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)"
bluetooth_notify "$chosen_name" "Pairing ..."
if bluetoothctl pair "$(echo "$chosen" | cut -d ' ' -f1)"; then
bluetooth_notify " $chosen_name" "Paired with device."
else
test "$chosen" && bluetooth_notify " $chosen_name" "Failed to pair with device."
fi
;;
connect)
chosen="$(bluetoothctl paired-devices | chose_device)"
chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)"
bluetooth_notify "$chosen_name" "Trying to connect ..."
if bluetoothctl connect "$(echo "$chosen" | cut -d ' ' -f1)"; then
bluetooth_notify " $chosen_name" "Connected to device."
else # something was selected but it didn't work
test "$chosen" && bluetooth_notify " $chosen_name" "Failed to connect to device."
fi
;;
disconnect)
chosen="$(bluetoothctl paired-devices | chose_device)"
chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)"
bluetooth_notify "$chosen_name" "Disconnecting ..."
if bluetoothctl disconnect "$(echo "$chosen" | cut -d ' ' -f1)"; then
bluetooth_notify " $chosen_name" "Disconnected from device."
else # something was selected but it didn't work
test "$chosen" && bluetooth_notify " $chosen_name" "Failed to disconnect from device."
fi
;;
esac
''

View File

@@ -1,42 +0,0 @@
{
writers,
lib,
dmenu,
scrot,
libnotify,
xclip,
screenshotsDirectory ? "/tmp",
}:
writers.writeDashBin "dmenu-scrot" ''
# ref https://gitlab.com/dwt1/dotfiles/-/blob/master/.dmenu/dmenu-scrot.sh
PATH=$PATH:${lib.makeBinPath [dmenu scrot libnotify xclip]}
APP_NAME="📸 Scrot"
IMG_PATH="${screenshotsDirectory}"
TIME=3000 #Miliseconds notification should remain visible
cmd=$(printf "fullscreen\nsection\nupload_fullscreen\nupload_section\n" | dmenu -p 'Screenshot')
cd "$IMG_PATH" || exit
case ''${cmd%% *} in
fullscreen)
scrot -d 1 \
&& notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (full screen) saved.'
;;
section)
scrot -s \
&& notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (section) saved.'
;;
upload_fullscreen)
scrot -d 1 -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \
&& notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (full screen) uploaded: $(xclip -selection clipboard -out)"
;;
upload_section)
scrot -s -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \
&& notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (section) uploaded: $(xclip -selection clipboard -out)"
;;
esac
''

View File

@@ -1,7 +0,0 @@
{
writers,
coreutils,
}:
writers.writeDashBin "dns-sledgehammer" ''
${coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf
''

View File

@@ -1,22 +0,0 @@
{
writers,
lib,
procps,
gawk,
gnused,
fzf,
}:
writers.writeBashBin "fkill" ''
PATH=$PATH:${lib.makeBinPath [procps gawk gnused fzf]}
if [ "$UID" != "0" ]; then
pid=$(ps -f -u "$UID" | sed 1d | fzf -m | awk '{print $2}')
else
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
fi
if [ "x$pid" != "x" ]
then
echo "$pid" | xargs kill "-''${1:-9}"
fi
''

View File

@@ -1,53 +0,0 @@
{
st,
fzf,
writers,
dash,
lib,
}:
writers.writeBashBin "fzfmenu" ''
# fzfmenu - fzf as dmenu replacement
# https://github.com/junegunn/fzf/wiki/Examples#fzf-as-dmenu-replacement
set -efu
PATH=$PATH:${lib.makeBinPath [st fzf dash]}
input=$(mktemp -u --suffix .fzfmenu.input)
output=$(mktemp -u --suffix .fzfmenu.output)
mkfifo "$input"
mkfifo "$output"
chmod 600 "$input" "$output"
for i in "$@"; do
case $i in
-p)
PROMPT="$2"
shift
shift
break ;;
-l)
# no reason to filter number of lines
shift
shift
break ;;
-i)
# we do this anyway
shift
break ;;
*)
echo "Unknown option $1" >&2
shift ;;
esac
done
# it's better to use st here (starts a lot faster than pretty much everything else)
st -c fzfmenu -n fzfmenu -g 85x10 \
-e dash \
-c "cat $input | fzf --reverse --prompt="''${PROMPT+> }" --print-query $* | tee $output" & disown
# handle ctrl+c outside child terminal window
trap 'kill $! 2>/dev/null; rm -f $input $output' EXIT
cat > "$input"
cat "$output"
''

View File

@@ -1,28 +0,0 @@
{
writers,
curl,
coreutils,
gnused,
pandoc,
}:
writers.writeDashBin "genius" ''
${coreutils}/bin/test "$#" -eq 2 || (
echo "usage: $0 <artist> <song>"
exit 1
)
normalize() {
${coreutils}/bin/tr -d -c '0-9A-Za-z ' | ${coreutils}/bin/tr ' ' - | ${coreutils}/bin/tr '[:upper:]' '[:lower:]'
}
ARTIST=$(echo "$1" | normalize | ${gnused}/bin/sed 's/./\U&/')
TITLE=$(echo "$2" | normalize)
GENIUS_URL="https://genius.com/$ARTIST-$TITLE-lyrics"
${curl}/bin/curl -s "$GENIUS_URL" \
| ${gnused}/bin/sed -ne '/class="lyrics"/,/<\/p>/p' \
| ${pandoc}/bin/pandoc -f html -s -t plain \
| ${gnused}/bin/sed 's/^_/\x1b[3m/g;s/_$/\x1b[0m/g;s/^\[/\n\x1b\[1m\[/g;s/\]$/\]\x1b[0m/g'
printf "\n%s\n" "$GENIUS_URL" >/dev/stderr
''

View File

@@ -1,23 +0,0 @@
{
coreutils,
git,
writers,
}:
writers.writeDashBin "git-preview" ''
set -efu
head_commit=$(${git}/bin/git log -1 --format=%H)
merge_commit=$1; shift
merge_message='Merge for git-preview'
preview_dir=$(${coreutils}/bin/mktemp --tmpdir -d git-preview.XXXXXXXX)
preview_name=$(${coreutils}/bin/basename "$preview_dir")
${git}/bin/git worktree add --detach -f "$preview_dir" 2>/dev/null
${git}/bin/git -C "$preview_dir" checkout -q "$head_commit"
${git}/bin/git -C "$preview_dir" merge \
''${GIT_PREVIEW_MERGE_STRATEGY+-s "$GIT_PREVIEW_MERGE_STRATEGY"} \
-m "$merge_message" \
-q \
"$merge_commit"
${git}/bin/git -C "$preview_dir" diff "$head_commit.." "$@"
${coreutils}/bin/rm -fR "$preview_dir"
${coreutils}/bin/rm -R .git/worktrees/"$preview_name"
''

14
packages/gourmet.nix Normal file
View File

@@ -0,0 +1,14 @@
# { stdenv, python }:
{pkgs ? import <nixpkgs> {}}:
with pkgs;
with pkgs.python2Packages;
buildPythonApplication rec {
pname = "gourmet";
version = "0.17.4";
src = builtins.fetchTarball {
url = "https://github.com/thinkle/gourmet/archive/${version}.tar.gz";
};
buildInputs = [distutils_extra intltool];
propagatedBuildInputs = [sqlalchemy reportlab lxml];
meta = with stenv.lib; {maintainers = with maintainers; [kmein];};
}

View File

@@ -1,49 +0,0 @@
{
fetchgit,
lib,
makeWrapper,
stdenv,
coreutils,
findutils,
gawk,
gnugrep,
qrencode,
texlive,
utillinux,
zbar,
}:
stdenv.mkDerivation rec {
name = "hc-${meta.version}";
src = fetchgit {
url = "https://cgit.krebsco.de/hc";
rev = "refs/tags/v${meta.version}";
sha256 = "09349gja22p0j3xs082kp0fnaaada14bafszn4r3q7rg1id2slfb";
};
nativeBuildInputs = [makeWrapper];
buildPhase = null;
installPhase = ''
mkdir -p $out/bin
cp $src/bin/hc $out/bin/hc
wrapProgram $out/bin/hc \
--prefix PATH : ${lib.makeBinPath [
coreutils
findutils
gawk
gnugrep
qrencode
texlive.combined.scheme-full
utillinux
zbar
]}
'';
meta = {
version = "1.0.0";
};
}

View File

@@ -1,13 +0,0 @@
{
writers,
fetchurl,
xsv,
}: let
database = fetchurl {
url = "http://c.krebsco.de/greek.csv";
hash = "sha256-SYL10kerNI0HzExG6JXh765+CBBCHLO95B6OKErQ/sU=";
};
in
writers.writeDashBin "heuretes" ''
${xsv}/bin/xsv search -s simple "^$*$" ${database} | ${xsv}/bin/xsv table
''

View File

@@ -1,31 +0,0 @@
{
fetchgit,
lib,
pkgs,
stdenv,
}:
stdenv.mkDerivation rec {
pname = "htgen";
version = "1.3.1";
src = fetchgit {
url = "http://cgit.krebsco.de/htgen";
rev = "refs/tags/${version}";
sha256 = "0ml8kp89bwkrwy6iqclzyhxgv2qn9dcpwaafbmsr4mgcl70zx22r";
};
installPhase = ''
mkdir -p $out/bin
{
echo '#! ${pkgs.dash}/bin/dash'
echo 'export PATH=${lib.makeBinPath [
pkgs.coreutils
pkgs.jq
pkgs.ucspi-tcp
]}''${PATH+":$PATH"}'
sed 's:^Server=htgen$:&/${version}:' htgen
} > $out/bin/htgen
chmod +x $out/bin/htgen
cp -r examples $out
'';
}

View File

@@ -1,7 +0,0 @@
{
writers,
imagemagick,
}:
writers.writeDashBin "image-convert-favicon" ''
${imagemagick}/bin/convert "$1" -define icon:auto-resize=64,48,32,16 "''${2-favicon.ico}"
''

View File

@@ -1,14 +0,0 @@
{
writers,
imagemagick,
}:
writers.writeDashBin "image-convert-tolino" ''
source_image="$1"
if [ -e "$source_image" ]; then
${imagemagick}/bin/convert -type Grayscale -resize 758x1024 "$source_image" "suspend.jpg"
else
echo >/dev/stderr "$1 must exist."
exit 1
fi
''

View File

@@ -1,13 +0,0 @@
{
writers,
pup,
curl,
pandoc,
man,
}:
writers.writeDashBin "InfSchMV" ''
${curl}/bin/curl -sSL https://www.berlin.de/corona/massnahmen/verordnung/ \
| ${pup}/bin/pup .textile \
| ${pandoc}/bin/pandoc -f html -t man -s \
| ${man}/bin/man -l -
''

View File

@@ -1,23 +0,0 @@
{ stdenv, fetchFromGitHub, cmake, lib }:
stdenv.mkDerivation rec {
pname = "itl";
version = "0.8.0";
src = fetchFromGitHub {
owner = "arabeyes-org";
repo = "ITL";
rev = "v${version}";
sha256 = "sha256-GTicTbZmFbPhzInFob3cfvtTxOpUZuqsQz1w9CoWu9w=";
};
nativeBuildInputs = [cmake];
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_LIBDIR=lib"
];
meta = {
homepage = "https://www.arabeyes.org/ITL";
description = "Islamic Tools and Libraries";
license = lib.licenses.lgpl2;
platforms = lib.platforms.all;
maintainer = [lib.maintainers.kmein];
};
}

View File

@@ -1,21 +0,0 @@
{ stdenv, fetchFromGitHub, itl, lib, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "itools";
version = "1.0";
src = fetchFromGitHub {
owner = "arabeyes-org";
repo = "itools";
rev = version;
sha256 = "sha256-g9bsjupC4Sb5ywAgUNbjYLbHZ/i994lbNSnX2JyaP3g=";
};
preAutoreconf = "autoupdate";
nativeBuildInputs = [autoreconfHook];
buildInputs = [itl];
meta = {
homepage = "https://www.arabeyes.org/ITL";
description = "The itools package is a set of user friendly applications utilizing Arabeyes' ITL library. ";
license = lib.licenses.gpl2;
platforms = lib.platforms.all;
maintainer = [lib.maintainers.kmein];
};
}

View File

@@ -1,17 +0,0 @@
{
writers,
curl,
jq,
}:
writers.writeDashBin "kirciuoklis" ''
${curl}/bin/curl -sSL 'https://kalbu.vdu.lt/wp-admin/admin-ajax.php' -F action=text_accents -F body="$(cat)" \
| ${jq}/bin/jq -r .message \
| if [ "$1" = "--json" ]
then ${jq}/bin/jq .textParts
else ${jq}/bin/jq -r '
.textParts
| map(if has("accented") then .accented else .string end)
| join("")
'
fi
''

View File

@@ -1,9 +0,0 @@
{
curl,
gnused,
writers,
}:
writers.writeDashBin "kpaste" ''
${curl}/bin/curl -sS http://p.r --data-binary @"''${1:--}" |
${gnused}/bin/sed '$ {p;s|http://p.r|https://p.krebsco.de|}'
''

45
packages/libcoap.nix Normal file
View File

@@ -0,0 +1,45 @@
{
lib,
pkg-config,
fetchFromGitHub,
automake,
autoconf,
which,
libtool,
stdenv,
gnutls,
doxygen,
asciidoc,
tls ? false,
docs ? true,
}:
stdenv.mkDerivation {
name = "libcoap";
version = "unstable-2021-05-28";
src = fetchFromGitHub {
repo = "libcoap";
owner = "obgm";
rev = "62b2be4da1d0fdf4b7217487ee83dc5920174425";
sha256 = "1igjv0hbwmakdccp5in4gw9w2p5swxdwsdx0glyna2s29sh1d37x";
fetchSubmodules = true;
};
buildInputs =
[which pkg-config automake autoconf libtool]
++ lib.optionals docs [doxygen asciidoc]
++ lib.optional tls gnutls;
# preConfigure = "./autogen.sh";
# configureFlags = lib.optional (!docs) "--disable-documentation" ++ lib.optional tls "--enable-dtls";
configurePhase = ''
./autogen.sh || :
./configure --enable-dtls --prefix=$out
'';
buildPhase = "make";
installPhase = "make install";
meta = with lib; {
homepage = "https://github.com/obgm/libcoap";
description = "A CoAP (RFC 7252) implementation in C";
platforms = platforms.linux;
license = licenses.bsd2;
maintainers = [maintainers.kmein];
};
}

View File

@@ -1,19 +0,0 @@
{
writers,
lib,
xsv,
curl,
gnused,
}:
writers.writeDashBin "literature-quote" ''
PATH=$PATH:${lib.makeBinPath [xsv curl gnused]}
ROW=$(curl -Ls http://kmein.github.io/logotheca/quotes.csv | shuf -n1)
(
printf '%s\n\n %s: _%s_, %s\n' \
"$(echo "$ROW" | xsv select 4)" \
"$(echo "$ROW" | xsv select 1)" \
"$(echo "$ROW" | xsv select 2)" \
"$(echo "$ROW" | xsv select 3 | tr : ,)"
) | sed 's/ | /\n/g;s/ || /\n\n/g;s/"\(.*\)"/\1/'
''

View File

@@ -1,10 +0,0 @@
{
writers,
ghostscript,
man-db,
gnused,
}:
writers.writeDashBin "man-pdf" ''
set -efu
${man-db}/bin/man -t "$@" | ${ghostscript}/bin/ps2pdf - "$(echo "$*" | ${gnused}/bin/sed 's/\s\+/_/g').pdf"
''

View File

@@ -1,18 +0,0 @@
# https://www.youtube.com/watch?v=8E8sUNHdzG8
{
writers,
man-db,
dmenu,
gnused,
findutils,
coreutils,
zathura,
}:
writers.writeDashBin "mansplain" ''
${man-db}/bin/man -k . \
| ${coreutils}/bin/cut -d" " -f1,2 \
| ${dmenu}/bin/dmenu -l 5 \
| ${gnused}/bin/sed 's/\(.*\) (\(.*\))/\2 \1/' \
| ${findutils}/bin/xargs -r ${man-db}/bin/man -t \
| ${zathura}/bin/zathura -
''

View File

@@ -1,30 +0,0 @@
{writers}:
writers.writeHaskellBin "manual-sort" {} ''
{-# LANGUAGE LambdaCase #-}
import Data.Char (toLower)
import System.Environment (getArgs)
import System.IO (BufferMode(NoBuffering), hSetBuffering, stdout)
insertionSortM :: Monad f => (a -> a -> f Ordering) -> [a] -> f [a]
insertionSortM cmp = foldr ((=<<) . insertByM cmp) (pure [])
where
insertByM cmp x = \case
[] -> pure [x]
yys@(y : ys) -> cmp x y >>= \case
GT -> (y :) <$> insertByM cmp x ys
_ -> pure (x : yys)
ask :: Show a => a -> a -> IO Ordering
ask a b = do
putStr (show a ++ " > " ++ show b ++ "? (y/n) ")
map toLower <$> getLine >>= \case
'y' : _ -> return GT
_ -> return LT
main :: IO ()
main = do
hSetBuffering stdout NoBuffering
argv <- getArgs
sorted <- insertionSortM ask argv
mapM_ (\(place, thing) -> putStrLn (show place ++ ". " ++ show thing)) $ zip [1 ..] (reverse sorted)
''

Some files were not shown because too many files have changed in this diff Show More