Switch to using nixfmt & indent with spaces cause no tab support...

This commit is contained in:
Dmitry Voronin 2024-10-11 23:27:07 +03:00
parent ac00537d6e
commit bdcb0caf7b
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
341 changed files with 14170 additions and 12789 deletions

View file

@ -2,22 +2,12 @@
end_of_line = lf end_of_line = lf
charset = utf-8 charset = utf-8
indent_style = tab indent_style = tab
indent_size = 2
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.{nix,js}] [*.nix]
indent_size = 2 indent_style = space
[*.lua]
indent_size = 4
[*.sh]
indent_size = 8
[Makefile]
indent_size = 2 indent_size = 2
[*.md] [*.md]
indent_size = 8
trim_trailing_whitespace = false trim_trailing_whitespace = false

15
.treefmt.toml Normal file
View file

@ -0,0 +1,15 @@
# One CLI to format the code tree - https://git.numtide.com/numtide/treefmt
# [formatter.mylanguage]
# Formatter to run
# command = "command-to-run"
# Command-line arguments for the command
# options = []
# Glob pattern of files to include
# includes = [ "*.<language-extension>" ]
# Glob patterns of files to exclude
# excludes = []
[formatter.nixfmt-rfc-style]
command = "nixfmt"
includes = [ "*.nix" ]

View file

@ -26,6 +26,9 @@ check:
fix-ulimit: fix-ulimit:
ulimit -n 999999999 ulimit -n 999999999
format:
treefmt --no-cache --on-unmatched=info
gc: gc:
nix-collect-garbage -d nix-collect-garbage -d
# nix-store --gc # nix-store --gc

View file

