Compare commits

..

No commits in common. "ef074ee1f31f1db36a117775f152c0d38ec310ae" and "ac00537d6e9cfa1c59600f07a995023119e87358" have entirely different histories.

342 changed files with 12792 additions and 14171 deletions

View file

@ -2,12 +2,22 @@
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] [*.{nix,js}]
indent_style = space indent_size = 2
[*.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

1
.gitignore vendored
View file

@ -1,2 +1 @@
/live /live
.NixRoot*

View file

@ -1,15 +0,0 @@
# 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,9 +26,6 @@ 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
@ -62,6 +59,9 @@ live:
reboot: boot reboot: boot
reboot reboot
shell:
SHELL_NAME="default" nix develop
show: show:
nix flake show nix flake show

View file

@ -1,7 +1,6 @@
# 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.
@ -43,11 +42,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,12 +1,4 @@
{ { 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; };
@ -14,8 +6,7 @@ let
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 = {
@ -78,11 +69,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,22 +1,11 @@
{ { 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) inherit (config.style.font) serif sansSerif monospace emoji;
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;
@ -29,14 +18,10 @@
popups = config.style.opacity.popups; popups = config.style.opacity.popups;
}; };
inherit (config.style) cursor; inherit (config.style) cursor;
override = override = if config.module.wallpaper.forceContrastText then {
if config.module.wallpaper.forceContrastText then
{
base04 = "000000"; base04 = "000000";
base05 = "ffffff"; base05 = "ffffff";
base06 = "ffffff"; base06 = "ffffff";
} } else {};
else
{ };
}; };
} }

View file

