added a bunch of stuff from mossnet, and music

This commit is contained in:
Anish L 2021-11-17 22:50:18 +10:00
parent f7cd8ad493
commit f8edbfe092
18 changed files with 1037 additions and 232 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use nix

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.direnv/

View file

@ -1,6 +1,12 @@
{pkgs, ...}: { pkgs, ... }:
{ {
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
services.blueman.enable = true; services.blueman.enable = true;
# A2DP protocol
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
} }

34
profiles/borg/default.nix Normal file
View file

@ -0,0 +1,34 @@
{
# Assumes the remote borg backup server has already been initialized
# borg init --encryption-key=repokey-blake2 -rsh 'ssh -i /run/keys/id_ed25519_borgbase' 20779@hk-s020.rsync.net:<borg-archive>
services.borgbackup.jobs = {
backupTaskwarriorRsync = {
paths = [ "/var/lib/taskserver" ];
doInit = true;
repo = "20779@hk-s020.rsync.net:taskwarrior";
encryption = {
mode = "repokey-blake2";
passCommand = "cat /run/keys/rsync";
};
environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
compression = "auto,lzma";
startAt = "weekly";
extraArgs = "--remote-path=borg1";
};
};
services.borgbackup.jobs = {
backupShaarliRsync = {
paths = [ "/var/www/shaarli-config/data/datastore.php" "/var/www/shaarli-config/config" "/var/www/shaarli-config/.json.config" ];
doInit = true;
repo = "20779@hk-s020.rsync.net:shaarli";
encryption = {
mode = "repokey-blake2";
passCommand = "cat /run/keys/rsync";
};
environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
compression = "auto,lzma";
startAt = "weekly";
extraArgs = "--remote-path=borg1";
};
};
}

16
profiles/dns/defalut.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
{
services.dnsmasq.enable = true;
services.dnsmasq.extraConfig = ''
domain-needed
no-resolv
local=/lan/
local=/moss/
cache-size=5000
addn-hosts=/ec/adblock.hosts
'';
services.dnsmasq.servers = [ "45.90.30.49" "45.90.28.49" "1.1.1.1" "8.8.8.8" ];
networking.hosts = { "172.16.11.240" = [ "mossnet.lan" "links.mossnet.lan" "read.mossnet.lan" "stats.mossnet.lan" "music.moss" "tasks.moss" "headphones.moss" "cloud.moss" "links.moss" "read.moss" "stats.moss" "rss.moss" ]; };
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
}

View file

@ -0,0 +1,12 @@
{ config, lib, pkgs, ... }:
{
services.gonic.enable = true;
services.gonic.settings = ''
music-path /data/music
podcast-path /data/music
cache-path /data/cache
'';
services.gonic.group = "audio";
services.gonic.user = "headphones";
networking.firewall.allowedTCPPorts = [ 4747 ];
}

View file

@ -0,0 +1,110 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.gonic;
configFile = "/etc/gonic/config";
dataFolder = "/var/lib/gonic";
in
{
options = {
services.gonic = {
enable = mkEnableOption "Gonic music server and streamer";
settings = lib.mkOption {
type = types.str;
default = { };
example = literalExample ''
music-path <path to your music dir>
podcast-path <path to your podcasts dir>
cache-path <path to cache dir>
'';
description = ''
Configuration for Gonic, see <link xlink:href="https://github.com/sentriz/gonic"/> for supported values.
'';
};
user = mkOption {
type = types.str;
default = "gonic";
description = "User account under which gonic runs.";
};
group = mkOption {
type = types.str;
default = "gonic";
description = "Group account under which gonic runs.";
};
};
};
config = mkIf cfg.enable {
environment.etc."gonic/config".text = cfg.settings;
systemd.services.gonic = {
description = "gonic Music Server and Streamer compatible with Subsonic/Airsonic";
after = [ "remote-fs.target" "network.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
#GONIC_MUSIC_PATH
#GONIC_PODCAST_PATH
#GONIC_CACHE_PATH
#GONIC_DB_PATH
GONIC_SCAN_INTERVAL = "800";
#...
};
serviceConfig = {
ExecStart = "${pkgs.gonic}/bin/gonic -config-path /etc/gonic/config";
WorkingDirectory = dataFolder;
TimeoutStopSec = "20";
KillMode = "process";
Restart = "on-failure";
RestartSec = "10";
User = cfg.user;
Group = cfg.group;
DevicePolicy = "closed";
NoNewPrivileges = " yes";
PrivateTmp = "yes";
PrivateUsers = "yes";
ProtectControlGroups = "yes";
ProtectKernelModules = "yes";
ProtectKernelTunables = "yes";
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
RestrictNamespaces = "yes";
RestrictRealtime = "yes";
SystemCallFilter = "~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap";
ReadWritePaths = dataFolder;
StateDirectory = baseNameOf dataFolder;
};
};
users.users = optionalAttrs (cfg.user == "gonic") ({
gonic = {
description = "gonic service user";
name = cfg.user;
group = cfg.group;
isSystemUser = true;
};
});
users.groups = optionalAttrs (cfg.group == "gonic") ({
gonic = { };
});
services.nginx.virtualHosts."music.mossnet.lan" = {
enableACME = false;
forceSSL = false;
locations."/" = {
extraConfig = ''
proxy_pass http://localhost:4747/;
proxy_set_header X-Forwarded-Host $host;
'';
};
};
};
}