@ -1,6 +1,7 @@
# Global settings. # Global settings.
# Just like I can configure each package, here I configure my config! :O) # Just like I can configure each package, here I configure my config! :O)
{ lib, ... }: { { lib, ... }:
{
options.setting = with lib; { options.setting = with lib; {
# Ollama settings. # Ollama settings.
# I use the best light model by default. # I use the best light model by default.
@ -42,11 +43,11 @@
# CPU configurations. # CPU configurations.
cpu = mkOption { cpu = mkOption {
default = {}; default = { };
type = types.submodule { type = types.submodule {
options = { options = {
hwmon = mkOption { hwmon = mkOption {
default = {}; default = { };
type = types.submodule { type = types.submodule {
options = { options = {
path = mkOption { path = mkOption {

View file

@ -1,4 +1,12 @@
{ lib, config, pkgs, __findFile, ... }: with lib; let {
lib,
config,
pkgs,
__findFile,
...
}:
with lib;
let
cfg = config.style; cfg = config.style;
mkTypeOption = default: type: mkOption { inherit default type; }; mkTypeOption = default: type: mkOption { inherit default type; };
@ -6,7 +14,8 @@
mkIntOption = default: mkTypeOption default types.int; mkIntOption = default: mkTypeOption default types.int;
mkFloatOption = default: mkTypeOption default types.float; mkFloatOption = default: mkTypeOption default types.float;
mkPkgOption = default: mkTypeOption default types.package; mkPkgOption = default: mkTypeOption default types.package;
in { in
{
options.style = { options.style = {
color = { color = {
bg = { bg = {
@ -69,11 +78,11 @@ in {
desktop = mkIntOption 14; desktop = mkIntOption 14;
}; };
serif = { serif = {
package = mkPkgOption (pkgs.callPackage <package/applefont> {}); package = mkPkgOption (pkgs.callPackage <package/applefont> { });
name = mkStrOption "SF Pro Display"; name = mkStrOption "SF Pro Display";
}; };
sansSerif = { sansSerif = {
package = mkPkgOption (pkgs.callPackage <package/applefont> {}); package = mkPkgOption (pkgs.callPackage <package/applefont> { });
name = mkStrOption "SF Pro Display"; name = mkStrOption "SF Pro Display";
}; };
monospace = { monospace = {

View file

@ -1,11 +1,22 @@
{ pkgs, config, __findFile, ... }: { {
pkgs,
config,
__findFile,
...
}:
{
stylix = { stylix = {
enable = true; enable = true;
image = config.module.wallpaper.path; image = config.module.wallpaper.path;
autoEnable = true; autoEnable = true;
polarity = "dark"; polarity = "dark";
fonts = { fonts = {
inherit (config.style.font) serif sansSerif monospace emoji; inherit (config.style.font)
serif
sansSerif
monospace
emoji
;
sizes = { sizes = {
inherit (config.style.font.size) terminal desktop; inherit (config.style.font.size) terminal desktop;
applications = config.style.font.size.application; applications = config.style.font.size.application;
@ -18,10 +29,14 @@
popups = config.style.opacity.popups; popups = config.style.opacity.popups;
}; };
inherit (config.style) cursor; inherit (config.style) cursor;
override = if config.module.wallpaper.forceContrastText then { override =
if config.module.wallpaper.forceContrastText then
{
base04 = "000000"; base04 = "000000";
base05 = "ffffff"; base05 = "ffffff";
base06 = "ffffff"; base06 = "ffffff";
} else {}; }
else
{ };
}; };
} }

View file

@ -1,8 +1,11 @@
{ pkgs, lib, ... }: with lib; let { pkgs, lib, ... }:
with lib;
let
url = "https://i.imgur.com/gYy0mzG.jpeg"; url = "https://i.imgur.com/gYy0mzG.jpeg";
sha256 = "0pwnq84mdbv8nrarhnbkq77iabwgh7znr0yig3fnshamxl2a3k7k"; sha256 = "0pwnq84mdbv8nrarhnbkq77iabwgh7znr0yig3fnshamxl2a3k7k";
forceContrastText = true; forceContrastText = true;
in { in
{
options = { options = {
module.wallpaper = { module.wallpaper = {
forceContrastText = mkOption { forceContrastText = mkOption {

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... } @args: with lib; let {
container,
lib,
config,
...
}@args:
with lib;
let
cfg = config.container.module.change; cfg = config.container.module.change;
in { in
{
options = { options = {
container.module.change = { container.module.change = {
enable = mkEnableOption "Change detection service"; enable = mkEnableOption "Change detection service";
@ -36,7 +44,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.changedetection-io = { services.changedetection-io = {
enable = true; enable = true;
baseURL = cfg.domain; baseURL = cfg.domain;

View file

@ -1,9 +1,18 @@
{ container, pkgs, lib, config, ... } @args: with lib; let {
container,
pkgs,
lib,
config,
...
}@args:
with lib;
let
cfg = config.container.module.cloud; cfg = config.container.module.cloud;
postgres = config.container.module.postgres; postgres = config.container.module.postgres;
proxy = config.container.module.proxy; proxy = config.container.module.proxy;
in { in
{
options = { options = {
container.module.cloud = { container.module.cloud = {
enable = mkEnableOption "File cloud service"; enable = mkEnableOption "File cloud service";
@ -39,7 +48,9 @@ in {
}; };
}; };
config = { config, ... }: container.mkContainerConfig cfg { config =
{ config, ... }:
container.mkContainerConfig cfg {
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
# package = pkgs.nextcloud29; # package = pkgs.nextcloud29;
@ -62,7 +73,10 @@ in {
}; };
extraAppsEnable = true; extraAppsEnable = true;
settings = { settings = {
trusted_domains = [ cfg.address cfg.domain ]; trusted_domains = [
cfg.address
cfg.domain
];
trusted_proxies = [ proxy.address ]; trusted_proxies = [ proxy.address ];
allow_local_remote_servers = true; allow_local_remote_servers = true;
}; };

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... } @args: with lib; let {
container,
lib,
config,
...
}@args:
with lib;
let
cfg = config.container.module.ddns; cfg = config.container.module.ddns;
in { in
{
options = { options = {
container.module.ddns = { container.module.ddns = {
enable = mkEnableOption "Dynamic dns client."; enable = mkEnableOption "Dynamic dns client.";
@ -28,7 +36,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.cloudflare-dyndns = { services.cloudflare-dyndns = {
enable = true; enable = true;
apiTokenFile = "/data/token"; apiTokenFile = "/data/token";
@ -36,9 +46,12 @@ in {
ipv4 = true; ipv4 = true;
ipv6 = false; ipv6 = false;
proxied = false; proxied = false;
domains = let domains =
let
domain = config.container.domain; domain = config.container.domain;
in [ domain ] ++ map (sub: "${sub}.${domain}") [ in
[ domain ]
++ map (sub: "${sub}.${domain}") [
"cloud" "cloud"
"git" "git"
"mail" "mail"

View file

@ -1,6 +1,16 @@
{ container, pkgs, lib, config, util, ... } @args: with lib; let {
container,
pkgs,
lib,
config,
util,
...
}@args:
with lib;
let
cfg = config.container.module.dns; cfg = config.container.module.dns;
in { in
{
options = { options = {
container.module.dns = { container.module.dns = {
enable = mkEnableOption "Dns server."; enable = mkEnableOption "Dns server.";
@ -17,7 +27,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.dns = container.mkContainer cfg { containers.dns = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ environment.systemPackages = [
pkgs.cloudflared pkgs.cloudflared
]; ];
@ -104,9 +116,11 @@ in {
}; };
}; };
customDNS = { customDNS = {
mapping = let mapping =
let
block = "0.0.0.0"; block = "0.0.0.0";
in { in
{
# All subdomains to current host. # All subdomains to current host.
# ${config.container.domain} = config.container.host; # ${config.container.domain} = config.container.host;
"voronind.com" = "10.0.0.1"; "voronind.com" = "10.0.0.1";
@ -125,4 +139,3 @@ in {
}; };
}; };
} }

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... }: with lib; let {
container,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.download; cfg = config.container.module.download;
in { in
{
options = { options = {
container.module.download = { container.module.download = {
enable = mkEnableOption "Downloader."; enable = mkEnableOption "Downloader.";
@ -42,7 +50,9 @@ in {
}; };
} // container.attachMedia "download" false; } // container.attachMedia "download" false;
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.deluge = { services.deluge = {
enable = true; enable = true;
dataDir = "/var/lib/deluge"; dataDir = "/var/lib/deluge";

View file

@ -1,8 +1,18 @@
# TODO: Saved just in case for the dark future. # TODO: Saved just in case for the dark future.
# в целом просто сделай себе шелл алиас gw-default="sudo ip route del default; sudo ip route add default via айпишник роутера" и шелл алиас gw-vpn="sudo ip route del default; sudo ip route add default via айпишник_впна" # в целом просто сделай себе шелл алиас gw-default="sudo ip route del default; sudo ip route add default via айпишник роутера" и шелл алиас gw-vpn="sudo ip route del default; sudo ip route add default via айпишник_впна"
{ container, pkgs, lib, config, __findFile, ... }: with lib; let {
container,
pkgs,
lib,
config,
__findFile,
...
}:
with lib;
let
cfg = config.container.module.frkn; cfg = config.container.module.frkn;
in { in
{
options = { options = {
container.module.frkn = { container.module.frkn = {
enable = mkEnableOption "FRKN"; enable = mkEnableOption "FRKN";
@ -42,7 +52,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.ipv4.conf.all.src_valid_mark" = 1; "net.ipv4.conf.all.src_valid_mark" = 1;
"net.ipv4.ip_forward" = 1; "net.ipv4.ip_forward" = 1;
@ -68,9 +80,11 @@ in {
tor = { tor = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
settings = let settings =
let
exclude = "{RU},{UA},{BY},{KZ},{CN},{??}"; exclude = "{RU},{UA},{BY},{KZ},{CN},{??}";
in { in
{
# ExcludeExitNodes = exclude; # ExcludeExitNodes = exclude;
# ExcludeNodes = exclude; # ExcludeNodes = exclude;
#DNSPort = dnsport; #DNSPort = dnsport;
@ -102,7 +116,7 @@ in {
}; };
systemd = { systemd = {
services.tor.wantedBy = lib.mkForce []; services.tor.wantedBy = lib.mkForce [ ];
timers.tor = { timers.tor = {
timerConfig = { timerConfig = {

View file

@ -1,6 +1,15 @@
{ container, pkgs, config, lib, ... }: with lib; let {
container,
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.container.module.git; cfg = config.container.module.git;
in { in
{
options = { options = {
container.module.git = { container.module.git = {
enable = mkEnableOption "Git server."; enable = mkEnableOption "Git server.";
@ -40,16 +49,20 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ forgejo ]; environment.systemPackages = with pkgs; [ forgejo ];
services.forgejo = { services.forgejo = {
enable = true; enable = true;
stateDir = "/var/lib/forgejo"; stateDir = "/var/lib/forgejo";
database = let database =
let
postgre = config.container.module.postgres; postgre = config.container.module.postgres;
in { in
{
type = "postgres"; type = "postgres";
host = postgre.address; host = postgre.address;
port = postgre.port; port = postgre.port;
@ -58,10 +71,12 @@ in {
createDatabase = false; createDatabase = false;
}; };
settings = let settings =
let
gcArgs = "--aggressive --no-cruft --prune=now"; gcArgs = "--aggressive --no-cruft --prune=now";
gcTimeout = 600; gcTimeout = 600;
in { in
{
"service".DISABLE_REGISTRATION = true; "service".DISABLE_REGISTRATION = true;
"log".LEVEL = "Error"; "log".LEVEL = "Error";
"server" = { "server" = {

View file

@ -1,7 +1,16 @@
# ISSUE: Broken, can't read/write sda device. # ISSUE: Broken, can't read/write sda device.
{ container, pkgs, config, lib, ... }: with lib; let {
container,
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.container.module.hdd; cfg = config.container.module.hdd;
in { in
{
options = { options = {
container.module.hdd = { container.module.hdd = {
enable = mkEnableOption "Hdd health monitor."; enable = mkEnableOption "Hdd health monitor.";
@ -52,7 +61,9 @@ in {
# additionalCapabilities = [ "CAP_SYS_ADMIN" ]; # additionalCapabilities = [ "CAP_SYS_ADMIN" ];
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ smartmontools ]; environment.systemPackages = with pkgs; [ smartmontools ];
services.scrutiny = { services.scrutiny = {

View file

@ -1,7 +1,18 @@
{ container, pkgs, util, lib, config, __findFile, ... } @args: with lib; let {
container,
pkgs,
util,
lib,
config,
__findFile,
...
}@args:
with lib;
let
cfg = config.container.module.home; cfg = config.container.module.home;
package = (pkgs.callPackage <package/homer> args); package = (pkgs.callPackage <package/homer> args);
in { in
{
options = { options = {
container.module.home = { container.module.home = {
enable = mkEnableOption "Dashboard."; enable = mkEnableOption "Dashboard.";
@ -22,7 +33,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.home = container.mkContainer cfg { containers.home = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ package ]; environment.systemPackages = [ package ];
systemd.packages = [ package ]; systemd.packages = [ package ];

View file

@ -1,6 +1,15 @@
{ container, lib, config, pkgsStable, ... }: with lib; let {
container,
lib,
config,
pkgsStable,
...
}:
with lib;
let
cfg = config.container.module.iot; cfg = config.container.module.iot;
in { in
{
options = { options = {
container.module.iot = { container.module.iot = {
enable = mkEnableOption "IoT service."; enable = mkEnableOption "IoT service.";
@ -51,9 +60,14 @@ in {
} }
]; ];
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
# Allow Hass to talk to Zigbee dongle. # Allow Hass to talk to Zigbee dongle.
users.users.hass.extraGroups = [ "dialout" "tty" ]; users.users.hass.extraGroups = [
"dialout"
"tty"
];
services.home-assistant = { services.home-assistant = {
# NOTE: Missing: hacs. Inside hacs: `card-mod`, `Clock Weather Card`, `WallPanel` and `Yandex.Station`. # NOTE: Missing: hacs. Inside hacs: `card-mod`, `Clock Weather Card`, `WallPanel` and `Yandex.Station`.
@ -65,7 +79,8 @@ in {
"systemmonitor" "systemmonitor"
"zha" "zha"
]; ];
extraPackages = python3Packages: with python3Packages; [ extraPackages =
python3Packages: with python3Packages; [
aiodhcpwatcher aiodhcpwatcher
aiodiscover aiodiscover
aiogithubapi aiogithubapi
@ -95,7 +110,7 @@ in {
# HACK: Delay so that nextcloud calendar can reply on reboot. # HACK: Delay so that nextcloud calendar can reply on reboot.
systemd = { systemd = {
services."home-assistant".wantedBy = mkForce []; services."home-assistant".wantedBy = mkForce [ ];
timers.fixsystemd = { timers.fixsystemd = {
timerConfig = { timerConfig = {
OnBootSec = 15; OnBootSec = 15;

View file

@ -1,7 +1,21 @@
{ container, pkgsJobber, poetry2nixJobber, lib, config, __findFile, ... }: with lib; let {
container,
pkgsJobber,
poetry2nixJobber,
lib,
config,
__findFile,
...
}:
with lib;
let
cfg = config.container.module.jobber; cfg = config.container.module.jobber;
script = import <package/jobber> { poetry2nix = poetry2nixJobber; pkgs = pkgsJobber; }; script = import <package/jobber> {
in { poetry2nix = poetry2nixJobber;
pkgs = pkgsJobber;
};
in
{
options = { options = {
container.module.jobber = { container.module.jobber = {
enable = mkEnableOption "Button pusher Stanley."; enable = mkEnableOption "Button pusher Stanley.";
@ -31,14 +45,19 @@ in {
enableTun = true; enableTun = true;
config = { lib, ... }: let config =
packages = [ script ] ++ (with pkgsJobber; [ { lib, ... }:
let
packages =
[ script ]
++ (with pkgsJobber; [
firefox firefox
geckodriver geckodriver
openvpn openvpn
python311 python311
]); ]);
in container.mkContainerConfig cfg { in
container.mkContainerConfig cfg {
networking = lib.mkForce { networking = lib.mkForce {
nameservers = [ nameservers = [
"10.30.218.2" "10.30.218.2"

View file

@ -1,8 +1,19 @@
# Guide: https://nixos-mailserver.readthedocs.io/en/latest/setup-guide.html # Guide: https://nixos-mailserver.readthedocs.io/en/latest/setup-guide.html
{ container, pkgs, util, const, lib, config, ... }: with lib; let {
container,
pkgs,
util,
const,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.mail; cfg = config.container.module.mail;
domain = config.container.domain; domain = config.container.domain;
in { in
{
options = { options = {
container.module.mail = { container.module.mail = {
enable = mkEnableOption "Email server."; enable = mkEnableOption "Email server.";
@ -58,7 +69,9 @@ in {
}; };
}; };
config = { config, ... }: container.mkContainerConfig cfg { config =
{ config, ... }:
container.mkContainerConfig cfg {
imports = [ imports = [
(builtins.fetchTarball { (builtins.fetchTarball {
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-${const.stateVersion}/nixos-mailserver-nixos-${const.stateVersion}.tar.gz"; url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-${const.stateVersion}/nixos-mailserver-nixos-${const.stateVersion}.tar.gz";
@ -73,9 +86,11 @@ in {
sendingFqdn = domain; sendingFqdn = domain;
# Use `mkpasswd -sm bcrypt`. # Use `mkpasswd -sm bcrypt`.
loginAccounts = let loginAccounts =
let
defaultQuota = "1G"; defaultQuota = "1G";
in { in
{
"admin@${domain}" = { "admin@${domain}" = {
name = "admin"; name = "admin";
hashedPassword = "$2b$05$1O.dxXxaVshcBNybcqDRYuTlnYt3jDBwfPZWoDtP4BjOLoL0StYsi"; hashedPassword = "$2b$05$1O.dxXxaVshcBNybcqDRYuTlnYt3jDBwfPZWoDtP4BjOLoL0StYsi";
@ -173,7 +188,10 @@ in {
services = { services = {
roundcube = { roundcube = {
enable = true; enable = true;
dicts = with pkgs.aspellDicts; [ en ru ]; dicts = with pkgs.aspellDicts; [
en
ru
];
hostName = cfg.domain; hostName = cfg.domain;
plugins = [ plugins = [
"managesieve" "managesieve"

View file

@ -2,9 +2,19 @@
# 1. You need to change PSQL tables owner from root to onlyoffice, too. They don't do that automatically for some reason. # 1. You need to change PSQL tables owner from root to onlyoffice, too. They don't do that automatically for some reason.
# 2. TODO: Generate JWT secret at /var/lib/onlyoffice/jwt, i.e. 9wLfMGha1YrfvWpb5hyYjZf8pvJQ3swS # 2. TODO: Generate JWT secret at /var/lib/onlyoffice/jwt, i.e. 9wLfMGha1YrfvWpb5hyYjZf8pvJQ3swS
# See https://git.voronind.com/voronind/nixos/issues/74 # See https://git.voronind.com/voronind/nixos/issues/74
{ container, pkgs, util, lib, config, ... }: with lib; let {
container,
pkgs,
util,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.office; cfg = config.container.module.office;
in { in
{
options = { options = {
container.module.office = { container.module.office = {
enable = mkEnableOption "Office web suite."; enable = mkEnableOption "Office web suite.";
@ -40,15 +50,19 @@ in {
}; };
}; };
# HACK: Temporarely run in docker due to https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/931 # HACK: Temporarely run in docker due to https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/931
config = { pkgs, ... }: container.mkContainerConfig cfg { config =
{ pkgs, ... }:
container.mkContainerConfig cfg {
virtualisation.oci-containers.backend = "docker"; virtualisation.oci-containers.backend = "docker";
virtualisation.oci-containers.containers.office = { virtualisation.oci-containers.containers.office = {
autoStart = true; autoStart = true;
image = "dockerhub.timeweb.cloud/onlyoffice/documentserver:latest"; image = "dockerhub.timeweb.cloud/onlyoffice/documentserver:latest";
# ports = [ "${toString cfg.port}:8000" ]; # ports = [ "${toString cfg.port}:8000" ];
extraOptions = [ "--network=host" "--privileged" ]; extraOptions = [
"--network=host"
"--privileged"
];
environment = { environment = {
JWT_ENABLED = "true"; JWT_ENABLED = "true";
JWT_SECRET = "8wLfKGha8YRfvwpB5hYYjZf8vtUQs3wS"; JWT_SECRET = "8wLfKGha8YRfvwpB5hYYjZf8vtUQs3wS";

View file

@ -1,6 +1,16 @@
{ container, pkgs, pkgsStable, lib, config, ... }: with lib; let {
container,
pkgs,
pkgsStable,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.paper; cfg = config.container.module.paper;
in { in
{
options = { options = {
container.module.paper = { container.module.paper = {
enable = mkEnableOption "Paper scans manager."; enable = mkEnableOption "Paper scans manager.";
@ -40,7 +50,9 @@ in {
}; };
}; };
config = { lib, ... }: container.mkContainerConfig cfg { config =
{ lib, ... }:
container.mkContainerConfig cfg {
services.paperless = { services.paperless = {
enable = true; enable = true;
dataDir = "/var/lib/paperless"; dataDir = "/var/lib/paperless";
@ -69,17 +81,17 @@ in {
services = { services = {
paperless-scheduler = { paperless-scheduler = {
serviceConfig.PrivateNetwork = mkForce false; serviceConfig.PrivateNetwork = mkForce false;
wantedBy = mkForce []; wantedBy = mkForce [ ];
}; };
paperless-consumer = { paperless-consumer = {
serviceConfig.PrivateNetwork = mkForce false; serviceConfig.PrivateNetwork = mkForce false;
wantedBy = mkForce []; wantedBy = mkForce [ ];
}; };
paperless-web = { paperless-web = {
wantedBy = mkForce []; wantedBy = mkForce [ ];
}; };
paperless-task-queue = { paperless-task-queue = {
wantedBy = mkForce []; wantedBy = mkForce [ ];
}; };
}; };
timers.fixsystemd = { timers.fixsystemd = {

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... }: with lib; let {
container,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.pass; cfg = config.container.module.pass;
in { in
{
options = { options = {
container.module.pass = { container.module.pass = {
enable = mkEnableOption "Password manager"; enable = mkEnableOption "Password manager";
@ -36,7 +44,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.vaultwarden = { services.vaultwarden = {
enable = true; enable = true;
dbBackend = "sqlite"; dbBackend = "sqlite";

View file

@ -1,7 +1,17 @@
{ pkgs, util, container, lib, config, __findFile, ... } @args: with lib; let {
pkgs,
container,
lib,
config,
__findFile,
...
}@args:
with lib;
let
cfg = config.container.module.paste; cfg = config.container.module.paste;
package = (pkgs.callPackage <package/privatebin> args); package = (pkgs.callPackage <package/privatebin> args);
in { in
{
options = { options = {
container.module.paste = { container.module.paste = {
enable = mkEnableOption "Pastebin."; enable = mkEnableOption "Pastebin.";
@ -52,7 +62,9 @@ in {
}; };
}; };
config = { config, ... }: container.mkContainerConfig cfg { config =
{ config, ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ package ]; environment.systemPackages = [ package ];
systemd.packages = [ package ]; systemd.packages = [ package ];
@ -96,14 +108,14 @@ in {
rewrite ^ /index.php; rewrite ^ /index.php;
''; '';
"~ \\.php$".extraConfig = util.trimTabs '' "~ \\.php$".extraConfig = ''
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:${config.services.phpfpm.pools.paste.socket}; fastcgi_pass unix:${config.services.phpfpm.pools.paste.socket};
include ${config.services.nginx.package}/conf/fastcgi.conf; include ${config.services.nginx.package}/conf/fastcgi.conf;
include ${config.services.nginx.package}/conf/fastcgi_params; include ${config.services.nginx.package}/conf/fastcgi_params;
''; '';
"~ \\.(js|css|ttf|woff2?|png|jpe?g|svg)$".extraConfig = util.trimTabs '' "~ \\.(js|css|ttf|woff2?|png|jpe?g|svg)$".extraConfig = ''
add_header Cache-Control "public, max-age=15778463"; add_header Cache-Control "public, max-age=15778463";
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
@ -115,7 +127,7 @@ in {
''; '';
}; };
extraConfig = util.trimTabs '' extraConfig = ''
try_files $uri /index.php; try_files $uri /index.php;
''; '';
}; };

View file

@ -1,6 +1,15 @@
{ container, lib, pkgs, config, ... }: with lib; let {
container,
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.container.module.postgres; cfg = config.container.module.postgres;
in { in
{
options = { options = {
container.module.postgres = { container.module.postgres = {
enable = mkEnableOption "Postgresql server."; enable = mkEnableOption "Postgresql server.";
@ -32,8 +41,11 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
services.postgresql = let { ... }:
container.mkContainerConfig cfg {
services.postgresql =
let
# Populate with services here. # Populate with services here.
configurations = with config.container.module; { configurations = with config.container.module; {
forgejo = git; forgejo = git;
@ -45,7 +57,9 @@ in {
}; };
access = configurations // { access = configurations // {
all = { address = config.container.host; }; all = {
address = config.container.host;
};
}; };
authentication = builtins.foldl' (acc: item: acc + "${item}\n") "" ( authentication = builtins.foldl' (acc: item: acc + "${item}\n") "" (
@ -56,14 +70,19 @@ in {
ensureUsers = map (name: { ensureUsers = map (name: {
inherit name; inherit name;
ensureClauses = if name == "root" then { ensureClauses =
if name == "root" then
{
superuser = true; superuser = true;
createrole = true; createrole = true;
createdb = true; createdb = true;
} else {}; }
else
{ };
ensureDBOwnership = true; ensureDBOwnership = true;
}) ensureDatabases; }) ensureDatabases;
in { in
{
inherit authentication ensureDatabases ensureUsers; inherit authentication ensureDatabases ensureUsers;
enable = true; enable = true;

View file

@ -2,11 +2,21 @@
# ipp://192.168.2.237 # ipp://192.168.2.237
# Pantum M6500W-Series # Pantum M6500W-Series
{ container, pkgs, lib, config, __findFile, ... } @args: with lib; let {
container,
pkgs,
lib,
config,
__findFile,
...
}@args:
with lib;
let
cfg = config.container.module.print; cfg = config.container.module.print;
package = pkgs.callPackage <package/print> args; package = pkgs.callPackage <package/print> args;
host = config.container.host; host = config.container.host;
in { in
{
options = { options = {
container.module.print = { container.module.print = {
enable = mkEnableOption "Printing server."; enable = mkEnableOption "Printing server.";
@ -42,12 +52,16 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
networking.interfaces."eth0".ipv4.routes = [{ { ... }:
container.mkContainerConfig cfg {
networking.interfaces."eth0".ipv4.routes = [
{
address = "192.168.2.237"; address = "192.168.2.237";
prefixLength = 32; prefixLength = 32;
via = host; via = host;
}]; }
];
services.printing = { services.printing = {
enable = true; enable = true;
@ -64,4 +78,3 @@ in {
}; };
}; };
} }

View file

@ -9,10 +9,20 @@
# ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384"; # ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
# ``` # ```
# For certbot to generate new keys: `certbot certonly --manual --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory -d "*.voronind.com" -d voronind.com` # For certbot to generate new keys: `certbot certonly --manual --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory -d "*.voronind.com" -d voronind.com`
{ util, container, pkgs, lib, config, ... } @args: with lib; let {
util,
container,
pkgs,
lib,
config,
...
}@args:
with lib;
let
cfg = config.container.module.proxy; cfg = config.container.module.proxy;
virtualHosts = util.catSet (util.ls ./proxy/host) args; virtualHosts = util.catSet (util.ls ./proxy/host) args;
in { in
{
options = { options = {
container.module.proxy = { container.module.proxy = {
enable = mkEnableOption "Proxy server."; enable = mkEnableOption "Proxy server.";
@ -49,7 +59,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ certbot ]; environment.systemPackages = with pkgs; [ certbot ];
services.nginx = { services.nginx = {
@ -59,14 +71,14 @@ in {
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedProxySettings = true; recommendedProxySettings = true;
clientMaxBodySize = "4096m"; clientMaxBodySize = "4096m";
appendConfig = util.trimTabs '' appendConfig = ''
worker_processes 4; worker_processes 4;
''; '';
eventsConfig = util.trimTabs '' eventsConfig = ''
worker_connections 4096; worker_connections 4096;
''; '';
# TODO: Fix 80 redirect and 403 default. # TODO: Fix 80 redirect and 403 default.
appendHttpConfig = util.trimTabs '' appendHttpConfig = ''
proxy_max_temp_file_size 0; proxy_max_temp_file_size 0;
proxy_buffering off; proxy_buffering off;

View file

@ -1,6 +1,16 @@
{ container, pkgs, util, lib, config, ... }: with lib; let {
container,
pkgs,
util,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.rabbitmq; cfg = config.container.module.rabbitmq;
in { in
{
options = { options = {
container.module.rabbitmq = { container.module.rabbitmq = {
enable = mkEnableOption "Mqtt server."; enable = mkEnableOption "Mqtt server.";
@ -32,7 +42,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.rabbitmq = { services.rabbitmq = {
enable = true; enable = true;
listenAddress = cfg.address; listenAddress = cfg.address;

View file

@ -1,6 +1,15 @@
{ container, lib, pkgs, config, ... }: with lib; let {
container,
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.container.module.read; cfg = config.container.module.read;
in { in
{
options = { options = {
container.module.read = { container.module.read = {
enable = mkEnableOption "Reading server."; enable = mkEnableOption "Reading server.";
@ -34,12 +43,11 @@ in {
hostPath = "${cfg.storage}/data"; hostPath = "${cfg.storage}/data";
isReadOnly = false; isReadOnly = false;
}; };
} } // container.attachMedia "book" true // container.attachMedia "manga" true;
// container.attachMedia "book" true
// container.attachMedia "manga" true
;
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.kavita = { services.kavita = {
enable = true; enable = true;
dataDir = "/var/lib/kavita"; dataDir = "/var/lib/kavita";

View file

@ -1,6 +1,16 @@
{ container, pkgs, util, lib, config, ... }: with lib; let {
container,
pkgs,
util,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.redis; cfg = config.container.module.redis;
in { in
{
options = { options = {
container.module.redis = { container.module.redis = {
enable = mkEnableOption "Redis server."; enable = mkEnableOption "Redis server.";
@ -17,7 +27,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.redis = container.mkContainer cfg { containers.redis = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.redis.servers.main = { services.redis.servers.main = {
enable = true; enable = true;
port = cfg.port; port = cfg.port;
@ -28,4 +40,3 @@ in {
}; };
}; };
} }

View file

@ -1,6 +1,15 @@
{ container, pkgs, lib, config, ... }: with lib; let {
container,
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.search; cfg = config.container.module.search;
in { in
{
options = { options = {
container.module.search = { container.module.search = {
enable = mkEnableOption "Search frontend."; enable = mkEnableOption "Search frontend.";
@ -25,7 +34,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.search = container.mkContainer cfg { containers.search = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.searx = { services.searx = {
enable = true; enable = true;
package = pkgs.searxng; package = pkgs.searxng;

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... }: with lib; let {
container,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.status; cfg = config.container.module.status;
in { in
{
options = { options = {
container.module.status = { container.module.status = {
enable = mkEnableOption "Status monitor."; enable = mkEnableOption "Status monitor.";
@ -36,7 +44,9 @@ in {
}; };
}; };
config = { lib, ... }: container.mkContainerConfig cfg { config =
{ lib, ... }:
container.mkContainerConfig cfg {
networking = { networking = {
nameservers = mkForce [ nameservers = mkForce [
config.container.module.dns.address config.container.module.dns.address
@ -59,4 +69,3 @@ in {
}; };
}; };
} }

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... }: with lib; let {
container,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.stock; cfg = config.container.module.stock;
in { in
{
options = { options = {
container.module.stock = { container.module.stock = {
enable = mkEnableOption "Stock management."; enable = mkEnableOption "Stock management.";
@ -36,7 +44,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.grocy = { services.grocy = {
enable = true; enable = true;
dataDir = "/var/lib/grocy"; dataDir = "/var/lib/grocy";

View file

@ -1,20 +1,31 @@
{ container, pkgs, lib, config, ... }: with lib; let {
container,
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.vpn; cfg = config.container.module.vpn;
wireguardPeers = let wireguardPeers =
let
mkPeer = name: ip: PublicKey: { mkPeer = name: ip: PublicKey: {
inherit PublicKey; inherit PublicKey;
PresharedKeyFile = "/var/lib/wireguard/preshared/${name}"; PresharedKeyFile = "/var/lib/wireguard/preshared/${name}";
AllowedIPs = [ "${ip}/32" ]; AllowedIPs = [ "${ip}/32" ];
}; };
in [ in
[
(mkPeer "dashaphone" "10.1.1.3" "O/3y8+QKEY8UoLVlmbc8xdhs248L4wtQcl1MsBBfoQo=") (mkPeer "dashaphone" "10.1.1.3" "O/3y8+QKEY8UoLVlmbc8xdhs248L4wtQcl1MsBBfoQo=")
(mkPeer "laptop" "10.1.1.9" "xxoCNPSB86zs8L8p+wXhqaIwpNDkiZu1Yjv8sj8XhgY=") (mkPeer "laptop" "10.1.1.9" "xxoCNPSB86zs8L8p+wXhqaIwpNDkiZu1Yjv8sj8XhgY=")
(mkPeer "phone" "10.1.1.5" "bFmFisMqbDpIrAg3o/GiRl9XhceZEVnZtkegZDTL4yg=") (mkPeer "phone" "10.1.1.5" "bFmFisMqbDpIrAg3o/GiRl9XhceZEVnZtkegZDTL4yg=")
(mkPeer "tablet" "10.1.1.6" "BdslswVc9OgUpEhJd0sugDBmYw44DiS0FbUPT5EjOG0=") (mkPeer "tablet" "10.1.1.6" "BdslswVc9OgUpEhJd0sugDBmYw44DiS0FbUPT5EjOG0=")
(mkPeer "work" "10.1.1.2" "Pk0AASSInKO9O8RaQEmm1uNrl0cwWTJDcT8rLn7PSA0=") (mkPeer "work" "10.1.1.2" "Pk0AASSInKO9O8RaQEmm1uNrl0cwWTJDcT8rLn7PSA0=")
]; ];
in { in
{
options = { options = {
container.module.vpn = { container.module.vpn = {
enable = mkEnableOption "Vpn server."; enable = mkEnableOption "Vpn server.";
@ -47,7 +58,9 @@ in {
}; };
}; };
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.ipv4.conf.all.src_valid_mark" = 1; "net.ipv4.conf.all.src_valid_mark" = 1;
"net.ipv4.ip_forward" = 1; "net.ipv4.ip_forward" = 1;
@ -74,7 +87,7 @@ in {
networks.wg0 = { networks.wg0 = {
matchConfig.Name = "wg0"; matchConfig.Name = "wg0";
address = ["10.1.1.0/24"]; address = [ "10.1.1.0/24" ];
networkConfig = { networkConfig = {
IPv4Forwarding = "yes"; IPv4Forwarding = "yes";
IPMasquerade = "ipv4"; IPMasquerade = "ipv4";
@ -85,4 +98,3 @@ in {
}; };
}; };
} }

View file

@ -1,6 +1,14 @@
{ container, lib, config, ... }: with lib; let {
container,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.watch; cfg = config.container.module.watch;
in { in
{
options = { options = {
container.module.watch = { container.module.watch = {
enable = mkEnableOption "Media server."; enable = mkEnableOption "Media server.";
@ -34,7 +42,8 @@ in {
]; ];
containers.watch = container.mkContainer cfg { containers.watch = container.mkContainer cfg {
bindMounts = { bindMounts =
{
"/var/lib/jellyfin" = { "/var/lib/jellyfin" = {
hostPath = "${cfg.storage}/data"; hostPath = "${cfg.storage}/data";
isReadOnly = false; isReadOnly = false;
@ -57,8 +66,7 @@ in {
// container.attachMedia "show" true // container.attachMedia "show" true
// container.attachMedia "study" true // container.attachMedia "study" true
// container.attachMedia "work" true // container.attachMedia "work" true
// container.attachMedia "youtube" true // container.attachMedia "youtube" true;
;
allowedDevices = [ allowedDevices = [
{ {
@ -67,7 +75,9 @@ in {
} }
]; ];
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
# users.users.jellyfin.extraGroups = [ # users.users.jellyfin.extraGroups = [
# "video" # "video"
# "render" # "render"

View file

@ -1,6 +1,16 @@
{ container, pkgs, lib, config, __findFile, ... }: with lib; let {
container,
pkgs,
lib,
config,
__findFile,
...
}:
with lib;
let
cfg = config.container.module.yt; cfg = config.container.module.yt;
in { in
{
options = { options = {
container.module.yt = { container.module.yt = {
enable = mkEnableOption "YouTube frontend."; enable = mkEnableOption "YouTube frontend.";
@ -25,7 +35,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.yt = container.mkContainer cfg { containers.yt = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg { config =
{ ... }:
container.mkContainerConfig cfg {
services.invidious = { services.invidious = {
enable = true; enable = true;
domain = cfg.domain; domain = cfg.domain;

View file

@ -1,6 +1,9 @@
{ lib, config, ... }: with lib; let { lib, config, ... }:
with lib;
let
cfg = config.container; cfg = config.container;
in { in
{
options = { options = {
container = { container = {
enable = mkEnableOption "Containers!!"; enable = mkEnableOption "Containers!!";
@ -36,7 +39,7 @@ in {
}; };
media = mkOption { media = mkOption {
default = {}; default = { };
type = types.attrs; type = types.attrs;
}; };
}; };

View file

@ -1,10 +1,16 @@
{ util, config, lib, container, ... }: let {
config,
container,
...
}:
let
domain = "camera.${config.container.domain}"; domain = "camera.${config.container.domain}";
address = "192.168.2.249"; address = "192.168.2.249";
port = 554; port = 554;
in { in
{
${domain} = container.mkServer { ${domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
location / { location / {

View file

@ -1,9 +1,11 @@
{ util, config, container, ... }: let { config, container, ... }:
let
cfg = config.container.module.change; cfg = config.container.module.change;
name = "change"; name = "change";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, config, container, ... }: let { config, container, ... }:
let
cfg = config.container.module.cloud; cfg = config.container.module.cloud;
name = "cloud"; name = "cloud";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};
@ -27,4 +29,3 @@ in {
''; '';
}; };
} }

View file

@ -1,9 +1,11 @@
{ util, config, container, ... }: let { config, container, ... }:
let
cfg = config.container.module.download; cfg = config.container.module.download;
name = "download"; name = "download";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.git; cfg = config.container.module.git;
name = "git"; name = "git";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,15 @@
{ util, container, config, ... }: let {
container,
config,
...
}:
let
cfg = config.container.module.hdd; cfg = config.container.module.hdd;
name = "hdd"; name = "hdd";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,15 @@
{ util, config, container, ... }: let {
config,
container,
...
}:
let
cfg = config.container.module.home; cfg = config.container.module.home;
name = "home"; name = "home";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,15 @@
{ util, container, config, ... }: let {
container,
config,
...
}:
let
cfg = config.container.module.iot; cfg = config.container.module.iot;
name = "iot"; name = "iot";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.mail; cfg = config.container.module.mail;
name = "mail"; name = "mail";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.office; cfg = config.container.module.office;
name = "office"; name = "office";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.paper; cfg = config.container.module.paper;
name = "paper"; name = "paper";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.pass; cfg = config.container.module.pass;
name = "pass"; name = "pass";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.paste; cfg = config.container.module.paste;
name = "paste"; name = "paste";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.print; cfg = config.container.module.print;
name = "print"; name = "print";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,11 +1,13 @@
{ util, container, config, ... }: let { container, config, ... }:
let
address = "192.168.2.237"; address = "192.168.2.237";
domain = "printer.${config.container.domain}"; domain = "printer.${config.container.domain}";
port = 80; port = 80;
name = "printer"; name = "printer";
in { in
{
${domain} = container.mkServer { ${domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${address}:${toString port}; set ''$${name} ${address}:${toString port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.read; cfg = config.container.module.read;
name = "read"; name = "read";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,11 +1,13 @@
{ util, container, config, ... }: let { container, config, ... }:
let
address = "10.0.0.2"; address = "10.0.0.2";
domain = "router.${config.container.domain}"; domain = "router.${config.container.domain}";
port = 80; port = 80;
name = "router"; name = "router";
in { in
{
${domain} = container.mkServer { ${domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${address}:${toString port}; set ''$${name} ${address}:${toString port};
@ -25,4 +27,3 @@ in {
''; '';
}; };
} }

View file

@ -1,9 +1,15 @@
{ util, container, config, ... }: let {
container,
config,
...
}:
let
cfg = config.container.module.search; cfg = config.container.module.search;
name = "search"; name = "search";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.status; cfg = config.container.module.status;
name = "sstatus"; name = "sstatus";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.stock; cfg = config.container.module.stock;
name = "stock"; name = "stock";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.watch; cfg = config.container.module.watch;
name = "watch"; name = "watch";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let { container, config, ... }:
let
cfg = config.container.module.yt; cfg = config.container.module.yt;
name = "yt"; name = "yt";
in { in
{
${cfg.domain} = container.mkServer { ${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs '' extraConfig = ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

109
flake.nix
View file

@ -116,7 +116,20 @@
# Here you see a set of inputs we defined above, like nixpkgs, home-manager and so on. # Here you see a set of inputs we defined above, like nixpkgs, home-manager and so on.
# `...` at the end of a set means "ignore other arguments provided to this function". # `...` at the end of a set means "ignore other arguments provided to this function".
# @inputs means aliasing all the inputs to the `inputs` name, so we can pass them all at once later. # @inputs means aliasing all the inputs to the `inputs` name, so we can pass them all at once later.
outputs = { self, nixpkgs, nixpkgsStable, nixpkgsMaster, nix-on-droid, home-manager, stylix, poetry2nixJobber, nixpkgsJobber, ... } @inputs: { outputs =
{
self,
nixpkgs,
nixpkgsStable,
nixpkgsMaster,
nix-on-droid,
home-manager,
stylix,
poetry2nixJobber,
nixpkgsJobber,
...
}@inputs:
{
# Constant values. # Constant values.
const = { const = {
droidStateVersion = "23.11"; droidStateVersion = "23.11";
@ -130,21 +143,27 @@
__findFile = _: p: ./${p}; __findFile = _: p: ./${p};
# List all files in a dir. # List all files in a dir.
findFiles = path: map (f: "${path}/${f}") ( findFiles =
path:
map (f: "${path}/${f}") (
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") ( builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
builtins.attrNames (builtins.readDir path) builtins.attrNames (builtins.readDir path)
) )
); );
# Dev shell for this repo. # Dev shell for this repo.
devShells = let devShells =
let
system = "x86_64-linux"; system = "x86_64-linux";
lib = nixpkgs.lib; lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in
{
${system}.default = pkgs.mkShell { ${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
nixd nixd
nixfmt-rfc-style
treefmt
]; ];
# buildInputs = with pkgs; [ ]; # buildInputs = with pkgs; [ ];
@ -154,15 +173,19 @@
}; };
# Nixos systems. # Nixos systems.
nixosConfigurations = let nixosConfigurations =
let
# Function to create a host. It does basic setup, like adding common modules. # Function to create a host. It does basic setup, like adding common modules.
mkHost = { system, hostname }: nixpkgs.lib.nixosSystem { mkHost =
{ system, hostname }:
nixpkgs.lib.nixosSystem {
# `Inherit` is just an alias for `system = system;`, which means that # `Inherit` is just an alias for `system = system;`, which means that
# keep the `system` argument as a property in a resulting set. # keep the `system` argument as a property in a resulting set.
inherit system; inherit system;
# List of modules to use by defualt for all the hosts. # List of modules to use by defualt for all the hosts.
modules = [ modules =
[
# Make a device hostname match the one from this config. # Make a device hostname match the one from this config.
{ networking.hostName = hostname; } { networking.hostName = hostname; }
@ -186,11 +209,13 @@
++ (self.findFiles ./overlay); ++ (self.findFiles ./overlay);
# SpecialArgs allows you to pass objects down to other NixOS modules. # SpecialArgs allows you to pass objects down to other NixOS modules.
specialArgs = let specialArgs =
let
pkgs = nixpkgs.legacyPackages.${system}.pkgs; pkgs = nixpkgs.legacyPackages.${system}.pkgs;
lib = nixpkgs.lib; lib = nixpkgs.lib;
config = self.nixosConfigurations.${hostname}.config; config = self.nixosConfigurations.${hostname}.config;
in { in
{
inherit inputs self; inherit inputs self;
inherit (self) const __findFile; inherit (self) const __findFile;
@ -198,8 +223,11 @@
pkgsStable = nixpkgsStable.legacyPackages.${system}.pkgs; pkgsStable = nixpkgsStable.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs; pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
secret = import ./secret {}; # Secrets (public keys). secret = import ./secret { }; # Secrets (public keys).
container = import ./lib/Container.nix { inherit lib pkgs config; inherit (self) const; }; # Container utils. container = import ./lib/Container.nix {
inherit lib pkgs config;
inherit (self) const;
}; # Container utils.
util = import ./lib/Util.nix { inherit lib; }; # Util functions. util = import ./lib/Util.nix { inherit lib; }; # Util functions.
# Stuff for Jobber container, skip this part. # Stuff for Jobber container, skip this part.
@ -212,17 +240,16 @@
inherit system hostname; inherit system hostname;
}; };
}; };
in nixpkgs.lib.foldl' (acc: h: acc // h) {} ( in
map (system: nixpkgs.lib.foldl' (acc: h: acc // h) { } (
nixpkgs.lib.foldl' (acc: h: acc // h) {} ( map (
map (host: system:
mkSystem system host nixpkgs.lib.foldl' (acc: h: acc // h) { } (
) (builtins.attrNames (builtins.readDir ./host/${system})) map (host: mkSystem system host) (builtins.attrNames (builtins.readDir ./host/${system}))
) )
) (builtins.attrNames (builtins.readDir ./host)) ) (builtins.attrNames (builtins.readDir ./host))
); );
# Home manager (distro-independent). # Home manager (distro-independent).
# Install nix: sh <(curl -L https://nixos.org/nix/install) --no-daemon # Install nix: sh <(curl -L https://nixos.org/nix/install) --no-daemon
# Or with --daemon for multi-user (as root). # Or with --daemon for multi-user (as root).
@ -231,21 +258,33 @@
# Add to /etc/nix/nix.conf > experimental-features = nix-command flakes # Add to /etc/nix/nix.conf > experimental-features = nix-command flakes
# And then # systemctl restart nix-daemon.service # And then # systemctl restart nix-daemon.service
# $ home-manager switch --flake ~/hmconf # $ home-manager switch --flake ~/hmconf
homeConfigurations = let homeConfigurations =
let
lib = nixpkgs.lib; lib = nixpkgs.lib;
secret = import ./secret {}; secret = import ./secret { };
util = import ./lib/Util.nix { inherit lib; }; util = import ./lib/Util.nix { inherit lib; };
mkCommonHome = username: homeDirectory: system: modules: let mkCommonHome =
username: homeDirectory: system: modules:
let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
pkgsStable = nixpkgsStable.legacyPackages.${system}; pkgsStable = nixpkgsStable.legacyPackages.${system};
pkgsMaster = nixpkgsMaster.legacyPackages.${system}; pkgsMaster = nixpkgsMaster.legacyPackages.${system};
in { in
{
${username} = home-manager.lib.homeManagerConfiguration { ${username} = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
extraSpecialArgs = { extraSpecialArgs = {
inherit self inputs secret util pkgs pkgsStable pkgsMaster; inherit
self
inputs
secret
util
pkgs
pkgsStable
pkgsMaster
;
inherit (self) const __findFile; inherit (self) const __findFile;
}; };
modules = [ modules = [
@ -263,18 +302,22 @@
{ nixpkgs.config.allowUnfree = true; } { nixpkgs.config.allowUnfree = true; }
{ nixpkgs.config.allowUnfreePredicate = (pkg: true); } { nixpkgs.config.allowUnfreePredicate = (pkg: true); }
{ nix.package = pkgs.nix; } { nix.package = pkgs.nix; }
{ nix.settings.experimental-features = [ "nix-command " "flakes" ]; } {
nix.settings.experimental-features = [
"nix-command "
"flakes"
];
}
inputs.stylix.homeManagerModules.stylix inputs.stylix.homeManagerModules.stylix
] ] ++ modules ++ (self.findFiles ./config);
++ modules
++ (self.findFiles ./config);
}; };
}; };
x86LinuxHome = username: modules: mkCommonHome username "/home/${username}" "x86_64-linux" modules; x86LinuxHome = username: modules: mkCommonHome username "/home/${username}" "x86_64-linux" modules;
x86LinuxRoot = mkCommonHome "root" "/root" "x86_64-linux" []; x86LinuxRoot = mkCommonHome "root" "/root" "x86_64-linux" [ ];
in nixpkgs.lib.foldl' (acc: h: acc // h) {} [ in
nixpkgs.lib.foldl' (acc: h: acc // h) { } [
x86LinuxRoot x86LinuxRoot
(x86LinuxHome "voronind" [ (x86LinuxHome "voronind" [
{ {
@ -286,11 +329,13 @@
]; ];
# Android. # Android.
nixOnDroidConfigurations.default = let nixOnDroidConfigurations.default =
let
config = self.nixOnDroidConfigurations.default.config; config = self.nixOnDroidConfigurations.default.config;
lib = nixpkgs.lib; lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs; pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
in nix-on-droid.lib.nixOnDroidConfiguration { in
nix-on-droid.lib.nixOnDroidConfiguration {
modules = [ modules = [
# Android release version. # Android release version.
{ system.stateVersion = self.const.droidStateVersion; } { system.stateVersion = self.const.droidStateVersion; }
@ -319,7 +364,7 @@
inherit inputs self; inherit inputs self;
inherit (self) const __findFile; inherit (self) const __findFile;
secret = import ./secret {}; # Secrets (public keys). secret = import ./secret { }; # Secrets (public keys).
util = import ./lib/Util.nix { inherit lib; }; # Util functions. util = import ./lib/Util.nix { inherit lib; }; # Util functions.
}; };
}; };

View file

@ -1,20 +1,25 @@
# This is a common user configuration. # This is a common user configuration.
{ const {
, pkgs const,
, self pkgs,
, config self,
, lib config,
, inputs lib,
, pkgsStable inputs,
, pkgsMaster pkgsStable,
, __findFile pkgsMaster,
, ... } @args: with lib; let __findFile,
...
}@args:
with lib;
let
cfg = config.home.android; cfg = config.home.android;
stylix = import <config/Stylix.nix> args; stylix = import <config/Stylix.nix> args;
android = import ./android args; android = import ./android args;
package = import <package> args; package = import <package> args;
# homePath = "/data/data/com.termux.nix/files/home"; in
in { # homePath = "/data/data/com.termux.nix/files/home";
{
options = { options = {
home.android = { home.android = {
enable = mkEnableOption "Android HM config."; enable = mkEnableOption "Android HM config.";

View file

@ -1,13 +1,18 @@
# This is a common user configuration. # This is a common user configuration.
{ const {
, util const,
, config util,
, lib config,
, __findFile lib,
, ... } @args: with lib; let __findFile,
...
}@args:
with lib;
let
cfg = config.home.hm; cfg = config.home.hm;
package = import <package> args; package = import <package> args;
in { in
{
options = { options = {
home.hm = { home.hm = {
enable = mkEnableOption "Home-Manager standalone config."; enable = mkEnableOption "Home-Manager standalone config.";
@ -20,7 +25,7 @@ in {
type = types.str; type = types.str;
}; };
package = mkOption { package = mkOption {
default = {}; default = { };
type = types.submodule { type = types.submodule {
options = { options = {
common.enable = mkEnableOption "Common apps."; common.enable = mkEnableOption "Common apps.";

View file

@ -1,19 +1,24 @@
# This is a common user configuration. # This is a common user configuration.
{ const {
, config const,
, util config,
, lib util,
, pkgs lib,
, ... } @args: with lib; let pkgs,
...
}@args:
with lib;
let
cfg = config.home.nixos; cfg = config.home.nixos;
in { in
{
imports = (util.ls ./user); imports = (util.ls ./user);
options = { options = {
home.nixos = { home.nixos = {
enable = mkEnableOption "NixOS user setup."; enable = mkEnableOption "NixOS user setup.";
users = mkOption { users = mkOption {
default = []; default = [ ];
type = types.listOf types.attrs; type = types.listOf types.attrs;
}; };
}; };
@ -21,7 +26,10 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager = { home-manager = {
users = builtins.foldl' (acc: user: acc // { users = builtins.foldl' (
acc: user:
acc
// {
${user.username} = { ${user.username} = {
home = { home = {
inherit (const) stateVersion; inherit (const) stateVersion;
@ -36,7 +44,8 @@ in {
programs = import ./program args; programs = import ./program args;
dconf.settings = util.catSet (util.ls ./config/dconf) args; dconf.settings = util.catSet (util.ls ./config/dconf) args;
}; };
}) {} cfg.users; }
) { } cfg.users;
backupFileExtension = "old"; backupFileExtension = "old";
}; };

View file

@ -1,9 +1,12 @@
{ pkgs, util, config, ... }: { { pkgs, config, ... }:
font = pkgs.runCommandNoCC "font" {} '' {
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out font = pkgs.runCommandNoCC "font" { } ''
cp ${
pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }
}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
''; '';
colors = util.trimTabs '' colors = ''
background=#${config.style.color.bg.dark} background=#${config.style.color.bg.dark}
foreground=#${config.style.color.fg.light} foreground=#${config.style.color.fg.light}
''; '';

View file

@ -1,5 +1,6 @@
{ config, util, ... }: { { ... }:
text = util.trimTabs '' {
text = ''
#? Config file for btop v. 1.3.0 #? Config file for btop v. 1.3.0
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. #* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/desktop/a11y" = { "org/gnome/desktop/a11y" = {
always-show-universal-access-status = true; always-show-universal-access-status = true;
}; };

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gtk/gtk4/settings/file-chooser" = { "org/gtk/gtk4/settings/file-chooser" = {
date-format = "regular"; date-format = "regular";
location-mode = "path-bar"; location-mode = "path-bar";

View file

@ -1,10 +1,29 @@
{ lib, config, ... }: { { lib, config, ... }:
{
"org/gnome/desktop/input-sources" = with lib.gvariant; { "org/gnome/desktop/input-sources" = with lib.gvariant; {
current = mkUint32 0; current = mkUint32 0;
mru-sources = [ (mkTuple [ "xkb" "us" ]) (mkTuple [ "xkb" "ru" ]) ]; mru-sources = [
(mkTuple [
"xkb"
"us"
])
(mkTuple [
"xkb"
"ru"
])
];
per-window = false; per-window = false;
show-all-sources = true; show-all-sources = true;
sources = [ (mkTuple [ "xkb" "us" ]) (mkTuple [ "xkb" "ru" ]) ]; sources = [
(mkTuple [
"xkb"
"us"
])
(mkTuple [
"xkb"
"ru"
])
];
xkb-options = [ config.setting.keyboard.options ]; xkb-options = [ config.setting.keyboard.options ];
}; };

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/desktop/interface" = { "org/gnome/desktop/interface" = {
clock-show-date = true; clock-show-date = true;
clock-show-weekday = true; clock-show-weekday = true;

View file

@ -1,6 +1,8 @@
{ config, ... }: let { config, ... }:
let
mod = "<Super>"; mod = "<Super>";
in { in
{
"org/gnome/desktop/wm/keybindings" = { "org/gnome/desktop/wm/keybindings" = {
activate-window-menu = [ "" ]; activate-window-menu = [ "" ];
begin-move = [ "" ]; begin-move = [ "" ];

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/desktop/media-handling" = { "org/gnome/desktop/media-handling" = {
automount = false; automount = false;
automount-open = false; automount-open = false;

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/nautilus/icon-view" = { "org/gnome/nautilus/icon-view" = {
default-zoom-level = "larger"; default-zoom-level = "larger";
}; };

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/settings-daemon/plugins/power" = { "org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false; ambient-enabled = false;
idle-dim = false; idle-dim = false;

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
"org/gnome/desktop/privacy" = with lib.gvariant; { "org/gnome/desktop/privacy" = with lib.gvariant; {
disable-camera = false; disable-camera = false;
disable-microphone = false; disable-microphone = false;

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
"org/gnome/desktop/session" = with lib.gvariant; { "org/gnome/desktop/session" = with lib.gvariant; {
idle-delay = mkUint32 0; idle-delay = mkUint32 0;
}; };

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/shell" = { "org/gnome/shell" = {
disable-extension-version-validation = true; disable-extension-version-validation = true;
disable-user-extensions = false; disable-user-extensions = false;

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/software" = { "org/gnome/software" = {
download-updates = false; download-updates = false;
download-updates-notify = false; download-updates-notify = false;

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
"org/gnome/desktop/sound" = { "org/gnome/desktop/sound" = {
allow-volume-above-100-percent = false; allow-volume-above-100-percent = false;
event-sounds = false; event-sounds = false;

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
"org/gnome/desktop/wm/preferences" = { "org/gnome/desktop/wm/preferences" = {
action-middle-click-titlebar = "minimize"; action-middle-click-titlebar = "minimize";
action-right-click-titlebar = "menu"; action-right-click-titlebar = "menu";

View file

@ -1,4 +1,10 @@
{ self, inputs, config, ... } @args: let {
self,
inputs,
config,
...
}@args:
let
btop = import ./btop args; btop = import ./btop args;
editor = import ./editorconfig args; editor = import ./editorconfig args;
foot = import ./foot args; foot = import ./foot args;
@ -16,7 +22,8 @@
tmux = import ./tmux args; tmux = import ./tmux args;
waybar = import ./waybar args; waybar = import ./waybar args;
yazi = import ./yazi args; yazi = import ./yazi args;
in { in
{
".Wallpaper".source = config.module.wallpaper.path; ".Wallpaper".source = config.module.wallpaper.path;
".config/MangoHud/MangoHud.conf".source = mangohud.config; ".config/MangoHud/MangoHud.conf".source = mangohud.config;
".config/MangoHud/presets.conf".source = mangohud.presets; ".config/MangoHud/presets.conf".source = mangohud.presets;

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }:
file = (pkgs.formats.iniWithGlobalSection {}).generate "EditorconfigConfig" { {
file = (pkgs.formats.iniWithGlobalSection { }).generate "EditorconfigConfig" {
globalSection.root = true; globalSection.root = true;
sections = { sections = {
@ -7,16 +8,17 @@
end_of_line = "lf"; end_of_line = "lf";
charset = "utf-8"; charset = "utf-8";
indent_style = "tab"; indent_style = "tab";
indent_size = "2"; indent_size = 2;
insert_final_newline = "true"; insert_final_newline = "true";
trim_trailing_whitespace = "true"; trim_trailing_whitespace = "true";
}; };
Makefile = { "Makefile" = {
indent_size = 2; indent_size = 4;
}; };
"*.{nix,js}" = { "*.nix" = {
indent_style = "space";
indent_size = 2; indent_size = 2;
}; };

View file

@ -1,9 +1,11 @@
{ config, pkgs, ... }: let { config, pkgs, ... }:
let
dpiAware = if config.setting.dpiAware then "yes" else "no"; dpiAware = if config.setting.dpiAware then "yes" else "no";
borderSize = toString config.style.window.border; borderSize = toString config.style.window.border;
fontStep = 1; fontStep = 1;
in { in
file = (pkgs.formats.iniWithGlobalSection {}).generate "FootConfig" { {
file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" {
globalSection = { globalSection = {
font = "${config.style.font.monospace.name}:size=${toString config.style.font.size.terminal}"; font = "${config.style.font.monospace.name}:size=${toString config.style.font.size.terminal}";
# font-bold = "${config.style.font.monospace.name}:size=${toString config.style.font.size.terminal}"; # font-bold = "${config.style.font.monospace.name}:size=${toString config.style.font.size.terminal}";

View file

@ -1,7 +1,9 @@
{ pkgs, config, ... }: let { pkgs, config, ... }:
let
dpiAware = if config.setting.dpiAware then "yes" else "no"; dpiAware = if config.setting.dpiAware then "yes" else "no";
in { in
file = (pkgs.formats.ini {}).generate "FuzzelConfig" { {
file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
main = { main = {
dpi-aware = dpiAware; dpi-aware = dpiAware;
# font = "${style.font.serif.name}:size=${toString style.font.size.popup}"; # font = "${style.font.serif.name}:size=${toString style.font.size.popup}";
@ -17,9 +19,11 @@ in {
radius = 0; radius = 0;
width = 1; width = 1;
}; };
colors = let colors =
let
defaultOpacity = "ff"; defaultOpacity = "ff";
in { in
{
background = config.style.color.bg.dark + config.style.opacity.hex; background = config.style.color.bg.dark + config.style.opacity.hex;
border = config.style.color.border + config.style.opacity.hex; border = config.style.color.border + config.style.opacity.hex;
counter = config.style.color.bg.regular + defaultOpacity; counter = config.style.color.bg.regular + defaultOpacity;

View file

@ -1,4 +1,5 @@
{ secret, pkgs, ... }: { { secret, pkgs, ... }:
{
file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" { file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" {
# credential.helper = "store"; # credential.helper = "store";
gpg.format = secret.crypto.sign.git.format; gpg.format = secret.crypto.sign.git.format;

View file

@ -1,5 +1,6 @@
{ util, ... }:{ { ... }:
bookmarks = util.trimTabs '' {
bookmarks = ''
file:///storage file:///storage
file:///home/voronind/tmp file:///home/voronind/tmp
sftp://10.0.0.1:22143/storage/hot/docker/cloud/data/data/cakee/files/ home cloud sftp://10.0.0.1:22143/storage/hot/docker/cloud/data/data/cakee/files/ home cloud

View file

@ -1,5 +1,6 @@
{ util, ... }: { { ... }:
ideavimrc = util.trimTabs '' {
ideavimrc = ''
" Plugins. " Plugins.
Plug 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank' Plug 'machakann/vim-highlightedyank'

View file

@ -1,3 +1,4 @@
{ util, ... } @args: { { util, ... }@args:
{
text = util.catFile (util.ls ./module) args; text = util.catFile (util.ls ./module) args;
} }

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }:
file = (pkgs.formats.ini {}).generate "KeydDrgConfig" { {
file = (pkgs.formats.ini { }).generate "KeydDrgConfig" {
steam-app-548430 = { steam-app-548430 = {
"alt.1" = "macro(enter 10ms L e t ' s 10ms space d o 10ms space t h i s 10ms space T e x a s 10ms space s t y l e ! 10ms enter)"; "alt.1" = "macro(enter 10ms L e t ' s 10ms space d o 10ms space t h i s 10ms space T e x a s 10ms space s t y l e ! 10ms enter)";
"alt.2" = "macro(enter 10ms H e c k space y e s ! enter)"; "alt.2" = "macro(enter 10ms H e c k space y e s ! enter)";

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }:
file = (pkgs.formats.ini {}).generate "KeydFirefoxConfig" { {
file = (pkgs.formats.ini { }).generate "KeydFirefoxConfig" {
"firefox-esr" = { "firefox-esr" = {
"alt.capslock" = "C-t"; # New tab. "alt.capslock" = "C-t"; # New tab.
"alt.x" = "C-w"; # Close tab. "alt.x" = "C-w"; # Close tab.

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }:
file = (pkgs.formats.ini {}).generate "KeydJetbrainsConfig" { {
file = (pkgs.formats.ini { }).generate "KeydJetbrainsConfig" {
"jetbrains-*" = { "jetbrains-*" = {
"alt./" = "C-/"; # Toggle comment. "alt./" = "C-/"; # Toggle comment.
"alt.." = "C-f8"; # Toggle line breakpoint. "alt.." = "C-f8"; # Toggle line breakpoint.

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }:
file = (pkgs.formats.ini {}).generate "KeydNautilusConfig" { {
file = (pkgs.formats.ini { }).generate "KeydNautilusConfig" {
"org-gnome-nautilus" = { "org-gnome-nautilus" = {
"alt.capslock" = "C-t"; # New tab. "alt.capslock" = "C-t"; # New tab.
"alt.t" = "C-n"; # New window. "alt.t" = "C-n"; # New window.

View file

@ -1,7 +1,9 @@
{ pkgs, config, ... }: let { pkgs, config, ... }:
let
alpha = config.style.opacity.hex; alpha = config.style.opacity.hex;
in { in
file = (pkgs.formats.iniWithGlobalSection {}).generate "MakoConfig" { {
file = (pkgs.formats.iniWithGlobalSection { }).generate "MakoConfig" {
globalSection = { globalSection = {
anchor = "top-center"; anchor = "top-center";
background-color = "#${config.style.color.bg.dark}${alpha}"; background-color = "#${config.style.color.bg.dark}${alpha}";

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }:
config = (pkgs.formats.iniWithGlobalSection {}).generate "MangoConfig" { {
config = (pkgs.formats.iniWithGlobalSection { }).generate "MangoConfig" {
globalSection = { globalSection = {
blacklist = "example"; blacklist = "example";
fps_sampling_period = 1000; fps_sampling_period = 1000;
@ -10,7 +11,7 @@
}; };
}; };
presets = (pkgs.formats.ini {}).generate "MangoPresets" { presets = (pkgs.formats.ini { }).generate "MangoPresets" {
"preset 0" = { "preset 0" = {
no_display = 1; no_display = 1;
}; };

View file

@ -1,18 +1,26 @@
{ inputs, pkgs, util, ... } @args: let {
inputs,
pkgs,
util,
...
}@args:
let
# Create Neovim configuration. # Create Neovim configuration.
nvimRc = { runtimes, configs }: let nvimRc =
{ runtimes, configs }:
let
# Plugin paths to install. # Plugin paths to install.
runtimeRc = util.trimTabs (builtins.foldl' (acc: r: runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
acc + "set runtimepath+=${r}\n"
) "" runtimes);
# My configuration files combined into one big file. # My configuration files combined into one big file.
config = pkgs.writeText "nvimRc" (util.catText configs args); config = pkgs.writeText "nvimRc" (util.catText configs args);
# Tell Neovim to load this file. # Tell Neovim to load this file.
configRc = "lua dofile(\"${config}\")"; configRc = "lua dofile(\"${config}\")";
in runtimeRc + configRc; in
in { runtimeRc + configRc;
in
{
text = nvimRc { text = nvimRc {
runtimes = [ runtimes = [
"~/.cache/nvim" "~/.cache/nvim"

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
text = '' text = ''
vim.o.autoread = true vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
text = '' text = ''
-- TODO: Add comments and separate files. -- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus" vim.opt.clipboard = "unnamedplus"

View file

@ -1,12 +1,29 @@
{ config, lib, ... }: let { config, lib, ... }:
let
color = config.style.color; color = config.style.color;
mkHighlight = name: value: ''vim.api.nvim_set_hl(0, "${name}", ${lib.generators.toLua { multiline = false; asBindings = false; } value})''; mkHighlight =
name: value:
''vim.api.nvim_set_hl(0, "${name}", ${
lib.generators.toLua {
multiline = false;
asBindings = false;
} value
})'';
bg = { bg = "#${color.bg.regular}"; }; bg = {
selection = { bg = "#${color.selection}"; fg = "#${color.fg.dark}"; bold = true; }; bg = "#${color.bg.regular}";
transparent = { bg = lib.generators.mkLuaInline "clear"; }; };
in { selection = {
bg = "#${color.selection}";
fg = "#${color.fg.dark}";
bold = true;
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
in
{
text = '' text = ''
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, { vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}), group = vim.api.nvim_create_augroup('Color', {}),

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
text = '' text = ''
vim.opt.hlsearch = true vim.opt.hlsearch = true
vim.opt.ignorecase = true vim.opt.ignorecase = true

View file

@ -1,6 +1,8 @@
{ ... }: let { ... }:
let
indentDefault = 2; indentDefault = 2;
in { in
{
text = '' text = ''
vim.opt.autoindent = true vim.opt.autoindent = true
vim.opt.expandtab = false vim.opt.expandtab = false

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
text = '' text = ''
-- Autocomplete. -- Autocomplete.
rekey_input("<C-space>", "<C-n>") rekey_input("<C-space>", "<C-n>")

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
text = '' text = ''
-- New empty buffer. -- New empty buffer.
remap_normal("<Leader>n", "<cmd>enew<cr>") remap_normal("<Leader>n", "<cmd>enew<cr>")

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