1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

chore: nixfmt

This commit is contained in:
Kierán Meinhardt
2020-06-10 17:37:25 +02:00
parent 2c3957735b
commit d8a4d4eedf
90 changed files with 1461 additions and 985 deletions

View File

@@ -34,9 +34,7 @@ let
};
in {
options.niveum = {
applications = {
fileManager = mkOption { type = types.str; };
};
applications = { fileManager = mkOption { type = types.str; }; };
colours = mkOption { type = my-types.colourTheme; };
@@ -66,16 +64,29 @@ in {
batteryBlocks.default = mkOption { type = types.str; };
promptColours =
let colours16 = types.enum [ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
promptColours = let
colours16 = types.enum [
"black"
"red"
"green"
"yellow"
"blue"
"magenta"
"cyan"
"white"
];
in {
success = mkOption { type = colours16; default = "green"; };
failure = mkOption { type = colours16; default = "red"; };
success = mkOption {
type = colours16;
default = "green";
};
failure = mkOption {
type = colours16;
default = "red";
};
};
fonts = {
size = mkOption { type = types.int; };
};
fonts = { size = mkOption { type = types.int; }; };
user = {
github = mkOption { type = types.str; };
@@ -85,7 +96,29 @@ in {
ignore = mkOption {
type = types.listOf types.str;
default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.py[co]" "*.o" "*.hi" "*.aux" "*.bbl" "*.bcf" "*.blg" "*.fdb_latexmk" "*.fls" "*.out" "*.run.xml" "*.toc" "*.bbl" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ];
default = [
"*~"
".stack-work/"
"__pycache__/"
".mypy_cache/"
"*.py[co]"
"*.o"
"*.hi"
"*.aux"
"*.bbl"
"*.bcf"
"*.blg"
"*.fdb_latexmk"
"*.fls"
"*.out"
"*.run.xml"
"*.toc"
"*.bbl"
"*.class"
"*.dyn_hi"
"*.dyn_o"
"dist/"
];
};
theme = {

View File

@@ -2,9 +2,7 @@
with lib;
let cfg = config.niveum.dropbox;
in {
options.niveum.dropbox = {
enable = mkEnableOption "Dropbox";
};
options.niveum.dropbox = { enable = mkEnableOption "Dropbox"; };
config = mkIf cfg.enable {
systemd.user.services.dropbox = {

View File

@@ -1,17 +1,14 @@
{ pkgs, config, lib, ... }:
with lib;
let cfg = config.niveum.google-drive;
in
{
in {
options.niveum.google-drive = {
enable = mkEnableOption "Google Drive";
directory = mkOption { type = types.path; };
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.grive2
];
environment.systemPackages = [ pkgs.grive2 ];
systemd.user.services.google-drive = {
description = "Google Drive synchronisation service";

View File

@@ -20,26 +20,45 @@ let
in {
options.niveum.hledger = {
enable = mkEnableOption "hledger";
package = mkOption { type = types.package; default = pkgs.hledger; };
ledgerFile = mkOption { type = types.str; default = null; };
package = mkOption {
type = types.package;
default = pkgs.hledger;
};
ledgerFile = mkOption {
type = types.str;
default = null;
};
server = {
enable = mkEnableOption "hledger server";
port = mkOption { type = pkgs.unstable.lib.types.port; default = 5000; };
host = mkOption { type = types.str; default = "127.0.0.1"; };
port = mkOption {
type = pkgs.unstable.lib.types.port;
default = 5000;
};
host = mkOption {
type = types.str;
default = "127.0.0.1";
};
capabilities = mkOption {
type = types.listOf (types.enum ["view" "add" "manage"]);
type = types.listOf (types.enum [ "view" "add" "manage" ]);
default = [ "view" "add" ];
};
flags = mkOption { type = types.listOf types.str; default = []; };
flags = mkOption {
type = types.listOf types.str;
default = [ ];
};
user = mkOption { type = types.attrs; };
package = mkOption { type = types.package; default = pkgs.hledger-web; };
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;
environment.variables.LEDGER_FILE =
mkIf (cfg.ledgerFile != null) cfg.ledgerFile;
systemd.services.hledger-web = mkIf cfg.server.enable {
description = "hledger server";

View File

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

View File

@@ -52,9 +52,11 @@ in {
'';
};
networking.extraHosts = builtins.readFile (toString "${retiolum}/etc.hosts");
networking.extraHosts =
builtins.readFile (toString "${retiolum}/etc.hosts");
environment.systemPackages = [ config.services.tinc.networks.${netname}.package ];
environment.systemPackages =
[ config.services.tinc.networks.${netname}.package ];
networking.firewall = {
allowedTCPPorts = [ 655 ];

View File

@@ -2,9 +2,7 @@
with lib;
let cfg = config.niveum.seafile;
in {
options.niveum.seafile = {
enable = mkEnableOption "Seafile";
};
options.niveum.seafile = { enable = mkEnableOption "Seafile"; };
config = mkIf cfg.enable {
systemd.user.services.seafile = {

View File

@@ -3,19 +3,22 @@ with lib;
let
cfg = config.niveum.telegramBots;
botService = name: bot: nameValuePair "telegram-bot-${name}" {
enable = bot.enable;
startAt = bot.time;
serviceConfig.Type = "oneshot";
wants = [ "network-online.target" ];
script = strings.concatStringsSep "\n" (["QUOTE=$(${bot.command})"] ++ map (chatId: ''
${pkgs.curl}/bin/curl -s -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
-d chat_id="${chatId}" \
-d text="$QUOTE" ${
lib.strings.optionalString (bot.parseMode != null) "-d parse_mode=${bot.parseMode}"
}
'') bot.chatIds);
};
botService = name: bot:
nameValuePair "telegram-bot-${name}" {
enable = bot.enable;
startAt = bot.time;
serviceConfig.Type = "oneshot";
wants = [ "network-online.target" ];
script = strings.concatStringsSep "\n" ([ "QUOTE=$(${bot.command})" ]
++ map (chatId: ''
${pkgs.curl}/bin/curl -s -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
-d chat_id="${chatId}" \
-d text="$QUOTE" ${
lib.strings.optionalString (bot.parseMode != null)
"-d parse_mode=${bot.parseMode}"
}
'') bot.chatIds);
};
in {
options.niveum.telegramBots = mkOption {
type = types.attrsOf (types.submodule {
@@ -23,18 +26,18 @@ in {
enable = mkEnableOption "Telegram bot";
time = mkOption { type = types.str; };
token = mkOption { type = types.strMatching "[0-9A-Za-z:-]+"; };
chatIds = mkOption { type = types.listOf (types.strMatching "[0-9]+|@[A-Za-z0-9]+"); };
chatIds = mkOption {
type = types.listOf (types.strMatching "[0-9]+|@[A-Za-z0-9]+");
};
command = mkOption { type = types.str; };
parseMode = mkOption {
type = types.nullOr (types.enum ["HTML" "Markdown"]);
type = types.nullOr (types.enum [ "HTML" "Markdown" ]);
default = null;
};
};
});
default = {};
default = { };
};
config = {
systemd.services = attrsets.mapAttrs' botService cfg;
};
config = { systemd.services = attrsets.mapAttrs' botService cfg; };
}

View File

@@ -2,37 +2,38 @@
with lib;
let
cfg = config.niveum.traadfri;
traadfri =
let traadfri-package = pkgs.fetchFromGitHub {
traadfri = let
traadfri-package = pkgs.fetchFromGitHub {
owner = "kmein";
repo = "traadfri";
rev = "7b30d404ecd2d9ff06c60ed33967448e8c2f42f5";
sha256 = "1ff37k86vi7bnng3vna8myfkyqbkg25w6ds7gl94m4hax8wikz26";
};
in pkgs.python3Packages.callPackage traadfri-package {
libcoap = pkgs.callPackage <niveum/packages/libcoap.nix> { tls = true; };
};
in
{
in pkgs.python3Packages.callPackage traadfri-package {
libcoap = pkgs.callPackage <niveum/packages/libcoap.nix> { tls = true; };
};
in {
options.niveum.traadfri = {
enable = mkEnableOption "Trådfri CLI";
user = mkOption { type = types.str; };
host = mkOption { type = types.str; };
key = mkOption { type = types.str; };
rooms = mkOption { type = types.attrsOf types.int; default = {}; };
bulbs = mkOption { type = types.attrsOf types.int; default = {}; };
rooms = mkOption {
type = types.attrsOf types.int;
default = { };
};
bulbs = mkOption {
type = types.attrsOf types.int;
default = { };
};
};
config = mkIf cfg.enable {
environment.shellAliases =
lib.attrsets.mapAttrs'
(name: value:
lib.nameValuePair "traadfri-${name}" "traadfri bulb ${toString value}")
cfg.bulbs
// lib.attrsets.mapAttrs'
(name: value:
lib.nameValuePair "traadfri-${name}" "traadfri group ${toString value}")
cfg.rooms;
environment.shellAliases = lib.attrsets.mapAttrs' (name: value:
lib.nameValuePair "traadfri-${name}" "traadfri bulb ${toString value}")
cfg.bulbs // lib.attrsets.mapAttrs' (name: value:
lib.nameValuePair "traadfri-${name}" "traadfri group ${toString value}")
cfg.rooms;
environment.systemPackages = [
(pkgs.writers.writeDashBin "traadfri" ''