View file

@ -0,0 +1,12 @@
{ config, lib, pkgs, ... }:
{
services.headphones = {
enable = true;
host = "172.16.11.240";
port = 8181;
user = "headphones";
group = "audio";
dataDir = "/data/music";
};
networking.firewall.allowedTCPPorts = [ 8181 ];
}

View file

@ -0,0 +1,59 @@
{ config, pkgs, ... }: {
# grafana configuration
services.grafana = {
enable = true;
domain = "stats.mossnet.lan";
port = 2342;
addr = "127.0.0.1";
};
# nginx reverse proxy
services.nginx.virtualHosts.${config.services.grafana.domain} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
proxyWebsockets = true;
};
};
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
dnsmasq = {
enable = true;
port = 9153;
};
};
scrapeConfigs = [
{
job_name = "box";
static_configs = [{ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; }];
}
{
job_name = "dns";
static_configs = [{ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.dnsmasq.port}" ]; }];
}
];
};
services.loki = {
enable = true;
configFile = /var/loki-config.yaml;
};
systemd.services.promtail = {
description = "Promtail service for Loki";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.grafana-loki}/bin/promtail --config.file ${/var/promtail.yaml}
'';
};
};
}

View file

@ -0,0 +1,41 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
helm
surge
distrho
orca-c
carla
sunvox
vcv-rack
reaper
renoise
projectm # milkdrop visualizer
]
hardware.pulseaudio.enable = lib.mkForce false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
config = {
pipewire."context.properties"."default.clock.rate" = "192000";
pipewire-pulse."stream.properties"."resample.quality" = 15;
client."stream.properties"."resample.quality" = 15;
client-rt."stream.properties"."resample.quality" = 15;
};
media-session.config.bluez-monitor.properties = {
"bluez5.headset-roles" = [ "hsp_hs" "hsp_ag" ];
"bluez5.codecs" = [ "aac" "ldac" "aptx_hd" ];
};
};
systemd.services.bluethoot.serviceConfig.ExecStart = [
""
"${config.hardware.bluetooth.package}/libexec/bluetooth/bluetoothd --noplugin=sap"
];
}

View file

@ -0,0 +1,57 @@
{ pkgs, config, ... }:
{
age.secrets.nextcloud-db.file = "/etc/nixos/secrets/nextcloud-db.age";
age.secrets.nextcloud-admin.file = "/etc/nixos/secrets/nextcloud-admin.age";
services.nextcloud = {
enable = true;
hostName = "mossnet.lan";
home = "/data/nextcloud";
package = pkgs.nextcloud21;
# Use HTTPS for links
https = false;
# Auto-update Nextcloud Apps
autoUpdateApps.enable = true;
# Set what time makes sense for you
autoUpdateApps.startAt = "05:00:00";
config = {
# Further forces Nextcloud to use HTTPS
# overwriteProtocol = "https";
# Nextcloud PostegreSQL database configuration, recommended over using SQLite
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud";
dbpassFile = "/run/secrets/nextcloud-db";
adminpassFile = "/run/secrets/nextcloud-admin";
adminuser = "admin";
};
};
# Enable PostgreSQL
services.postgresql = {
enable = true;
# Ensure the database, user, and permissions always exist
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}
];
};
# Ensure that postgres is running before running the setup
systemd.services."nextcloud-setup" = {
requires = [ "postgresql.service" ];
after = [ "postgresql.service" ];
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
#nixpkgs.config.permittedInsecurePackages = [ "nextcloud-19.0.6"];
}

View file

