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
charset = utf-8
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.{nix,js}]
indent_size = 2
[*.lua]
indent_size = 4
[*.sh]
indent_size = 8
[Makefile]
[*.nix]
indent_style = space
indent_size = 2
[*.md]
indent_size = 8
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:
ulimit -n 999999999
format:
treefmt --no-cache --on-unmatched=info
gc:
nix-collect-garbage -d
# nix-store --gc

View file

@ -1,6 +1,7 @@
# Global settings.
# Just like I can configure each package, here I configure my config! :O)
{ lib, ... }: {
{ lib, ... }:
{
options.setting = with lib; {
# Ollama settings.
# I use the best light model by default.
@ -42,11 +43,11 @@
# CPU configurations.
cpu = mkOption {
default = {};
default = { };
type = types.submodule {
options = {
hwmon = mkOption {
default = {};
default = { };
type = types.submodule {
options = {
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;
mkTypeOption = default: type: mkOption { inherit default type; };
@ -6,7 +14,8 @@
mkIntOption = default: mkTypeOption default types.int;
mkFloatOption = default: mkTypeOption default types.float;
mkPkgOption = default: mkTypeOption default types.package;
in {
in
{
options.style = {
color = {
bg = {
@ -69,11 +78,11 @@ in {
desktop = mkIntOption 14;
};
serif = {
package = mkPkgOption (pkgs.callPackage <package/applefont> {});
package = mkPkgOption (pkgs.callPackage <package/applefont> { });
name = mkStrOption "SF Pro Display";
};
sansSerif = {
package = mkPkgOption (pkgs.callPackage <package/applefont> {});
package = mkPkgOption (pkgs.callPackage <package/applefont> { });
name = mkStrOption "SF Pro Display";
};
monospace = {

View file

@ -1,11 +1,22 @@
{ pkgs, config, __findFile, ... }: {
{
pkgs,
config,
__findFile,
...
}:
{
stylix = {
enable = true;
image = config.module.wallpaper.path;
autoEnable = true;
polarity = "dark";
fonts = {
inherit (config.style.font) serif sansSerif monospace emoji;
inherit (config.style.font)
serif
sansSerif
monospace
emoji
;
sizes = {
inherit (config.style.font.size) terminal desktop;
applications = config.style.font.size.application;
@ -18,10 +29,14 @@
popups = config.style.opacity.popups;
};
inherit (config.style) cursor;
override = if config.module.wallpaper.forceContrastText then {
override =
if config.module.wallpaper.forceContrastText then
{
base04 = "000000";
base05 = "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";
sha256 = "0pwnq84mdbv8nrarhnbkq77iabwgh7znr0yig3fnshamxl2a3k7k";
forceContrastText = true;
in {
in
{
options = {
module.wallpaper = {
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;
in {
in
{
options = {
container.module.change = {
enable = mkEnableOption "Change detection service";
@ -36,7 +44,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.changedetection-io = {
enable = true;
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;
postgres = config.container.module.postgres;
proxy = config.container.module.proxy;
in {
in
{
options = {
container.module.cloud = {
enable = mkEnableOption "File cloud service";
@ -39,7 +48,9 @@ in {
};
};
config = { config, ... }: container.mkContainerConfig cfg {
config =
{ config, ... }:
container.mkContainerConfig cfg {
services.nextcloud = {
enable = true;
# package = pkgs.nextcloud29;
@ -62,7 +73,10 @@ in {
};
extraAppsEnable = true;
settings = {
trusted_domains = [ cfg.address cfg.domain ];
trusted_domains = [
cfg.address
cfg.domain
];
trusted_proxies = [ proxy.address ];
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;
in {
in
{
options = {
container.module.ddns = {
enable = mkEnableOption "Dynamic dns client.";
@ -28,7 +36,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.cloudflare-dyndns = {
enable = true;
apiTokenFile = "/data/token";
@ -36,9 +46,12 @@ in {
ipv4 = true;
ipv6 = false;
proxied = false;
domains = let
domains =
let
domain = config.container.domain;
in [ domain ] ++ map (sub: "${sub}.${domain}") [
in
[ domain ]
++ map (sub: "${sub}.${domain}") [
"cloud"
"git"
"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;
in {
in
{
options = {
container.module.dns = {
enable = mkEnableOption "Dns server.";
@ -17,7 +27,9 @@ in {
config = mkIf cfg.enable {
containers.dns = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [
pkgs.cloudflared
];
@ -104,9 +116,11 @@ in {
};
};
customDNS = {
mapping = let
mapping =
let
block = "0.0.0.0";
in {
in
{
# All subdomains to current host.
# ${config.container.domain} = config.container.host;
"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;
in {
in
{
options = {
container.module.download = {
enable = mkEnableOption "Downloader.";
@ -42,7 +50,9 @@ in {
};
} // container.attachMedia "download" false;
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.deluge = {
enable = true;
dataDir = "/var/lib/deluge";

View file

@ -1,8 +1,18 @@
# 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 айпишник_впна"
{ container, pkgs, lib, config, __findFile, ... }: with lib; let
{
container,
pkgs,
lib,
config,
__findFile,
...
}:
with lib;
let
cfg = config.container.module.frkn;
in {
in
{
options = {
container.module.frkn = {
enable = mkEnableOption "FRKN";
@ -42,7 +52,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
boot.kernel.sysctl = {
"net.ipv4.conf.all.src_valid_mark" = 1;
"net.ipv4.ip_forward" = 1;
@ -68,9 +80,11 @@ in {
tor = {
enable = true;
openFirewall = true;
settings = let
settings =
let
exclude = "{RU},{UA},{BY},{KZ},{CN},{??}";
in {
in
{
# ExcludeExitNodes = exclude;
# ExcludeNodes = exclude;
#DNSPort = dnsport;
@ -102,7 +116,7 @@ in {
};
systemd = {
services.tor.wantedBy = lib.mkForce [];
services.tor.wantedBy = lib.mkForce [ ];
timers.tor = {
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;
in {
in
{
options = {
container.module.git = {
enable = mkEnableOption "Git server.";
@ -40,16 +49,20 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ forgejo ];
services.forgejo = {
enable = true;
stateDir = "/var/lib/forgejo";
database = let
database =
let
postgre = config.container.module.postgres;
in {
in
{
type = "postgres";
host = postgre.address;
port = postgre.port;
@ -58,10 +71,12 @@ in {
createDatabase = false;
};
settings = let
settings =
let
gcArgs = "--aggressive --no-cruft --prune=now";
gcTimeout = 600;
in {
in
{
"service".DISABLE_REGISTRATION = true;
"log".LEVEL = "Error";
"server" = {

View file

@ -1,7 +1,16 @@
# 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;
in {
in
{
options = {
container.module.hdd = {
enable = mkEnableOption "Hdd health monitor.";
@ -52,7 +61,9 @@ in {
# additionalCapabilities = [ "CAP_SYS_ADMIN" ];
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ smartmontools ];
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;
package = (pkgs.callPackage <package/homer> args);
in {
in
{
options = {
container.module.home = {
enable = mkEnableOption "Dashboard.";
@ -22,7 +33,9 @@ in {
config = mkIf cfg.enable {
containers.home = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ 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;
in {
in
{
options = {
container.module.iot = {
enable = mkEnableOption "IoT service.";
@ -51,9 +60,14 @@ in {
}
];
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
# Allow Hass to talk to Zigbee dongle.
users.users.hass.extraGroups = [ "dialout" "tty" ];
users.users.hass.extraGroups = [
"dialout"
"tty"
];
services.home-assistant = {
# NOTE: Missing: hacs. Inside hacs: `card-mod`, `Clock Weather Card`, `WallPanel` and `Yandex.Station`.
@ -65,7 +79,8 @@ in {
"systemmonitor"
"zha"
];
extraPackages = python3Packages: with python3Packages; [
extraPackages =
python3Packages: with python3Packages; [
aiodhcpwatcher
aiodiscover
aiogithubapi
@ -95,7 +110,7 @@ in {
# HACK: Delay so that nextcloud calendar can reply on reboot.
systemd = {
services."home-assistant".wantedBy = mkForce [];
services."home-assistant".wantedBy = mkForce [ ];
timers.fixsystemd = {
timerConfig = {
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;
script = import <package/jobber> { poetry2nix = poetry2nixJobber; pkgs = pkgsJobber; };
in {
script = import <package/jobber> {
poetry2nix = poetry2nixJobber;
pkgs = pkgsJobber;
};
in
{
options = {
container.module.jobber = {
enable = mkEnableOption "Button pusher Stanley.";
@ -31,14 +45,19 @@ in {
enableTun = true;
config = { lib, ... }: let
packages = [ script ] ++ (with pkgsJobber; [
config =
{ lib, ... }:
let
packages =
[ script ]
++ (with pkgsJobber; [
firefox
geckodriver
openvpn
python311
]);
in container.mkContainerConfig cfg {
in
container.mkContainerConfig cfg {
networking = lib.mkForce {
nameservers = [
"10.30.218.2"

View file

@ -1,8 +1,19 @@
# 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;
domain = config.container.domain;
in {
in
{
options = {
container.module.mail = {
enable = mkEnableOption "Email server.";
@ -58,7 +69,9 @@ in {
};
};
config = { config, ... }: container.mkContainerConfig cfg {
config =
{ config, ... }:
container.mkContainerConfig cfg {
imports = [
(builtins.fetchTarball {
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;
# Use `mkpasswd -sm bcrypt`.
loginAccounts = let
loginAccounts =
let
defaultQuota = "1G";
in {
in
{
"admin@${domain}" = {
name = "admin";
hashedPassword = "$2b$05$1O.dxXxaVshcBNybcqDRYuTlnYt3jDBwfPZWoDtP4BjOLoL0StYsi";
@ -173,7 +188,10 @@ in {
services = {
roundcube = {
enable = true;
dicts = with pkgs.aspellDicts; [ en ru ];
dicts = with pkgs.aspellDicts; [
en
ru
];
hostName = cfg.domain;
plugins = [
"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.
# 2. TODO: Generate JWT secret at /var/lib/onlyoffice/jwt, i.e. 9wLfMGha1YrfvWpb5hyYjZf8pvJQ3swS
# 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;
in {
in
{
options = {
container.module.office = {
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
config = { pkgs, ... }: container.mkContainerConfig cfg {
config =
{ pkgs, ... }:
container.mkContainerConfig cfg {
virtualisation.oci-containers.backend = "docker";
virtualisation.oci-containers.containers.office = {
autoStart = true;
image = "dockerhub.timeweb.cloud/onlyoffice/documentserver:latest";
# ports = [ "${toString cfg.port}:8000" ];
extraOptions = [ "--network=host" "--privileged" ];
extraOptions = [
"--network=host"
"--privileged"
];
environment = {
JWT_ENABLED = "true";
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;
in {
in
{
options = {
container.module.paper = {
enable = mkEnableOption "Paper scans manager.";
@ -40,7 +50,9 @@ in {
};
};
config = { lib, ... }: container.mkContainerConfig cfg {
config =
{ lib, ... }:
container.mkContainerConfig cfg {
services.paperless = {
enable = true;
dataDir = "/var/lib/paperless";
@ -69,17 +81,17 @@ in {
services = {
paperless-scheduler = {
serviceConfig.PrivateNetwork = mkForce false;
wantedBy = mkForce [];
wantedBy = mkForce [ ];
};
paperless-consumer = {
serviceConfig.PrivateNetwork = mkForce false;
wantedBy = mkForce [];
wantedBy = mkForce [ ];
};
paperless-web = {
wantedBy = mkForce [];
wantedBy = mkForce [ ];
};
paperless-task-queue = {
wantedBy = mkForce [];
wantedBy = mkForce [ ];
};
};
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;
in {
in
{
options = {
container.module.pass = {
enable = mkEnableOption "Password manager";
@ -36,7 +44,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.vaultwarden = {
enable = true;
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;
package = (pkgs.callPackage <package/privatebin> args);
in {
in
{
options = {
container.module.paste = {
enable = mkEnableOption "Pastebin.";
@ -52,7 +62,9 @@ in {
};
};
config = { config, ... }: container.mkContainerConfig cfg {
config =
{ config, ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ package ];
systemd.packages = [ package ];
@ -96,14 +108,14 @@ in {
rewrite ^ /index.php;
'';
"~ \\.php$".extraConfig = util.trimTabs ''
"~ \\.php$".extraConfig = ''
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:${config.services.phpfpm.pools.paste.socket};
include ${config.services.nginx.package}/conf/fastcgi.conf;
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 X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
@ -115,7 +127,7 @@ in {
'';
};
extraConfig = util.trimTabs ''
extraConfig = ''
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;
in {
in
{
options = {
container.module.postgres = {
enable = mkEnableOption "Postgresql server.";
@ -32,8 +41,11 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
services.postgresql = let
config =
{ ... }:
container.mkContainerConfig cfg {
services.postgresql =
let
# Populate with services here.
configurations = with config.container.module; {
forgejo = git;
@ -45,7 +57,9 @@ in {
};
access = configurations // {
all = { address = config.container.host; };
all = {
address = config.container.host;
};
};
authentication = builtins.foldl' (acc: item: acc + "${item}\n") "" (
@ -56,14 +70,19 @@ in {
ensureUsers = map (name: {
inherit name;
ensureClauses = if name == "root" then {
ensureClauses =
if name == "root" then
{
superuser = true;
createrole = true;
createdb = true;
} else {};
}
else
{ };
ensureDBOwnership = true;
}) ensureDatabases;
in {
in
{
inherit authentication ensureDatabases ensureUsers;
enable = true;

View file

@ -2,11 +2,21 @@
# ipp://192.168.2.237
# 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;
package = pkgs.callPackage <package/print> args;
host = config.container.host;
in {
in
{
options = {
container.module.print = {
enable = mkEnableOption "Printing server.";
@ -42,12 +52,16 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
networking.interfaces."eth0".ipv4.routes = [{
config =
{ ... }:
container.mkContainerConfig cfg {
networking.interfaces."eth0".ipv4.routes = [
{
address = "192.168.2.237";
prefixLength = 32;
via = host;
}];
}
];
services.printing = {
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";
# ```
# 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;
virtualHosts = util.catSet (util.ls ./proxy/host) args;
in {
in
{
options = {
container.module.proxy = {
enable = mkEnableOption "Proxy server.";
@ -49,7 +59,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ certbot ];
services.nginx = {
@ -59,14 +71,14 @@ in {
recommendedOptimisation = true;
recommendedProxySettings = true;
clientMaxBodySize = "4096m";
appendConfig = util.trimTabs ''
appendConfig = ''
worker_processes 4;
'';
eventsConfig = util.trimTabs ''
eventsConfig = ''
worker_connections 4096;
'';
# TODO: Fix 80 redirect and 403 default.
appendHttpConfig = util.trimTabs ''
appendHttpConfig = ''
proxy_max_temp_file_size 0;
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;
in {
in
{
options = {
container.module.rabbitmq = {
enable = mkEnableOption "Mqtt server.";
@ -32,7 +42,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.rabbitmq = {
enable = true;
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;
in {
in
{
options = {
container.module.read = {
enable = mkEnableOption "Reading server.";
@ -34,12 +43,11 @@ in {
hostPath = "${cfg.storage}/data";
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 = {
enable = true;
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;
in {
in
{
options = {
container.module.redis = {
enable = mkEnableOption "Redis server.";
@ -17,7 +27,9 @@ in {
config = mkIf cfg.enable {
containers.redis = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.redis.servers.main = {
enable = true;
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;
in {
in
{
options = {
container.module.search = {
enable = mkEnableOption "Search frontend.";
@ -25,7 +34,9 @@ in {
config = mkIf cfg.enable {
containers.search = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.searx = {
enable = true;
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;
in {
in
{
options = {
container.module.status = {
enable = mkEnableOption "Status monitor.";
@ -36,7 +44,9 @@ in {
};
};
config = { lib, ... }: container.mkContainerConfig cfg {
config =
{ lib, ... }:
container.mkContainerConfig cfg {
networking = {
nameservers = mkForce [
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;
in {
in
{
options = {
container.module.stock = {
enable = mkEnableOption "Stock management.";
@ -36,7 +44,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.grocy = {
enable = true;
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;
wireguardPeers = let
wireguardPeers =
let
mkPeer = name: ip: PublicKey: {
inherit PublicKey;
PresharedKeyFile = "/var/lib/wireguard/preshared/${name}";
AllowedIPs = [ "${ip}/32" ];
};
in [
in
[
(mkPeer "dashaphone" "10.1.1.3" "O/3y8+QKEY8UoLVlmbc8xdhs248L4wtQcl1MsBBfoQo=")
(mkPeer "laptop" "10.1.1.9" "xxoCNPSB86zs8L8p+wXhqaIwpNDkiZu1Yjv8sj8XhgY=")
(mkPeer "phone" "10.1.1.5" "bFmFisMqbDpIrAg3o/GiRl9XhceZEVnZtkegZDTL4yg=")
(mkPeer "tablet" "10.1.1.6" "BdslswVc9OgUpEhJd0sugDBmYw44DiS0FbUPT5EjOG0=")
(mkPeer "work" "10.1.1.2" "Pk0AASSInKO9O8RaQEmm1uNrl0cwWTJDcT8rLn7PSA0=")
];
in {
in
{
options = {
container.module.vpn = {
enable = mkEnableOption "Vpn server.";
@ -47,7 +58,9 @@ in {
};
};
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
boot.kernel.sysctl = {
"net.ipv4.conf.all.src_valid_mark" = 1;
"net.ipv4.ip_forward" = 1;
@ -74,7 +87,7 @@ in {
networks.wg0 = {
matchConfig.Name = "wg0";
address = ["10.1.1.0/24"];
address = [ "10.1.1.0/24" ];
networkConfig = {
IPv4Forwarding = "yes";
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;
in {
in
{
options = {
container.module.watch = {
enable = mkEnableOption "Media server.";
@ -34,7 +42,8 @@ in {
];
containers.watch = container.mkContainer cfg {
bindMounts = {
bindMounts =
{
"/var/lib/jellyfin" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
@ -57,8 +66,7 @@ in {
// container.attachMedia "show" true
// container.attachMedia "study" true
// container.attachMedia "work" true
// container.attachMedia "youtube" true
;
// container.attachMedia "youtube" true;
allowedDevices = [
{
@ -67,7 +75,9 @@ in {
}
];
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
# users.users.jellyfin.extraGroups = [
# "video"
# "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;
in {
in
{
options = {
container.module.yt = {
enable = mkEnableOption "YouTube frontend.";
@ -25,7 +35,9 @@ in {
config = mkIf cfg.enable {
containers.yt = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
config =
{ ... }:
container.mkContainerConfig cfg {
services.invidious = {
enable = true;
domain = cfg.domain;

View file

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

View file

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

View file

@ -1,9 +1,11 @@
{ util, config, container, ... }: let
{ config, container, ... }:
let
cfg = config.container.module.change;
name = "change";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "cloud";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "download";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "git";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "hdd";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "home";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "iot";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "mail";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "office";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "paper";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "pass";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "paste";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "print";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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";
domain = "printer.${config.container.domain}";
port = 80;
name = "printer";
in {
in
{
${domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
set ''$${name} ${address}:${toString port};

View file

@ -1,9 +1,11 @@
{ util, container, config, ... }: let
{ container, config, ... }:
let
cfg = config.container.module.read;
name = "read";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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";
domain = "router.${config.container.domain}";
port = 80;
name = "router";
in {
in
{
${domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "search";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "sstatus";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "stock";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "watch";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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;
name = "yt";
in {
in
{
${cfg.domain} = container.mkServer {
extraConfig = util.trimTabs ''
extraConfig = ''
listen 443 ssl;
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.
# `...` 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.
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.
const = {
droidStateVersion = "23.11";
@ -130,21 +143,27 @@
__findFile = _: p: ./${p};
# 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.attrNames (builtins.readDir path)
)
);
# Dev shell for this repo.
devShells = let
devShells =
let
system = "x86_64-linux";
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system};
in {
in
{
${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixd
nixfmt-rfc-style
treefmt
];
# buildInputs = with pkgs; [ ];
@ -154,15 +173,19 @@
};
# Nixos systems.
nixosConfigurations = let
nixosConfigurations =
let
# 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
# keep the `system` argument as a property in a resulting set.
inherit system;
# List of modules to use by defualt for all the hosts.
modules = [
modules =
[
# Make a device hostname match the one from this config.
{ networking.hostName = hostname; }
@ -186,11 +209,13 @@
++ (self.findFiles ./overlay);
# SpecialArgs allows you to pass objects down to other NixOS modules.
specialArgs = let
specialArgs =
let
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
lib = nixpkgs.lib;
config = self.nixosConfigurations.${hostname}.config;
in {
in
{
inherit inputs self;
inherit (self) const __findFile;
@ -198,8 +223,11 @@
pkgsStable = nixpkgsStable.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
secret = import ./secret {}; # Secrets (public keys).
container = import ./lib/Container.nix { inherit lib pkgs config; inherit (self) const; }; # Container utils.
secret = import ./secret { }; # Secrets (public keys).
container = import ./lib/Container.nix {
inherit lib pkgs config;
inherit (self) const;
}; # Container utils.
util = import ./lib/Util.nix { inherit lib; }; # Util functions.
# Stuff for Jobber container, skip this part.
@ -212,17 +240,16 @@
inherit system hostname;
};
};
in nixpkgs.lib.foldl' (acc: h: acc // h) {} (
map (system:
nixpkgs.lib.foldl' (acc: h: acc // h) {} (
map (host:
mkSystem system host
) (builtins.attrNames (builtins.readDir ./host/${system}))
in
nixpkgs.lib.foldl' (acc: h: acc // h) { } (
map (
system:
nixpkgs.lib.foldl' (acc: h: acc // h) { } (
map (host: mkSystem system host) (builtins.attrNames (builtins.readDir ./host/${system}))
)
) (builtins.attrNames (builtins.readDir ./host))
);
# Home manager (distro-independent).
# Install nix: sh <(curl -L https://nixos.org/nix/install) --no-daemon
# Or with --daemon for multi-user (as root).
@ -231,21 +258,33 @@
# Add to /etc/nix/nix.conf > experimental-features = nix-command flakes
# And then # systemctl restart nix-daemon.service
# $ home-manager switch --flake ~/hmconf
homeConfigurations = let
homeConfigurations =
let
lib = nixpkgs.lib;
secret = import ./secret {};
secret = import ./secret { };
util = import ./lib/Util.nix { inherit lib; };
mkCommonHome = username: homeDirectory: system: modules: let
mkCommonHome =
username: homeDirectory: system: modules:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgsStable = nixpkgsStable.legacyPackages.${system};
pkgsMaster = nixpkgsMaster.legacyPackages.${system};
in {
in
{
${username} = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit self inputs secret util pkgs pkgsStable pkgsMaster;
inherit
self
inputs
secret
util
pkgs
pkgsStable
pkgsMaster
;
inherit (self) const __findFile;
};
modules = [
@ -263,18 +302,22 @@
{ nixpkgs.config.allowUnfree = true; }
{ nixpkgs.config.allowUnfreePredicate = (pkg: true); }
{ nix.package = pkgs.nix; }
{ nix.settings.experimental-features = [ "nix-command " "flakes" ]; }
{
nix.settings.experimental-features = [
"nix-command "
"flakes"
];
}
inputs.stylix.homeManagerModules.stylix
]
++ modules
++ (self.findFiles ./config);
] ++ modules ++ (self.findFiles ./config);
};
};
x86LinuxHome = username: modules: mkCommonHome username "/home/${username}" "x86_64-linux" modules;
x86LinuxRoot = mkCommonHome "root" "/root" "x86_64-linux" [];
in nixpkgs.lib.foldl' (acc: h: acc // h) {} [
x86LinuxRoot = mkCommonHome "root" "/root" "x86_64-linux" [ ];
in
nixpkgs.lib.foldl' (acc: h: acc // h) { } [
x86LinuxRoot
(x86LinuxHome "voronind" [
{
@ -286,11 +329,13 @@
];
# Android.
nixOnDroidConfigurations.default = let
nixOnDroidConfigurations.default =
let
config = self.nixOnDroidConfigurations.default.config;
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
in nix-on-droid.lib.nixOnDroidConfiguration {
in
nix-on-droid.lib.nixOnDroidConfiguration {
modules = [
# Android release version.
{ system.stateVersion = self.const.droidStateVersion; }
@ -319,7 +364,7 @@
inherit inputs self;
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.
};
};

View file

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

View file

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

View file

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

View file

@ -1,9 +1,12 @@
{ pkgs, util, config, ... }: {
font = pkgs.runCommandNoCC "font" {} ''
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
{ pkgs, config, ... }:
{
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}
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
#* 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" = {
always-show-universal-access-status = true;
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
{ lib, ... }: {
{ lib, ... }:
{
"org/gnome/desktop/wm/preferences" = {
action-middle-click-titlebar = "minimize";
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;
editor = import ./editorconfig args;
foot = import ./foot args;
@ -16,7 +22,8 @@
tmux = import ./tmux args;
waybar = import ./waybar args;
yazi = import ./yazi args;
in {
in
{
".Wallpaper".source = config.module.wallpaper.path;
".config/MangoHud/MangoHud.conf".source = mangohud.config;
".config/MangoHud/presets.conf".source = mangohud.presets;

View file

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

View file

@ -1,9 +1,11 @@
{ config, pkgs, ... }: let
{ config, pkgs, ... }:
let
dpiAware = if config.setting.dpiAware then "yes" else "no";
borderSize = toString config.style.window.border;
fontStep = 1;
in {
file = (pkgs.formats.iniWithGlobalSection {}).generate "FootConfig" {
in
{
file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" {
globalSection = {
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}";

View file

@ -1,7 +1,9 @@
{ pkgs, config, ... }: let
{ pkgs, config, ... }:
let
dpiAware = if config.setting.dpiAware then "yes" else "no";
in {
file = (pkgs.formats.ini {}).generate "FuzzelConfig" {
in
{
file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
main = {
dpi-aware = dpiAware;
# font = "${style.font.serif.name}:size=${toString style.font.size.popup}";
@ -17,9 +19,11 @@ in {
radius = 0;
width = 1;
};
colors = let
colors =
let
defaultOpacity = "ff";
in {
in
{
background = config.style.color.bg.dark + config.style.opacity.hex;
border = config.style.color.border + config.style.opacity.hex;
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" {
# credential.helper = "store";
gpg.format = secret.crypto.sign.git.format;

View file

@ -1,5 +1,6 @@
{ util, ... }:{
bookmarks = util.trimTabs ''
{ ... }:
{
bookmarks = ''
file:///storage
file:///home/voronind/tmp
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.
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank'

View file

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

View file

@ -1,5 +1,6 @@
{ pkgs, ... }: {
file = (pkgs.formats.ini {}).generate "KeydDrgConfig" {
{ pkgs, ... }:
{
file = (pkgs.formats.ini { }).generate "KeydDrgConfig" {
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.2" = "macro(enter 10ms H e c k space y e s ! enter)";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,12 +1,29 @@
{ config, lib, ... }: let
{ config, lib, ... }:
let
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}"; };
selection = { bg = "#${color.selection}"; fg = "#${color.fg.dark}"; bold = true; };
transparent = { bg = lib.generators.mkLuaInline "clear"; };
in {
bg = {
bg = "#${color.bg.regular}";
};
selection = {
bg = "#${color.selection}";
fg = "#${color.fg.dark}";
bold = true;
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
in
{
text = ''
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}),

View file

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

View file

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

View file

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

View file

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

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