secret.nix update

This commit is contained in:
Alexander Bantyev 2020-04-29 02:18:36 +03:00
parent a9420a56a7
commit e2117a0a80
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
11 changed files with 127 additions and 134 deletions

View File

@ -19,7 +19,7 @@
nntp_server= nntp_server=
use_nntp_auth=0 use_nntp_auth=0
user_id=balsoft@balsoft.ru user_id=balsoft@balsoft.ru
password=${config.secrets.mail.password} password=${config.secrets.mail.password or ""}
inbox=inbox inbox=inbox
use_apop_auth=0 use_apop_auth=0
remove_mail=1 remove_mail=1

View File

@ -1,4 +1,4 @@
{ pkgs, config, inputs, ... }: { pkgs, lib, config, inputs, ... }:
let let
weechat = pkgs.weechat.override { weechat = pkgs.weechat.override {
configure = { availablePlugins, ... }: { configure = { availablePlugins, ... }: {
@ -18,19 +18,6 @@ in {
home.file.".weechat/plugins.conf".text = '' home.file.".weechat/plugins.conf".text = ''
[var] [var]
lua.matrix.autojoin_on_invite = "on"
lua.matrix.backlog_lines = "120"
lua.matrix.debug = "off"
lua.matrix.encrypted_message_color = "lightgreen"
lua.matrix.homeserver_url = "https://matrix.balsoft.ru/"
lua.matrix.local_echo = "on"
lua.matrix.nick_style = "nick"
lua.matrix.password = "${config.secrets.matrix.password}"
lua.matrix.presence_filter = "on"
lua.matrix.read_receipts = "on"
lua.matrix.timeout = "20"
lua.matrix.typing_notices = "on"
lua.matrix.user = "${config.secrets.matrix.user}"
python.slack.auto_open_threads = "true" python.slack.auto_open_threads = "true"
python.slack.background_load_all_history = "true" python.slack.background_load_all_history = "true"
python.slack.channel_name_typing_indicator = "true" python.slack.channel_name_typing_indicator = "true"
@ -59,7 +46,7 @@ in {
python.slack.short_buffer_names = "false" python.slack.short_buffer_names = "false"
python.slack.show_buflist_presence = "true" python.slack.show_buflist_presence = "true"
python.slack.show_reaction_nicks = "true" python.slack.show_reaction_nicks = "true"
python.slack.slack_api_token = "${config.secrets.slack-term}" python.slack.slack_api_token = "${if isNull config.secrets.slack-term then "" else config.secrets.slack-term}"
python.slack.slack_timeout = "20000" python.slack.slack_timeout = "20000"
python.slack.switch_buffer_on_join = "true" python.slack.switch_buffer_on_join = "true"
python.slack.thread_messages_in_channel = "false" python.slack.thread_messages_in_channel = "false"

View File

@ -1,5 +1,5 @@
{ pkgs, config, lib, ... }: { { pkgs, config, lib, ... }: lib.mkIf (! isNull config.secrets.yt-utilities) {
home-manager.users.balsoft = lib.mkIf (config.deviceSpecific.goodMachine) { home-manager.users.balsoft = {
home.file.".yt.yaml".text = builtins.toJSON { home.file.".yt.yaml".text = builtins.toJSON {
yt-token = config.secrets.yt-utilities.token; yt-token = config.secrets.yt-utilities.token;
user = config.secrets.yt-utilities.user; user = config.secrets.yt-utilities.user;
@ -10,6 +10,5 @@
since = "1997-11-19"; since = "1997-11-19";
severity = "Info"; severity = "Info";
}; };
# home.packages = [ pkgs.yt-utilities ];
}; };
} }

View File

@ -66,12 +66,14 @@ in {
]; ];
dnsBlacklistOverrides = '' dnsBlacklistOverrides = ''
balsoft.ru OK balsoft.ru OK
${builtins.concatStringsSep " OK \n" (builtins.attrNames config.devices)} OK ${
builtins.concatStringsSep " OK \n" (builtins.attrNames config.devices)
} OK
192.168.0.0/16 OK 192.168.0.0/16 OK
''; '';
}; };
mailserver = { mailserver = lib.mkIf (! isNull config.secrets.mail) {
enable = ! isNull config.secrets.mail.host; enable = true;
fqdn = config.secrets.mail.host; fqdn = config.secrets.mail.host;
domains = [ config.secrets.mail.host ]; domains = [ config.secrets.mail.host ];
loginAccounts = { loginAccounts = {

View File

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }: { { pkgs, config, lib, ... }: lib.mkIf (! isNull config.secrets.matrix) {
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
allow_guest_access = true; allow_guest_access = true;

View File

@ -1,5 +1,5 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
{ lib.mkIf (! isNull config.secrets.openvpn) {
services.openvpn = { services.openvpn = {
servers = { servers = {
client = { client = {

View File

@ -27,24 +27,29 @@ in rec {
options.secrets = { options.secrets = {
owm-key = secret "OpenWeatherMap key"; owm-key = secret "OpenWeatherMap key";
irc = mkCredOption "IRC (konversation)" { }; irc = mkCredOption "IRC (konversation)" { };
slack-term = mkOption { type = str; }; slack-term = secret "slack token";
yt-utilities = { yt-utilities = mkOption {
description = "youtrack";
type = nullOr (submodule {
options = {
user = secret "youtrack user"; user = secret "youtrack user";
url = secret "youtrack url"; url = secret "youtrack url";
token = secret "youtrack token"; token = secret "youtrack token";
source = {
url = secret "A url to yt-utilities source";
rev = secret "revision";
sha256 = secret "sha256";
}; };
});
}; };
wage = secret "wage (sum CURRENCY/TIME, like 10EUR/h)"; wage = secret "wage (sum CURRENCY/TIME, like 10EUR/h)";
gcal = { gcal = mkOption {
description = "Google calendar auth";
type = nullOr (submodule {
options = {
email = mkOption { type = lib.types.str; }; email = mkOption { type = lib.types.str; };
client-id = mkOption { type = lib.types.str; }; client-id = mkOption { type = lib.types.str; };
client-secret = mkOption { type = lib.types.str; }; client-secret = mkOption { type = lib.types.str; };
refresh-token = mkOption { type = lib.types.str; }; refresh-token = mkOption { type = lib.types.str; };
}; };
});
};
mail = mkCredOption "email" { mail = mkCredOption "email" {
host = mkOption { host = mkOption {
type = str; type = str;
@ -57,12 +62,15 @@ in rec {
description = "Android device ID"; description = "Android device ID";
}; };
}; };
openvpn = mkCredOption "openvpn" {}; openvpn = mkCredOption "openvpn" { };
rclone = mkOption { rclone = mkOption {
type = nullOr str; type = nullOr str;
description = "Rclone config"; description = "Rclone config";
}; };
ssl = rec { ssl = mkOption {
description = "Certs";
type = nullOr (submodule {
options = {
cert = mkOption { cert = mkOption {
type = nullOr str; type = nullOr str;
description = "SSL certificate"; description = "SSL certificate";
@ -72,27 +80,27 @@ in rec {
description = "SSL RSA private key"; description = "SSL RSA private key";
}; };
}; };
});
};
matrix = mkCredOption "matrix" rec { matrix = mkCredOption "matrix" rec {
shared_secret = mkOption { shared_secret = mkOption {
type = nullOr str; type = nullOr str;
description = "A shared secret for matrix instance"; description = "A shared secret for matrix instance";
}; };
mautrix-whatsapp = { mautrix-whatsapp = {
config = mkOption { config = mkOption { type = attrs; };
type = attrs; registration = mkOption { type = attrs; };
};
registration = mkOption {
type = attrs;
};
}; };
mautrix-telegram = mautrix-whatsapp; mautrix-telegram = mautrix-whatsapp;
}; };
}; };
config = let config = let
unlocked = import (pkgs.runCommand "check-secret" {} "set +e; grep -qI . ${../secret.nix}; echo $? > $out") == 0; unlocked = import (pkgs.runCommand "check-secret" { }
"set +e; grep -qI . ${../secret.nix}; echo $? > $out") == 0;
secretnix = import ../secret.nix; secretnix = import ../secret.nix;
secrets = if ! unlocked || isNull secretnix then secrets = if !unlocked || isNull secretnix then
mapAttrs (n: v: null) options.secrets builtins.trace "secret.nix locked, building without any secrets"
(mapAttrs (n: v: null) options.secrets)
else else
secretnix; secretnix;
in { inherit secrets; }; in { inherit secrets; };

View File

@ -1,5 +1,5 @@
{ pkgs, lib, config, ... }: { { pkgs, lib, config, ... }: {
home-manager.users.balsoft = { home-manager.users.balsoft = lib.mkIf (! isNull config.secrets.gcal) {
home.file.".gcalcli_oauth.home".text = lib.optionals home.file.".gcalcli_oauth.home".text = lib.optionals
(!(isNull config.secrets.gcal)) (builtins.toJSON { (!(isNull config.secrets.gcal)) (builtins.toJSON {
access_token = ""; access_token = "";

View File

@ -36,14 +36,10 @@ in {
in '' in ''
interval=60 interval=60
markup=pango markup=pango
'' + genIniOrdered (optional (config.secrets ? mail) (scr "email") ++ [ '' + genIniOrdered (optional (!isNull config.secrets.mail) (scr "email")
(scrint "weather" 600) ++ [ (scrint "weather" 600) (scr "calendar") (scr "emacs") ]
(scr "calendar") ++ optional (!isNull config.secrets.wage) (scrint "youtrack-wage" 3600)
(scr "emacs") ++ [ (scrint "music" 10) (scrint "sound" 5) ] ++ [
(scrint "youtrack-wage" 3600)
(scrint "music" 10)
(scrint "sound" 5)
] ++ [
(scrint "cpu" 5) (scrint "cpu" 5)
(scrint "freq" 10) (scrint "freq" 10)
(scr "temperature") (scr "temperature")
@ -51,6 +47,7 @@ in {
] ++ optionals config.deviceSpecific.isLaptop [ ] ++ optionals config.deviceSpecific.isLaptop [
(scr "battery") (scr "battery")
(scrint "brightness" 5) (scrint "brightness" 5)
] ++ optional (config.deviceSpecific.devInfo ? bigScreen) (scrint "network" 1) ]
++ optional (config.deviceSpecific.devInfo ? bigScreen) (scrint "network" 1)
++ [ (scrint "connections" 10) (scr "df") (scr "date") (scrint "time" 1) ]); ++ [ (scrint "connections" 10) (scr "df") (scr "date") (scrint "time" 1) ]);
} }

View File

@ -1,5 +1,5 @@
{ pkgs, config, lib, ... }: { { pkgs, config, lib, ... }: {
home-manager.users.balsoft = { home-manager.users.balsoft = lib.mkIf (!isNull config.secrets.rclone) {
xdg.configFile."rclone/rclone.conf.home".text = config.secrets.rclone; xdg.configFile."rclone/rclone.conf.home".text = config.secrets.rclone;
home.activation."rclone" = { home.activation."rclone" = {
after = [ "linkGeneration" ]; after = [ "linkGeneration" ];

Binary file not shown.