@ -0,0 +1,114 @@
{ pkgs, config, ... }:
let
dataDir = "/var/www/shaarli-config";
name = "shaarli";
in
{
services.nginx = {
enable = true;
virtualHosts = {
"links.mossnet.lan" = {
forceSSL = false;
enableACME = false;
root = "${dataDir}";
extraConfig = ''
index index.php;
'';
locations = {
"/".extraConfig = ''
try_files $uri $uri/ index.php$is_args$args;
'';
"~ (index)\\.php$".extraConfig = ''
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:${config.services.phpfpm.pools."${name}".socket};
fastcgi_index index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
'';
"~ \\.php$".extraConfig = ''
deny all;
'';
"^~ /tpl/".extraConfig = "alias ${pkgs.shaarli}/tpl/;";
"^~ /plugins/".extraConfig = "alias ${pkgs.shaarli}/plugins/;";
"~* \\.(?:ico|css|js|gif|jpe?g|png)$".extraConfig = ''
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
'';
};
};
};
};
services.phpfpm = {
pools = {
"${name}" = {
user = "nginx";
group = "nginx";
#listen = "/run/phpfpm/php.sock";
settings = {
"listen.owner" = "nginx";
"listen.group" = "nginx";
"user" = "nginx";
"pm" = "dynamic";
"pm.max_children" = "4";
"pm.min_spare_servers" = "1";
"pm.max_spare_servers" = "4";
"pm.max_requests" = "32";
"catch_workers_output" = "1";
"php_admin_value[error_log]" = "/var/log/nginx/${name}-phpfpm-error.log";
};
};
};
};
users.extraUsers."${name}" = { group = "${name}"; };
users.extraGroups."${name}" = { };
users.users.shaarli.isSystemUser = true;
systemd.services.shaarli-install = {
serviceConfig.Type = "oneshot";
wantedBy = [ "multi-user.target" ];
script = ''
if [ ! -d "${dataDir}" ]; then
#cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/cache/
#cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/data/
#cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/pagecache/
#cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/tmp/
mkdir -p ${dataDir}/{cache,data,pagecache,tmp}
ln -s ${pkgs.shaarli}/* ${dataDir}
fi
chown -Rc nginx:nginx ${dataDir}
find ${dataDir} -type d ! -perm 0700 -exec chmod 0700 {} \; -exec chmod g-s {} \;
find ${dataDir} -type f ! -perm 0600 -exec chmod 0600 {} \;
'';
};
# TODO: Write the configuration file here?
#networking.firewall.allowedTCPPorts = [ 80 ];
}

View file

@ -0,0 +1,9 @@
{ config, pkgs, ... }:
{
services.taskserver.enable = true;
services.taskserver.fqdn = "task.moss";
services.taskserver.listenHost = "172.16.11.240";
services.taskserver.listenPort = 53589;
services.taskserver.organisations.mossnet.users = [ "anish" ];
}

View file

@ -0,0 +1,99 @@
{ pkgs, config, lib, ... }:
{
services.postgresql = {
enable = true;
# Ensure the database, user, and permissions always exist
ensureDatabases = [ "wallabag" ];
ensureUsers = [
{
name = "wallabag";
ensurePermissions."DATABASE wallabag" = "ALL PRIVILEGES";
}
];
};
services.wallabag = {
enable = true;
hostName = "read.mossnet.lan";
package = pkgs.callPackage ./pkg-wallabag.nix { };
conf = ''
# This file is a "template" of what your parameters.yml file should look like
parameters:
# Uncomment these settings or manually update your parameters.yml
# to use docker-compose
#
# database_driver: %env.database_driver%
# database_host: %env.database_host%
# database_port: %env.database_port%
# database_name: %env.database_name%
# database_user: %env.database_user%
# database_password: %env.database_password%
database_driver: pdo_pgsql
database_host: localhost
database_port: ~
database_name: wallabag
database_user: wallabag
database_password: wallabag
# For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite"
database_path: ~
database_table_prefix: wallabag_
database_socket: null
# with PostgreSQL and SQLite, you must set "utf8"
database_charset: utf8
domain_name: http://read.mossnet.lan
server_name: "mossnet wallabag instance"
mailer_transport: smtp
mailer_user: ~
mailer_password: ~
mailer_host: 127.0.0.1
mailer_port: false
mailer_encryption: ~
mailer_auth_mode: ~
locale: en
# A secret key that's used to generate certain security-related tokens
secret: SAFGOECRIlfal89oe6u0(*^dsaaih961
# two factor stuff
twofactor_auth: true
twofactor_sender: no-reply@wallabag.org
# fosuser stuff
fosuser_registration: true
fosuser_confirmation: true
# how long the access token should live in seconds for the API
fos_oauth_server_access_token_lifetime: 3600
# how long the refresh token should life in seconds for the API
fos_oauth_server_refresh_token_lifetime: 1209600
from_email: no-reply@wallabag.org
rss_limit: 50
# RabbitMQ processing
rabbitmq_host: localhost
rabbitmq_port: 5672
rabbitmq_user: guest
rabbitmq_password: guest
rabbitmq_prefetch_count: 10
# Redis processing
redis_scheme: tcp
redis_host: localhost
redis_port: 6379
redis_path: null
redis_password: null
# sentry logging
sentry_dsn: ~
'';
};
# networking.firewall.allowedTCPPorts = [ 8080 ];
}

View file

@ -0,0 +1,221 @@
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.services.wallabag;
poolName = "wallabag";
configFile = pkgs.writeTextFile {
name = "wallabag-config";
text = cfg.conf;
destination = "/config/parameters.yml";
};
appDir = pkgs.buildEnv {
name = "wallabag-app-dir";
ignoreCollisions = true;
checkCollisionContents = false;
paths = [ configFile "${cfg.package}/app" ];
};
in
{
options = {
services.wallabag = {
enable = mkEnableOption "wallabag";
user = mkOption {
type = types.str;
default = "nginx";
description = ''
User account under which both the update daemon and the web-application run.
'';
};
dataDir = mkOption {
type = types.path;
default = "/var/lib/wallabag";
description = ''
Data directory.
'';
};
package = mkOption {
type = types.package;
default = pkgs.wallabag;
description = ''
Wallabag package to use.
'';
};
hostName = mkOption {
type = types.str;
description = ''
Name of the nginx virtualhost to use and setup.
'';
};
poolConfig = mkOption {
type = types.lines;
default = ''
pm = dynamic
pm.max_children = 75
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 20
pm.max_requests = 500
catch_workers_output = 1
'';
description = ''
Options for wallabag's PHP pool. See the documentation on <literal>php-fpm.conf</literal> for details on configuration directives.
'';
};
conf = mkOption {
type = types.str;
description = ''
Contents of the wallabag configuration file (parameters.yml)
'';
};
};
};
config = mkIf cfg.enable {
services.phpfpm.pools."${poolName}" = {
user = "${cfg.user}";
group = "nginx";
settings = {
"listen.owner" = "nginx";
"listen.group" = "nginx";
"listen.mode" = "0600";
"user" = "${cfg.user}";
"group" = "nginx";
"env[WALLABAG_DATA]" = "${cfg.dataDir}";
"pm" = "dynamic";
"pm.max_children" = "75";
"pm.min_spare_servers" = "5";
"pm.max_spare_servers" = "20";
"pm.max_requests" = "10";
"catch_workers_output" = "1";
"php_admin_value[error_log]" = "/var/log/nginx/${poolName}-phpfpm-error.log";
};
};
services.phpfpm.phpOptions = ''
max_execution_time = 120
'';
services.nginx.enable = mkDefault true;
services.nginx.virtualHosts."${cfg.hostName}" = {
enableACME = false;
forceSSL = false;
root = "${cfg.package}/web";
extraConfig = ''
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
'';
locations."/" = {
extraConfig = ''
try_files $uri /app.php$is_args$args;
'';
};
locations."/assets".root = "${cfg.dataDir}/web";
locations."~ ^/app\\.php(/|$)" = {
extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME ${cfg.package}/web/$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT ${cfg.package}/web;
fastcgi_read_timeout 120;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
internal;
'';
};
locations."~ /(?!app)\\.php$" = {
extraConfig = ''
return 404;
'';
};
};
systemd.services.wallabag-install = {
description = "Wallabag install service";
wantedBy = [ "multi-user.target" ];
before = [ "phpfpm-wallabag.service" ];
after = [ "mysql.service" "postgresql.service" ];
path = with pkgs; [ coreutils php phpPackages.composer ];
serviceConfig = {
User = cfg.user;
Type = "oneshot";
RemainAfterExit = "yes";
PermissionsStartOnly = true;
};
preStart = ''
mkdir -p "${cfg.dataDir}"
chown ${cfg.user}:nginx "${cfg.dataDir}"
'';
script = ''
echo "Setting up wallabag files in ${cfg.dataDir} ..."
cd "${cfg.dataDir}"
rm -rf var/cache/*
rm -f app
ln -sf ${appDir} app
ln -sf ${cfg.package}/composer.{json,lock} .
export WALLABAG_DATA="${cfg.dataDir}"
if [ ! -f installed ]; then
php ${cfg.package}/bin/console --env=prod doctrine:database:create --if-not-exists --no-interaction
php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction
# Until https://github.com/wallabag/wallabag/issues/3662 is fixed
# yes no | php ${cfg.package}/bin/console --env=prod wallabag:install
touch installed
else
php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction
fi
php ${cfg.package}/bin/console --env=prod cache:clear
'';
};
};
meta = with stdenv.lib; {
maintainers = with maintainers; [ nadrieril ];
};
}

View file

@ -2,9 +2,12 @@ let
# set ssh public keys here for your system and user # set ssh public keys here for your system and user
user = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItTdCyYVur6LzRQf08JZUcEAr23H7fTRRmDJOzoOc6A anish@curve"; user = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItTdCyYVur6LzRQf08JZUcEAr23H7fTRRmDJOzoOc6A anish@curve";
system = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIMPcqWQ/L5nLTsBFHArl3AJb9xynhfsKenb5h0NNuMV root@curve"; system = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIMPcqWQ/L5nLTsBFHArl3AJb9xynhfsKenb5h0NNuMV root@curve";
mossnet = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAA0bsVbdQR6iWNLKIiID57A1+dVXC58Dtf5cSXg6/JF root@box";
allKeys = [ system user ]; allKeys = [ system user ];
in in
{ {
"fastmail.age".publicKeys = allKeys; "fastmail.age".publicKeys = allKeys;
"mossnet.age".publicKeys = allKeys; "mossnet.age".publicKeys = allKeys;
"nextcloud-db.age".publicKeys = mossnet;
"nextcloud-admin.age".publicKeys = mossnet;
} }

View file

@ -1,15 +1,16 @@
{pkgs, config, ...}: { pkgs, config, ... }:
{ {
# TODO modularize
#imports = [ ./xdg.nix ]; #imports = [ ./xdg.nix ];
home-manager.users.anish.xdg.enable = true; # This doesn't seem to do anything so we have below home-manager.users.anish.xdg.enable = true; # This doesn't seem to do anything so we have below
home-manager.users.anish.xdg.configHome = "/home/anish/.config"; # TODO bad hard coded home-manager.users.anish.xdg.configHome = "/home/anish/.config"; # TODO bad hard coded
environment.sessionVariables = rec { environment.sessionVariables = rec {
XDG_CACHE_HOME = "\${HOME}/.cache"; XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config"; XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_BIN_HOME = "\${HOME}/.local/bin"; XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share"; XDG_DATA_HOME = "\${HOME}/.local/share";
PATH = [ PATH = [
"\${XDG_BIN_HOME}" "\${XDG_BIN_HOME}"
@ -120,37 +121,37 @@
]; ];
xresources.properties = { xresources.properties = {
"Xcursor.theme"= "Paper"; "Xcursor.theme" = "Paper";
#"Xcursor.size"= 64; #"Xcursor.size"= 64;
"*.foreground"= "#e6e1cf"; "*.foreground" = "#e6e1cf";
"*.background"= "#0f1419"; "*.background" = "#0f1419";
"*.cursorColor"= "#f29718"; "*.cursorColor" = "#f29718";
# Black # Black
"*.color0"= "#000000"; "*.color0" = "#000000";
"*.color8"= "#323232"; "*.color8" = "#323232";
# Red # Red
"*.color1"= "#ff3333"; "*.color1" = "#ff3333";
"*.color9"= "#ff6565"; "*.color9" = "#ff6565";
# Green # Green
"*.color2"= "#b8cc52"; "*.color2" = "#b8cc52";
"*.color10"= "#eafe84"; "*.color10" = "#eafe84";
# Yellow # Yellow
"*.color3"= "#e7c547"; "*.color3" = "#e7c547";
"*.color11"= "#fff779"; "*.color11" = "#fff779";
# Blue # Blue
"*.color4"= "#36a3d9"; "*.color4" = "#36a3d9";
"*.color12"= "#68d5ff"; "*.color12" = "#68d5ff";
# Magenta # Magenta
"*.color5"= "#f07178"; "*.color5" = "#f07178";
"*.color13"= "#ffa3aa"; "*.color13" = "#ffa3aa";
# Cyan # Cyan
"*.color6"= "#95e6cb"; "*.color6" = "#95e6cb";
"*.color14"= "#c7fffd"; "*.color14" = "#c7fffd";
# White # White
"*.color7"= "#ffffff"; "*.color7" = "#ffffff";
"*.color15"= "#ffffff"; "*.color15" = "#ffffff";
# Bold, Italic, Underline # Bold, Italic, Underline
"*.colorBD"= "#e6e1cf"; "*.colorBD" = "#e6e1cf";
}; };
# Move required config files around # Move required config files around
@ -182,7 +183,7 @@
gtk-xft-hintstyle=hintfull gtk-xft-hintstyle=hintfull
gtk-xft-rgba=none gtk-xft-rgba=none
''; '';
# GTK2 global theme (widget and icon theme) # GTK2 global theme (widget and icon theme)
".config/gtk-2.0/gtkrc".text = '' ".config/gtk-2.0/gtkrc".text = ''
gtk-theme-name=Dracula gtk-theme-name=Dracula
gtk-icon-theme-name=Paper gtk-icon-theme-name=Paper
@ -193,18 +194,18 @@
}; };
# Compositor # Compositor
services.picom = { services.picom = {
enable = true; enable = true;
fade = true; fade = true;
fadeDelta = 1; fadeDelta = 1;
fadeSteps = [ "0.01" "0.022" ]; fadeSteps = [ "0.01" "0.022" ];
shadow = true; shadow = true;
shadowOffsets = [ (-10) (-10) ]; shadowOffsets = [ (-10) (-10) ];
shadowOpacity = "0.22"; shadowOpacity = "0.22";
# activeOpacity = "1.00"; # activeOpacity = "1.00";
# inactiveOpacity = "0.92"; # inactiveOpacity = "0.92";
extraOptions = '' extraOptions = ''
shadow-radius = 12; shadow-radius = 12;
# blur-background = true; # blur-background = true;
# blur-background-frame = true; # blur-background-frame = true;
@ -212,9 +213,11 @@
blur-kern = "7x7box"; blur-kern = "7x7box";
blur-strength = 320; blur-strength = 320;
''; '';
}; };
programs.autorandr.enable = true; programs.autorandr.enable = true;
services.udiskie.automount = true; services.udiskie.automount = true;
services.mpris-proxy.enable = true; # bluetooth media control
}; };
} }

View file

@ -1,4 +1,4 @@
{pkgs, ... }: { pkgs, ... }:
{ {
age.secrets.fastmail.file = "/etc/nixos/secrets/fastmail.age"; age.secrets.fastmail.file = "/etc/nixos/secrets/fastmail.age";
@ -7,7 +7,7 @@
services.mbsync = { services.mbsync = {
enable = true; enable = true;
frequency = "*:0/30"; frequency = "*:0/30";
postExec = "${pkgs.notmuch}/bin/notmuch index"; postExec = "${pkgs.notmuch}/bin/notmuch new";
}; };
programs.mbsync.enable = true; programs.mbsync.enable = true;
programs.msmtp.enable = true; programs.msmtp.enable = true;
@ -20,211 +20,218 @@
programs.neomutt = { programs.neomutt = {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
# Shamelessly Stolen from https://gideonwolfe.com/posts/workflow/neomutt/intro/ # Shamelessly Stolen from https://gideonwolfe.com/posts/workflow/neomutt/intro/
# set editor to neovim # set editor to neovim
set editor = "nvim" set editor = "nvim"
# Folder with emails
set folder = "~/Mail/anish"
# Type of mailbox
set mbox_type = Maildir
# Directory to poll for new mail
set spoolfile = +Inbox
# Directory to save sent messages into
set record = +Sent
# Sets the drafts folder
set postponed = +Drafts
# File that headers will be cached
# set header_cache = ~/.cache/mutt
set my_name = "Anish" #set virtual_spoolfile=yes
set imap_check_subscribed set folder="~/Mail/"
set mbox_type = Maildir
#virtual-mailboxes "inbox" "notmuch://?query=tag:inbox"
#virtual-mailboxes "archive" "notmuch://?query=tag:archive"
#virtual-mailboxes "sent" "notmuch://?query=tag:sent"
# Set preffered view modes ## Folder with emails
auto_view text/html text/calendar application/ics # view html automatically #set folder = "~/Mail/anish"
# alternative_order text/html text/plain text/enriched text/* ## Type of mailbox
## Directory to poll for new mail
#set spoolfile = +Inbox
## Directory to save sent messages into
#set record = +Sent
## Sets the drafts folder
#set postponed = +Drafts
## File that headers will be cached
## set header_cache = ~/.cache/mutt
# main options #set my_name = "Anish"
set envelope_from #set imap_check_subscribed
set edit_headers # show headers when composing
set fast_reply # skip to compose when replying
set askcc # ask for CC:
set fcc_attach # save attachments with the body
set forward_format = "Fwd: %s" # format of subject when forwarding
set forward_decode # decode when forwarding
set attribution = "On %d, %n wrote:" # format of quoting header
set reply_to # reply to Reply to: field
set reverse_name # reply as whomever it was to
set include # include message in replies
set forward_quote # include message in forwards
set text_flowed
unset sig_dashes # no dashes before sig
unset mime_forward # forward attachments as part of body
unset help # No help bar at the top of index
# set status_on_top # Status bar on top of index
set tmpdir = ~/Programs/neomutt/temp # where to keep temp files
unset confirmappend # don't ask, just do! ## Set preffered view modes
set quit # don't ask, just do!! #auto_view text/html text/calendar application/ics # view html automatically
unset mark_old # read/new is good enough for me ## alternative_order text/html text/plain text/enriched text/*
#set beep_new # bell on new mails
set pipe_decode # strip headers and eval mimes when piping
set thorough_search # strip headers and eval mimes before searching
set timeout = 0
# status bar, date format, finding stuff etc. ## main options
set status_chars = " *%A" ##set envelope_from
set status_format = "[ Folder: %f ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>%?p?( %p postponed )?" ##set edit_headers # show headers when composing
set date_format = "%d.%m.%Y %H:%M" ##set fast_reply # skip to compose when replying
set sort = threads ##set askcc # ask for CC:
set sort_aux = reverse-last-date-received ##set fcc_attach # save attachments with the body
set uncollapse_jump ##set forward_format = "Fwd: %s" # format of subject when forwarding
set sort_re ##set forward_decode # decode when forwarding
set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" ##set attribution = "On %d, %n wrote:" # format of quoting header
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" ##set reply_to # reply to Reply to: field
set send_charset = "utf-8:iso-8859-1:us-ascii" ##set reverse_name # reply as whomever it was to
set charset = "utf-8" ##set include # include message in replies
set arrow_cursor = "no" # Change `color indicator` depending ##set forward_quote # include message in forwards
##set text_flowed
##unset sig_dashes # no dashes before sig
##unset mime_forward # forward attachments as part of body
##unset help # No help bar at the top of index
### set status_on_top # Status bar on top of index
##set tmpdir = ~/Programs/neomutt/temp # where to keep temp files
# Pager View Options #unset confirmappend # don't ask, just do!
set pager_index_lines = 10 # Shows 10 lines of index when pager is active #set quit # don't ask, just do!!
set pager_context = 3 #unset mark_old # read/new is good enough for me
set pager_stop ##set beep_new # bell on new mails
set menu_scroll #set pipe_decode # strip headers and eval mimes when piping
set tilde #set thorough_search # strip headers and eval mimes before searching
unset markers #set timeout = 0
#set mailcap_path = ~/.config/neomutt/mailcap ## status bar, date format, finding stuff etc.
#set header_cache = "~/.cache/mutt" #set status_chars = " *%A"
#set message_cachedir = "~/.cache/mutt" #set status_format = "[ Folder: %f ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>─%?p?( %p postponed )?"
#set date_format = "%d.%m.%Y %H:%M"
##set sort = threads
##set sort_aux = reverse-last-date-received
##set uncollapse_jump
##set sort_re
#set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
#set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
#set send_charset = "utf-8:iso-8859-1:us-ascii"
#set charset = "utf-8"
#set arrow_cursor = "no" # Change `color indicator` depending
set query_command = "khard email --parsable --search-in-source-files '%s'" ## Pager View Options
#set pager_index_lines = 10 # Shows 10 lines of index when pager is active
#set pager_context = 3
#set pager_stop
#set menu_scroll
#set tilde
#unset markers
### Color Settings ##set mailcap_path = ~/.config/neomutt/mailcap
# Header colors: ##set header_cache = "~/.cache/mutt"
color header blue default ".*" ##set message_cachedir = "~/.cache/mutt"
color header brightmagenta default "^(From)"
color header brightcyan default "^(Subject)"
color header brightwhite default "^(CC|BCC)"
mono bold bold #set query_command = "khard email --parsable --search-in-source-files '%s'"
mono underline underline
mono indicator reverse
mono error bold
color normal default default
color indicator brightyellow default # currently selected message. default makes bar clear, disabled arrow to save space.
color sidebar_highlight red default
color sidebar_divider brightblack black
color sidebar_flagged red black
color sidebar_new green black
color normal brightyellow default
color error red default
color tilde black default
color message cyan default
color markers red white
color attachment white default
color search brightmagenta default
color status brightyellow black
color hdrdefault brightgreen 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 brightgreen default
color bold black default
color underline black default
color normal default default
color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses #### Color Settings
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL ## Header colors:
color body green default "\`[^\`]*\`" # Green text between ` and ` #color header blue default ".*"
color body brightblue default "^# \.*" # Headings as bold blue #color header brightmagenta default "^(From)"
color body brightcyan default "^## \.*" # Subheadings as bold cyan #color header brightcyan default "^(Subject)"
color body brightgreen default "^### \.*" # Subsubheadings as bold green #color header brightwhite default "^(CC|BCC)"
color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
color body brightcyan default "[;:][-o][)/(|]" # emoticons
color body brightcyan default "[;:][)(|]" # emoticons
color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
color body red default "(BAD signature)"
color body cyan default "(Good signature)"
color body brightblack default "^gpg: Good signature .*"
color body brightyellow default "^gpg: "
color body brightyellow red "^gpg: BAD signature from.*"
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<>\"]"
# Default index colors: #mono bold bold
color index yellow default '.*' #mono underline underline
color index_author red default '.*' #mono indicator reverse
color index_number blue default #mono error bold
color index_subject cyan default '.*' #color normal default default
#color indicator brightyellow default # currently selected message. default makes bar clear, disabled arrow to save space.
#color sidebar_highlight red default
#color sidebar_divider brightblack black
#color sidebar_flagged red black
#color sidebar_new green black
#color normal brightyellow default
#color error red default
#color tilde black default
#color message cyan default
#color markers red white
#color attachment white default
#color search brightmagenta default
#color status brightyellow black
#color hdrdefault brightgreen 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 brightgreen default
#color bold black default
#color underline black default
#color normal default default
# For new mail: #color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color index brightyellow black "~N" #color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color index_author brightred black "~N" #color body green default "\`[^\`]*\`" # Green text between ` and `
color index_subject brightcyan black "~N" #color body brightblue default "^# \.*" # Headings as bold blue
#color body brightcyan default "^## \.*" # Subheadings as bold cyan
#color body brightgreen default "^### \.*" # Subsubheadings as bold green
#color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
#color body brightcyan default "[;:][-o][)/(|]" # emoticons
#color body brightcyan default "[;:][)(|]" # emoticons
#color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
#color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
#color body red default "(BAD signature)"
#color body cyan default "(Good signature)"
#color body brightblack default "^gpg: Good signature .*"
#color body brightyellow default "^gpg: "
#color body brightyellow red "^gpg: BAD signature from.*"
#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<>\"]"
color progress black cyan ## Default index colors:
#color index yellow default '.*'
#color index_author red default '.*'
#color index_number blue default
#color index_subject cyan default '.*'
### Mappings Settings ## For new mail:
#color index brightyellow black "~N"
#color index_author brightred black "~N"
#color index_subject brightcyan black "~N"
# General rebindings #color progress black cyan
bind attach <return> view-mailcap
bind attach l view-mailcap #### Mappings Settings
bind editor <space> noop #
bind pager c imap-fetch-mail ## General rebindings
bind index G last-entry #bind attach <return> view-mailcap
bind index g noop #bind attach l view-mailcap
bind index gg first-entry #bind editor <space> noop
bind pager,attach h exit #bind pager c imap-fetch-mail
bind pager j next-line #bind index G last-entry
bind pager k previous-line #bind index g noop
bind pager l view-attachments #bind index gg first-entry
bind index D delete-message #bind pager,attach h exit
bind index U undelete-message #bind pager j next-line
bind index L limit #bind pager k previous-line
bind index h noop #bind pager l view-attachments
bind index l display-message #bind index D delete-message
bind browser h goto-parent #bind index U undelete-message
bind browser l select-entry #bind index L limit
bind pager,browser gg top-page #bind index h noop
bind pager,browser G bottom-page #bind index l display-message
bind index,pager,browser d half-down #bind browser h goto-parent
bind index,pager,browser u half-up #bind browser l select-entry
bind index,pager R group-reply #bind pager,browser gg top-page
bind index \031 previous-undeleted # Mouse wheel #bind pager,browser G bottom-page
bind index \005 next-undeleted # Mouse wheel #bind index,pager,browser d half-down
bind pager \031 previous-line # Mouse wheel #bind index,pager,browser u half-up
bind pager \005 next-line # Mouse wheel #bind index,pager R group-reply
bind editor <Tab> complete-query #bind index \031 previous-undeleted # Mouse wheel
#bind index \005 next-undeleted # Mouse wheel
#bind pager \031 previous-line # Mouse wheel
#bind pager \005 next-line # Mouse wheel
#bind editor <Tab> complete-query
# sidebar mappings ## sidebar mappings
bind index,pager \Ck sidebar-prev #bind index,pager \Ck sidebar-prev
bind index,pager \Cj sidebar-next #bind index,pager \Cj sidebar-next
bind index,pager \Co sidebar-open #bind index,pager \Co sidebar-open
bind index,pager \Cp sidebar-prev-new #bind index,pager \Cp sidebar-prev-new
bind index,pager \Cn sidebar-next-new #bind index,pager \Cn sidebar-next-new
bind index,pager B sidebar-toggle-visible #bind index,pager B sidebar-toggle-visible
# global index and pager shortcuts ## global index and pager shortcuts
bind index,pager @ compose-to-sender #bind index,pager @ compose-to-sender
bind index,pager D purge-message #bind index,pager D purge-message
bind index <tab> sync-mailbox #bind index <tab> sync-mailbox
bind index <space> collapse-thread #bind index <space> collapse-thread
# Email completion bindings ## Email completion bindings
bind editor <Tab> complete-query #bind editor <Tab> complete-query
bind editor ^T complete #bind editor ^T complete
# Press A to add contact to Khard address book ## Press A to add contact to Khard address book
macro index,pager A \ #macro index,pager A \
"<pipe-message>khard add-email<return>" \ #"<pipe-message>khard add-email<return>" \
"add the sender email address to khard" #"add the sender email address to khard"
''; '';
}; };
services.imapnotify.enable = true; services.imapnotify.enable = true;
home.packages = [ pkgs.neomutt pkgs.evolution ]; home.packages = [ pkgs.neomutt pkgs.evolution ];