@ -1,11 +1,8 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }: with lib; let
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,14 +1,6 @@
{ { 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";
@ -44,9 +36,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.changedetection-io = { services.changedetection-io = {
enable = true; enable = true;
baseURL = cfg.domain; baseURL = cfg.domain;

View file

@ -1,18 +1,9 @@
{ { 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";
@ -48,9 +39,7 @@ in
}; };
}; };
config = config = { config, ... }: container.mkContainerConfig cfg {
{ config, ... }:
container.mkContainerConfig cfg {
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
# package = pkgs.nextcloud29; # package = pkgs.nextcloud29;
@ -73,10 +62,7 @@ in
}; };
extraAppsEnable = true; extraAppsEnable = true;
settings = { settings = {
trusted_domains = [ trusted_domains = [ cfg.address cfg.domain ];
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,14 +1,6 @@
{ { 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.";
@ -36,9 +28,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.cloudflare-dyndns = { services.cloudflare-dyndns = {
enable = true; enable = true;
apiTokenFile = "/data/token"; apiTokenFile = "/data/token";
@ -46,12 +36,9 @@ in
ipv4 = true; ipv4 = true;
ipv6 = false; ipv6 = false;
proxied = false; proxied = false;
domains = domains = let
let
domain = config.container.domain; domain = config.container.domain;
in in [ domain ] ++ map (sub: "${sub}.${domain}") [
[ domain ]
++ map (sub: "${sub}.${domain}") [
"cloud" "cloud"
"git" "git"
"mail" "mail"

View file

@ -1,16 +1,6 @@
{ { 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.";
@ -27,9 +17,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.dns = container.mkContainer cfg { containers.dns = container.mkContainer cfg {
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ environment.systemPackages = [
pkgs.cloudflared pkgs.cloudflared
]; ];
@ -116,11 +104,9 @@ in
}; };
}; };
customDNS = { customDNS = {
mapping = mapping = let
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";
@ -139,3 +125,4 @@ in
}; };
}; };
} }

View file

@ -1,14 +1,6 @@
{ { 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.";
@ -50,9 +42,7 @@ in
}; };
} // container.attachMedia "download" false; } // container.attachMedia "download" false;
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.deluge = { services.deluge = {
enable = true; enable = true;
dataDir = "/var/lib/deluge"; dataDir = "/var/lib/deluge";

View file

@ -1,18 +1,8 @@
# 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";
@ -52,9 +42,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
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;
@ -80,11 +68,9 @@ in
tor = { tor = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
settings = settings = let
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;
@ -116,7 +102,7 @@ in
}; };
systemd = { systemd = {
services.tor.wantedBy = lib.mkForce [ ]; services.tor.wantedBy = lib.mkForce [];
timers.tor = { timers.tor = {
timerConfig = { timerConfig = {

View file

@ -1,15 +1,6 @@
{ { 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.";
@ -49,20 +40,16 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
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 = database = let
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;
@ -71,12 +58,10 @@ in
createDatabase = false; createDatabase = false;
}; };
settings = settings = let
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,16 +1,7 @@
# 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.";
@ -61,9 +52,7 @@ in
# additionalCapabilities = [ "CAP_SYS_ADMIN" ]; # additionalCapabilities = [ "CAP_SYS_ADMIN" ];
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ smartmontools ]; environment.systemPackages = with pkgs; [ smartmontools ];
services.scrutiny = { services.scrutiny = {

View file

@ -1,18 +1,7 @@
{ { 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.";
@ -33,9 +22,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.home = container.mkContainer cfg { containers.home = container.mkContainer cfg {
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ package ]; environment.systemPackages = [ package ];
systemd.packages = [ package ]; systemd.packages = [ package ];

View file

@ -1,15 +1,6 @@
{ { 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.";
@ -60,14 +51,9 @@ in
} }
]; ];
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
# Allow Hass to talk to Zigbee dongle. # Allow Hass to talk to Zigbee dongle.
users.users.hass.extraGroups = [ users.users.hass.extraGroups = [ "dialout" "tty" ];
"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`.
@ -79,8 +65,7 @@ in
"systemmonitor" "systemmonitor"
"zha" "zha"
]; ];
extraPackages = extraPackages = python3Packages: with python3Packages; [
python3Packages: with python3Packages; [
aiodhcpwatcher aiodhcpwatcher
aiodiscover aiodiscover
aiogithubapi aiogithubapi
@ -110,7 +95,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,21 +1,7 @@
{ { 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> { script = import <package/jobber> { poetry2nix = poetry2nixJobber; pkgs = pkgsJobber; };
poetry2nix = poetry2nixJobber; in {
pkgs = pkgsJobber;
};
in
{
options = { options = {
container.module.jobber = { container.module.jobber = {
enable = mkEnableOption "Button pusher Stanley."; enable = mkEnableOption "Button pusher Stanley.";
@ -45,19 +31,14 @@ in
enableTun = true; enableTun = true;
config = config = { lib, ... }: let
{ lib, ... }: packages = [ script ] ++ (with pkgsJobber; [
let
packages =
[ script ]
++ (with pkgsJobber; [
firefox firefox
geckodriver geckodriver
openvpn openvpn
python311 python311
]); ]);
in in container.mkContainerConfig cfg {
container.mkContainerConfig cfg {
networking = lib.mkForce { networking = lib.mkForce {
nameservers = [ nameservers = [
"10.30.218.2" "10.30.218.2"

View file

@ -1,19 +1,8 @@
# 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.";
@ -69,9 +58,7 @@ in
}; };
}; };
config = config = { config, ... }: container.mkContainerConfig cfg {
{ 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";
@ -86,11 +73,9 @@ in
sendingFqdn = domain; sendingFqdn = domain;
# Use `mkpasswd -sm bcrypt`. # Use `mkpasswd -sm bcrypt`.
loginAccounts = loginAccounts = let
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";
@ -188,10 +173,7 @@ in
services = { services = {
roundcube = { roundcube = {
enable = true; enable = true;
dicts = with pkgs.aspellDicts; [ dicts = with pkgs.aspellDicts; [ en ru ];
en
ru
];
hostName = cfg.domain; hostName = cfg.domain;
plugins = [ plugins = [
"managesieve" "managesieve"

View file

@ -2,19 +2,9 @@
# 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.";
@ -50,19 +40,15 @@ 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 = config = { pkgs, ... }: container.mkContainerConfig cfg {
{ 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 = [ extraOptions = [ "--network=host" "--privileged" ];
"--network=host"
"--privileged"
];
environment = { environment = {
JWT_ENABLED = "true"; JWT_ENABLED = "true";
JWT_SECRET = "8wLfKGha8YRfvwpB5hYYjZf8vtUQs3wS"; JWT_SECRET = "8wLfKGha8YRfvwpB5hYYjZf8vtUQs3wS";

View file

@ -1,16 +1,6 @@
{ { 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.";
@ -50,9 +40,7 @@ in
}; };
}; };
config = config = { lib, ... }: container.mkContainerConfig cfg {
{ lib, ... }:
container.mkContainerConfig cfg {
services.paperless = { services.paperless = {
enable = true; enable = true;
dataDir = "/var/lib/paperless"; dataDir = "/var/lib/paperless";
@ -81,17 +69,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,14 +1,6 @@
{ { 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";
@ -44,9 +36,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.vaultwarden = { services.vaultwarden = {
enable = true; enable = true;
dbBackend = "sqlite"; dbBackend = "sqlite";

View file

@ -1,17 +1,7 @@
{ { 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.";
@ -62,9 +52,7 @@ in
}; };
}; };
config = config = { config, ... }: container.mkContainerConfig cfg {
{ config, ... }:
container.mkContainerConfig cfg {
environment.systemPackages = [ package ]; environment.systemPackages = [ package ];
systemd.packages = [ package ]; systemd.packages = [ package ];
@ -108,14 +96,14 @@ in
rewrite ^ /index.php; rewrite ^ /index.php;
''; '';
"~ \\.php$".extraConfig = '' "~ \\.php$".extraConfig = util.trimTabs ''
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 = '' "~ \\.(js|css|ttf|woff2?|png|jpe?g|svg)$".extraConfig = util.trimTabs ''
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";
@ -127,7 +115,7 @@ in
''; '';
}; };
extraConfig = '' extraConfig = util.trimTabs ''
try_files $uri /index.php; try_files $uri /index.php;
''; '';
}; };

View file

@ -1,15 +1,6 @@
{ { 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.";
@ -41,11 +32,8 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }: 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;
@ -57,9 +45,7 @@ in
}; };
access = configurations // { access = configurations // {
all = { all = { address = config.container.host; };
address = config.container.host;
};
}; };
authentication = builtins.foldl' (acc: item: acc + "${item}\n") "" ( authentication = builtins.foldl' (acc: item: acc + "${item}\n") "" (
@ -70,19 +56,14 @@ in
ensureUsers = map (name: { ensureUsers = map (name: {
inherit name; inherit name;
ensureClauses = ensureClauses = if name == "root" then {
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,21 +2,11 @@
# 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.";
@ -52,16 +42,12 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }: 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;
@ -78,3 +64,4 @@ in
}; };
}; };
} }

View file

@ -9,20 +9,10 @@
# 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.";
@ -59,9 +49,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
environment.systemPackages = with pkgs; [ certbot ]; environment.systemPackages = with pkgs; [ certbot ];
services.nginx = { services.nginx = {
@ -71,14 +59,14 @@ in
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedProxySettings = true; recommendedProxySettings = true;
clientMaxBodySize = "4096m"; clientMaxBodySize = "4096m";
appendConfig = '' appendConfig = util.trimTabs ''
worker_processes 4; worker_processes 4;
''; '';
eventsConfig = '' eventsConfig = util.trimTabs ''
worker_connections 4096; worker_connections 4096;
''; '';
# TODO: Fix 80 redirect and 403 default. # TODO: Fix 80 redirect and 403 default.
appendHttpConfig = '' appendHttpConfig = util.trimTabs ''
proxy_max_temp_file_size 0; proxy_max_temp_file_size 0;
proxy_buffering off; proxy_buffering off;

View file

@ -1,16 +1,6 @@
{ { 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.";
@ -42,9 +32,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.rabbitmq = { services.rabbitmq = {
enable = true; enable = true;
listenAddress = cfg.address; listenAddress = cfg.address;

View file

@ -1,15 +1,6 @@
{ { 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.";
@ -43,11 +34,12 @@ 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 = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.kavita = { services.kavita = {
enable = true; enable = true;
dataDir = "/var/lib/kavita"; dataDir = "/var/lib/kavita";

View file

@ -1,16 +1,6 @@
{ { 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.";
@ -27,9 +17,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.redis = container.mkContainer cfg { containers.redis = container.mkContainer cfg {
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.redis.servers.main = { services.redis.servers.main = {
enable = true; enable = true;
port = cfg.port; port = cfg.port;
@ -40,3 +28,4 @@ in
}; };
}; };
} }

View file

@ -1,15 +1,6 @@
{ { 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.";
@ -34,9 +25,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.search = container.mkContainer cfg { containers.search = container.mkContainer cfg {
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.searx = { services.searx = {
enable = true; enable = true;
package = pkgs.searxng; package = pkgs.searxng;

View file

@ -1,14 +1,6 @@
{ { 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.";
@ -44,9 +36,7 @@ in
}; };
}; };
config = config = { lib, ... }: container.mkContainerConfig cfg {
{ lib, ... }:
container.mkContainerConfig cfg {
networking = { networking = {
nameservers = mkForce [ nameservers = mkForce [
config.container.module.dns.address config.container.module.dns.address
@ -69,3 +59,4 @@ in
}; };
}; };
} }

View file

@ -1,14 +1,6 @@
{ { 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.";
@ -44,9 +36,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.grocy = { services.grocy = {
enable = true; enable = true;
dataDir = "/var/lib/grocy"; dataDir = "/var/lib/grocy";

View file

@ -1,31 +1,20 @@
{ { 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 = wireguardPeers = let
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.";
@ -58,9 +47,7 @@ in
}; };
}; };
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
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;
@ -87,7 +74,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";
@ -98,3 +85,4 @@ in
}; };
}; };
} }

View file

@ -1,14 +1,6 @@
{ { 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.";
@ -42,8 +34,7 @@ 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;
@ -66,7 +57,8 @@ 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 = [
{ {
@ -75,9 +67,7 @@ in
} }
]; ];
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
# users.users.jellyfin.extraGroups = [ # users.users.jellyfin.extraGroups = [
# "video" # "video"
# "render" # "render"

View file

@ -1,16 +1,6 @@
{ { 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.";
@ -35,9 +25,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
containers.yt = container.mkContainer cfg { containers.yt = container.mkContainer cfg {
config = config = { ... }: container.mkContainerConfig cfg {
{ ... }:
container.mkContainerConfig cfg {
services.invidious = { services.invidious = {
enable = true; enable = true;
domain = cfg.domain; domain = cfg.domain;

View file

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

View file

@ -1,16 +1,10 @@
{ { 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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
location / { location / {

View file

@ -1,11 +1,9 @@
{ config, container, ... }: { util, config, container, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ config, container, ... }: { util, config, container, ... }: let
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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};
@ -29,3 +27,4 @@ in
''; '';
}; };
} }

View file

@ -1,11 +1,9 @@
{ config, container, ... }: { util, config, container, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,15 +1,9 @@
{ { 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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,15 +1,9 @@
{ { 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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,15 +1,9 @@
{ { 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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,13 +1,11 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${address}:${toString port}; set ''$${name} ${address}:${toString port};

View file

@ -1,11 +1,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${cfg.address}:${toString cfg.port}; set ''$${name} ${cfg.address}:${toString cfg.port};

View file

@ -1,13 +1,11 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
listen 443 ssl; listen 443 ssl;
set ''$${name} ${address}:${toString port}; set ''$${name} ${address}:${toString port};
@ -27,3 +25,4 @@ in
''; '';
}; };
} }

View file

@ -1,15 +1,9 @@
{ { 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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,9 @@
{ container, config, ... }: { util, container, config, ... }: let
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 = '' extraConfig = util.trimTabs ''
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,20 +116,7 @@
# 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 = outputs = { self, nixpkgs, nixpkgsStable, nixpkgsMaster, nix-on-droid, home-manager, stylix, poetry2nixJobber, nixpkgsJobber, ... } @inputs: {
{
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";
@ -143,27 +130,21 @@
__findFile = _: p: ./${p}; __findFile = _: p: ./${p};
# List all files in a dir. # List all files in a dir.
findFiles = findFiles = path: map (f: "${path}/${f}") (
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 = devShells = let
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; [ ];
@ -173,19 +154,15 @@
}; };
# Nixos systems. # Nixos systems.
nixosConfigurations = nixosConfigurations = let
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 = mkHost = { system, hostname }: nixpkgs.lib.nixosSystem {
{ 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; }
@ -209,13 +186,11 @@
++ (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 = specialArgs = let
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;
@ -223,11 +198,8 @@
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 { container = import ./lib/Container.nix { inherit lib pkgs config; inherit (self) const; }; # Container utils.
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.
@ -240,16 +212,17 @@
inherit system hostname; inherit system hostname;
}; };
}; };
in in nixpkgs.lib.foldl' (acc: h: acc // h) {} (
nixpkgs.lib.foldl' (acc: h: acc // h) { } ( map (system:
map ( nixpkgs.lib.foldl' (acc: h: acc // h) {} (
system: map (host:
nixpkgs.lib.foldl' (acc: h: acc // h) { } ( mkSystem system host
map (host: mkSystem system host) (builtins.attrNames (builtins.readDir ./host/${system})) ) (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).
@ -258,33 +231,21 @@
# 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 = homeConfigurations = let
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 = mkCommonHome = username: homeDirectory: system: modules: let
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 inherit self inputs secret util pkgs pkgsStable pkgsMaster;
self
inputs
secret
util
pkgs
pkgsStable
pkgsMaster
;
inherit (self) const __findFile; inherit (self) const __findFile;
}; };
modules = [ modules = [
@ -302,22 +263,18 @@
{ 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 in nixpkgs.lib.foldl' (acc: h: acc // h) {} [
nixpkgs.lib.foldl' (acc: h: acc // h) { } [
x86LinuxRoot x86LinuxRoot
(x86LinuxHome "voronind" [ (x86LinuxHome "voronind" [
{ {
@ -329,13 +286,11 @@
]; ];
# Android. # Android.
nixOnDroidConfigurations.default = nixOnDroidConfigurations.default = let
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 in nix-on-droid.lib.nixOnDroidConfiguration {
nix-on-droid.lib.nixOnDroidConfiguration {
modules = [ modules = [
# Android release version. # Android release version.
{ system.stateVersion = self.const.droidStateVersion; } { system.stateVersion = self.const.droidStateVersion; }
@ -364,7 +319,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,25 +1,20 @@
# This is a common user configuration. # This is a common user configuration.
{ { const
const, , pkgs
pkgs, , self
self, , config
config, , lib
lib, , inputs
inputs, , pkgsStable
pkgsStable, , pkgsMaster
pkgsMaster, , __findFile
__findFile, , ... } @args: with lib; let
...
}@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;
in # homePath = "/data/data/com.termux.nix/files/home";
# homePath = "/data/data/com.termux.nix/files/home"; in {
{
options = { options = {
home.android = { home.android = {
enable = mkEnableOption "Android HM config."; enable = mkEnableOption "Android HM config.";

View file

@ -1,18 +1,13 @@
# This is a common user configuration. # This is a common user configuration.
{ { const
const, , util
util, , config
config, , lib
lib, , __findFile
__findFile, , ... } @args: with lib; let
...
}@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.";
@ -25,7 +20,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,24 +1,19 @@
# This is a common user configuration. # This is a common user configuration.
{ { const
const, , config
config, , util
util, , lib
lib, , pkgs
pkgs, , ... } @args: with lib; let
...
}@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;
}; };
}; };
@ -26,10 +21,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager = { home-manager = {
users = builtins.foldl' ( users = builtins.foldl' (acc: user: acc // {
acc: user:
acc
// {
${user.username} = { ${user.username} = {
home = { home = {
inherit (const) stateVersion; inherit (const) stateVersion;
@ -44,8 +36,7 @@ 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,12 +1,9 @@
{ pkgs, config, ... }: { pkgs, util, config, ... }: {
{ font = pkgs.runCommandNoCC "font" {} ''
font = pkgs.runCommandNoCC "font" { } '' cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
cp ${
pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }
}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
''; '';
colors = '' colors = util.trimTabs ''
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,6 +1,5 @@
{ ... }: { 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,5 +1,4 @@
{ ... }: { ... }: {
{
"org/gnome/desktop/a11y" = { "org/gnome/desktop/a11y" = {
always-show-universal-access-status = true; always-show-universal-access-status = true;
}; };

View file

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
"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,29 +1,10 @@
{ 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 = [ mru-sources = [ (mkTuple [ "xkb" "us" ]) (mkTuple [ "xkb" "ru" ]) ];
(mkTuple [
"xkb"
"us"
])
(mkTuple [
"xkb"
"ru"
])
];
per-window = false; per-window = false;
show-all-sources = true; show-all-sources = true;
sources = [ sources = [ (mkTuple [ "xkb" "us" ]) (mkTuple [ "xkb" "ru" ]) ];
(mkTuple [
"xkb"
"us"
])
(mkTuple [
"xkb"
"ru"
])
];
xkb-options = [ config.setting.keyboard.options ]; xkb-options = [ config.setting.keyboard.options ];
}; };

View file

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
"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,8 +1,6 @@
{ config, ... }: { config, ... }: let
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,5 +1,4 @@
{ ... }: { ... }: {
{
"org/gnome/desktop/media-handling" = { "org/gnome/desktop/media-handling" = {
automount = false; automount = false;
automount-open = false; automount-open = false;

View file

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

View file

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
"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,5 +1,4 @@
{ 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,5 +1,4 @@
{ 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,5 +1,4 @@
{ ... }: { ... }: {
{
"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,5 +1,4 @@
{ ... }: { ... }: {
{
"org/gnome/software" = { "org/gnome/software" = {
download-updates = false; download-updates = false;
download-updates-notify = false; download-updates-notify = false;

View file

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
"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,5 +1,4 @@
{ 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,10 +1,4 @@
{ { 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;
@ -22,8 +16,7 @@ let
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,6 +1,5 @@
{ pkgs, ... }: { pkgs, ... }: {
{ file = (pkgs.formats.iniWithGlobalSection {}).generate "EditorconfigConfig" {
file = (pkgs.formats.iniWithGlobalSection { }).generate "EditorconfigConfig" {
globalSection.root = true; globalSection.root = true;
sections = { sections = {
@ -8,17 +7,16 @@
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 = 4; indent_size = 2;
}; };
"*.nix" = { "*.{nix,js}" = {
indent_style = "space";
indent_size = 2; indent_size = 2;
}; };

View file

@ -1,11 +1,9 @@
{ config, pkgs, ... }: { config, pkgs, ... }: let
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,9 +1,7 @@
{ pkgs, config, ... }: { pkgs, config, ... }: let
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}";
@ -19,11 +17,9 @@ in
radius = 0; radius = 0;
width = 1; width = 1;
}; };
colors = colors = let
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,5 +1,4 @@
{ 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,6 +1,5 @@
{ ... }: { 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,6 +1,5 @@
{ ... }: { 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,4 +1,3 @@
{ util, ... }@args: { util, ... } @args: {
{
text = util.catFile (util.ls ./module) args; text = util.catFile (util.ls ./module) args;
} }

View file

@ -1,6 +1,5 @@
{ 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,6 +1,5 @@
{ 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,6 +1,5 @@
{ 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,6 +1,5 @@
{ 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,9 +1,7 @@
{ pkgs, config, ... }: { pkgs, config, ... }: let
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,6 +1,5 @@
{ 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;
@ -11,7 +10,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,26 +1,18 @@
{ { inputs, pkgs, util, ... } @args: let
inputs,
pkgs,
util,
...
}@args:
let
# Create Neovim configuration. # Create Neovim configuration.
nvimRc = nvimRc = { runtimes, configs }: let
{ runtimes, configs }:
let
# Plugin paths to install. # Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes; runtimeRc = util.trimTabs (builtins.foldl' (acc: r:
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 in runtimeRc + configRc;
runtimeRc + configRc; in {
in
{
text = nvimRc { text = nvimRc {
runtimes = [ runtimes = [
"~/.cache/nvim" "~/.cache/nvim"

View file

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
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,5 +1,4 @@
{ ... }: { ... }: {
{
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,29 +1,12 @@
{ config, lib, ... }: { config, lib, ... }: let
let
color = config.style.color; color = config.style.color;
mkHighlight = mkHighlight = name: value: ''vim.api.nvim_set_hl(0, "${name}", ${lib.generators.toLua { multiline = false; asBindings = false; } value})'';
name: value:
''vim.api.nvim_set_hl(0, "${name}", ${
lib.generators.toLua {
multiline = false;
asBindings = false;
} value
})'';
bg = { bg = { bg = "#${color.bg.regular}"; };
bg = "#${color.bg.regular}"; selection = { bg = "#${color.selection}"; fg = "#${color.fg.dark}"; bold = true; };
}; transparent = { bg = lib.generators.mkLuaInline "clear"; };
selection = { in {
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,5 +1,4 @@
{ ... }: { ... }: {
{
text = '' text = ''
vim.opt.hlsearch = true vim.opt.hlsearch = true
vim.opt.ignorecase = true vim.opt.ignorecase = true

View file

@ -1,8 +1,6 @@
{ ... }: { ... }: 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,5 +1,4 @@
{ ... }: { ... }: {
{
text = '' text = ''
-- Autocomplete. -- Autocomplete.
rekey_input("<C-space>", "<C-n>") rekey_input("<C-space>", "<C-n>")

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