reformating

This commit is contained in:
bogale 2026-11-21 16:57:39 +09:00
commit 35ce763bbf
15 changed files with 312 additions and 329 deletions

View file

@ -4,6 +4,7 @@
loader.timeout = 0;
};
environment.systemPackages = with pkgs; [
cryptsetup
ddrescue
efibootmgr
hdparm

View file

@ -22,7 +22,6 @@
};
environment.systemPackages = with pkgs; [
_7zz
cryptsetup
file
gptfdisk
jq

View file

@ -11,7 +11,6 @@
binutils
binwalk
exfat
nixfmt-tree
qemu
qrencode
];
@ -67,12 +66,7 @@
pulse.enable = true;
};
tuned.enable = true;
upower = {
allowRiskyCriticalPowerAction = true;
criticalPowerAction = "Suspend";
enable = true;
percentageCritical = 10;
};
upower.enable = true;
};
sops = {
secrets = {

View file

@ -14,11 +14,10 @@
kernelParams = [ "ttm.pages_limit=3014656" ];
};
fileSystems."/boot".device = "/dev/disk/by-uuid/2610-A769";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
swapDevices = [
{
device = "/var/lib/swapfile";
size = 15 * 1024;
size = 15360;
}
];
}

View file

@ -94,8 +94,7 @@
cd ${config.boot.kernelPackages.kernel.modules}/lib/modules/*/kernel/drivers/net/ethernet
find -type f | sed 's/^.*\/\([^.]*\).*$/ "\1"/' | sort
printf ' ];\n}\n') > /etc/nixos/bootable/ethernet.nix
nixos-install --flake "/etc/nixos#nixos-bootpxe" \
--no-channel-copy --no-root-passwd --root /srv/pxe/nixos
nixos-install --flake "/etc/nixos#nixos-bootpxe" --no-root-passwd --root /srv/pxe/nixos
'';
};
};

View file

@ -19,12 +19,9 @@
}:
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
nixosConfigurations = {
nixos-bootdrive = nixpkgs.lib.nixosSystem { modules = [ ./bootable/drive.nix ]; };
nixos-bootpxe = nixpkgs.lib.nixosSystem { modules = [ ./bootable/pxe.nix ]; };
nixos-desktop = nixpkgs.lib.nixosSystem {
modules = [
./desktop/configuration.nix
nixosConfigurations =
let
hostMods = users: [
home-manager.nixosModules.home-manager
{
home-manager = {
@ -32,29 +29,22 @@
useGlobalPkgs = true;
useUserPackages = true;
users = {
bogale = ./home/bogale.nix;
root = ./home/root.nix;
};
}
// users;
};
}
sops-nix.nixosModules.sops
];
makeSystem = modules: nixpkgs.lib.nixosSystem { inherit modules; };
in
{
nixos-bootdrive = makeSystem [ ./bootable/drive.nix ];
nixos-bootpxe = makeSystem [ ./bootable/pxe.nix ];
nixos-desktop = makeSystem (
[ ./desktop/configuration.nix ] ++ hostMods { bogale = ./home/bogale.nix; }
);
nixos-server = makeSystem ([ ./server/configuration.nix ] ++ hostMods { });
};
nixos-server = nixpkgs.lib.nixosSystem {
modules = [
./server/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = { inherit inputs; };
useGlobalPkgs = true;
useUserPackages = true;
users.root = ./home/root.nix;
};
}
sops-nix.nixosModules.sops
];
};
};
};
}

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: {
{ pkgs, ... }: {
dconf.settings."org/gnome/desktop/interface".gtk-enable-primary-paste = true;
gtk = {
colorScheme = "dark";
@ -8,7 +8,6 @@
homeDirectory = "/home/bogale";
packages = with pkgs; [
alacritty
bibata-cursors
bluez
ffmpeg-headless
heroic
@ -38,14 +37,11 @@
};
imports = [ ./common.nix ];
programs = {
bash = {
initExtra = ''
session() {
sudo machinectl shell root@
}
'';
sessionVariables.TTS_MODEL = "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF";
};
bash.initExtra = ''
session() {
sudo machinectl shell root@
}
'';
noctalia = {
enable = true;
settings = ./mods/noctalia.toml;

View file

@ -1,8 +1,8 @@
{ config, pkgs, ... }: {
{ pkgs, ... }: {
home = {
packages = [
pkgs.ncdu
pkgs.yt-dlp
packages = with pkgs; [
ncdu
yt-dlp
];
stateVersion = "26.11";
};

View file

@ -1,74 +1,74 @@
binds {
Alt+Print { screenshot-window; };
Ctrl+Print { screenshot-screen; };
Mod+Ctrl+H { focus-monitor-left; };
Mod+Ctrl+J { focus-monitor-down; };
Mod+Ctrl+K { focus-monitor-up; };
Mod+Ctrl+L { focus-monitor-right; };
Mod+Ctrl+Shift+H { move-column-to-monitor-left; };
Mod+Ctrl+Shift+J { move-column-to-monitor-down; };
Mod+Ctrl+Shift+K { move-column-to-monitor-up; };
Mod+Ctrl+Shift+L { move-column-to-monitor-right; };
Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; };
Mod+E { spawn-sh "noctalia msg panel-toggle session"; };
Mod+F { maximize-column; };
Mod+H { focus-column-left; };
Mod+J { focus-window-or-workspace-down; };
Mod+K { focus-window-or-workspace-up; };
Mod+L { focus-column-right; };
Mod+O { toggle-overview; };
Mod+Q { close-window; };
Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; };
Mod+Shift+F { fullscreen-window; };
Mod+Shift+H { move-column-left; };
Mod+Shift+J { move-window-down-or-to-workspace-down; };
Mod+Shift+K { move-window-up-or-to-workspace-up; };
Mod+Shift+L { move-column-right; };
Mod+Shift+P { power-off-monitors; };
Mod+Shift+S { spawn-sh "noctalia msg settings-open"; };
Mod+T { spawn "alacritty"; };
Print { screenshot; };
Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; };
Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; };
Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; };
XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; };
XF86AudioMute { spawn-sh "noctalia msg volume-mute"; };
XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; };
XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; };
XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; };
Alt+Print { screenshot-window; };
Ctrl+Print { screenshot-screen; };
Mod+Ctrl+H { focus-monitor-left; };
Mod+Ctrl+J { focus-monitor-down; };
Mod+Ctrl+K { focus-monitor-up; };
Mod+Ctrl+L { focus-monitor-right; };
Mod+Ctrl+Shift+H { move-column-to-monitor-left; };
Mod+Ctrl+Shift+J { move-column-to-monitor-down; };
Mod+Ctrl+Shift+K { move-column-to-monitor-up; };
Mod+Ctrl+Shift+L { move-column-to-monitor-right; };
Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; };
Mod+E { spawn-sh "noctalia msg panel-toggle session"; };
Mod+F { maximize-column; };
Mod+H { focus-column-left; };
Mod+J { focus-window-or-workspace-down; };
Mod+K { focus-window-or-workspace-up; };
Mod+L { focus-column-right; };
Mod+O { toggle-overview; };
Mod+Q { close-window; };
Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; };
Mod+Shift+F { fullscreen-window; };
Mod+Shift+H { move-column-left; };
Mod+Shift+J { move-window-down-or-to-workspace-down; };
Mod+Shift+K { move-window-up-or-to-workspace-up; };
Mod+Shift+L { move-column-right; };
Mod+Shift+S { spawn-sh "noctalia msg settings-open"; };
Mod+T { spawn "alacritty"; };
Print { screenshot; };
Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; };
Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; };
Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; };
XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; };
XF86AudioMute { spawn-sh "noctalia msg volume-mute"; };
XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; };
XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; };
XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; };
};
cursor {
xcursor-size 24;
xcursor-theme "Bibata-Modern-Amber";
xcursor-size 24;
xcursor-theme "Bibata-Modern-Amber";
};
gestures { hot-corners { off; }; };
hotkey-overlay { skip-at-startup; };
include "./noctalia.kdl";
input {
keyboard {
numlock;
xkb {
layout "us,ru";
options "grp:alt_shift_toggle";
};
};
touchpad {
dwt;
natural-scroll;
tap;
keyboard {
numlock;
xkb {
layout "us,ru";
options "grp:alt_shift_toggle";
};
};
touchpad {
dwt;
natural-scroll;
tap;
};
};
layout {
center-focused-column "always";
default-column-width { proportion 0.8; };
center-focused-column "always";
default-column-width { proportion 0.8; };
};
screenshot-path "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png";
window-rule {
clip-to-geometry true;
geometry-corner-radius 8;
open-floating false;
clip-to-geometry true;
geometry-corner-radius 8;
open-floating false;
};
window-rule {
match app-id="mpv";
open-fullscreen true;
match app-id="Waydroid";
match app-id="mpv";
open-fullscreen true;
};

View file

@ -1,14 +1,14 @@
[bar]
order = [ "default" ]
[bar.default]
center = [ "workspaces" ]
enabled = true
end = [ "tray", "keyboard_layout", "battery", "notifications" ]
margin_ends = 0
start = [ "date", "clock", "sysmon" ]
widget_spacing = 12
[bar.default.dead_zone.actions]
right = "none"
[bar.default]
center = [ "workspaces" ]
enabled = true
end = [ "tray", "keyboard_layout", "battery", "notifications" ]
margin_ends = 0
start = [ "date", "clock", "sysmon" ]
widget_spacing = 12
[bar.default.dead_zone.actions]
right = "none"
[[control_center.shortcuts]]
type = "wifi"
[[control_center.shortcuts]]
@ -16,21 +16,21 @@ type = "bluetooth"
[[control_center.shortcuts]]
type = "caffeine"
[[control_center.shortcuts]]
type = "notification"
type = "system"
[[control_center.shortcuts]]
type = "power_profile"
[[control_center.shortcuts]]
type = "weather"
type = "screen_time"
[idle]
behavior_order = [ "screen-off", "lock" ]
[idle.behavior.screen-off]
action = "screen_off"
enabled = true
timeout = 300.0
[idle.behavior.lock]
action = "lock"
enabled = true
timeout = 450.0
[idle.behavior.screen-off]
action = "screen_off"
enabled = true
timeout = 300.0
[idle.behavior.lock]
action = "lock"
enabled = true
timeout = 450.0
[location]
address = "Chita"
[notification]
@ -50,45 +50,45 @@ wifi = false
clipboard_enabled = false
launch_apps_as_systemd_services = true
screen_time_enabled = true
[shell.greeter_sync]
auto_sync = true
[shell.screen_corners]
enabled = true
[[shell.session.actions]]
action = "lock"
countdown_seconds = 0.0
enabled = true
shortcut = "1"
variant = "default"
[[shell.session.actions]]
action = "command"
command = "systemctl suspend-then-hibernate"
countdown_seconds = 0.0
enabled = true
glyph = "suspend"
label = "Сон"
shortcut = "2"
variant = "default"
[[shell.session.actions]]
action = "reboot"
countdown_seconds = 0.0
enabled = true
shortcut = "3"
variant = "default"
[[shell.session.actions]]
action = "shutdown"
countdown_seconds = 0.0
enabled = true
shortcut = "4"
variant = "default"
[shell.greeter_sync]
auto_sync = true
[shell.screen_corners]
enabled = true
[[shell.session.actions]]
action = "lock"
countdown_seconds = 0.0
enabled = true
shortcut = "1"
variant = "default"
[[shell.session.actions]]
action = "command"
command = "systemctl suspend-then-hibernate"
countdown_seconds = 0.0
enabled = true
glyph = "suspend"
label = "Сон"
shortcut = "2"
variant = "default"
[[shell.session.actions]]
action = "reboot"
countdown_seconds = 0.0
enabled = true
shortcut = "3"
variant = "default"
[[shell.session.actions]]
action = "shutdown"
countdown_seconds = 0.0
enabled = true
shortcut = "4"
variant = "default"
[theme]
builtin = "Tokyo-Night"
[theme.templates]
builtin_ids = [ "alacritty", "gtk3", "gtk4", "niri" ]
[theme.templates]
builtin_ids = [ "alacritty", "gtk3", "gtk4", "niri" ]
[wallpaper]
directory = "/home/bogale/Multimedia/Wallpapers"
transition_on_startup = true
[wallpaper.default]
path = "/home/bogale/Multimedia/Wallpapers/main.jpg"
[wallpaper.default]
path = "/home/bogale/Multimedia/Wallpapers/main.jpg"
[weather]
refresh_minutes = 10

View file

@ -9,9 +9,9 @@
initExtra = ''
awg-gen() {
PRIVATE=$(awg genkey)
echo "private: $PRIVATE"
printf "public: "
echo $PRIVATE | awg pubkey
echo "private: $PRIVATE"
printf "preshared: "
awg genpsk
}

View file

@ -1,4 +1,10 @@
{ config, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}:
{
boot = {
extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
kernelModules = [ "amneziawg" ];
@ -10,6 +16,7 @@
sops
];
fileSystems."/".device = "/dev/mapper/root";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
imports = [
../common.nix
./fs.nix

View file

@ -16,5 +16,4 @@
];
};
fileSystems."/boot".device = "/dev/disk/by-uuid/86F4-A8F1";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

80
server/mods/services.nix Normal file
View file

@ -0,0 +1,80 @@
{ config, pkgs, ... }: {
services = {
forgejo = {
database.type = "postgres";
enable = true;
settings = {
mailer = {
ENABLED = true;
FROM = "Forgejo <forgejo@bogaledev.ru>";
SMTP_ADDR = "localhost";
SMTP_PORT = 25;
};
server = {
HTTP_ADDR = "/run/forgejo/forgejo.sock";
PROTOCOL = "http+unix";
ROOT_URL = "https://bogaledev.ru/git/";
SSH_PORT = 32831;
};
service = {
ENABLE_CAPTCHA = true;
REGISTER_EMAIL_CONFIRM = true;
};
};
};
grafana = {
enable = true;
settings = {
database = {
host = "/run/postgresql";
type = "postgres";
user = "grafana";
};
security.secret_key = "$__file{${config.sops.secrets.grafana-key.path}}";
server = {
enable_gzip = true;
protocol = "socket";
root_url = "https://bogaledev.ru/grafana";
};
};
};
nextcloud = {
config.dbtype = "pgsql";
database.createLocally = true;
enable = true;
hostName = "nextcloud-local";
maxUploadSize = "4G";
poolSettings = config.services.phpfpm.pools.php.settings;
settings = {
overwritewebroot = "/nextcloud";
trusted_domains = [
"bogaledev.ru"
"wl.bogaledev.ru"
];
};
};
vaultwarden = {
config = {
DOMAIN = "https://bogaledev.ru/vaultwarden/";
EMERGENCY_ACCESS_ALLOWED = false;
PASSWORD_HINTS_ALLOWED = false;
ROCKET_PORT = 46151;
SIGNUPS_ALLOWED = false;
TRASH_AUTO_DELETE_DAYS = 90;
};
configurePostgres = true;
dbBackend = "postgresql";
enable = true;
environmentFile = config.sops.secrets.vaultwarden-env.path;
package = pkgs.vaultwarden-postgresql;
};
};
sops.secrets = {
grafana-key = {
group = "grafana";
mode = "0440";
restartUnits = [ "grafana.service" ];
};
vaultwarden-env.restartUnits = [ "vaultwarden.service" ];
};
}

View file

@ -1,179 +1,98 @@
{ config, pkgs, ... }: {
services =
let
phpSettings = {
services = {
nginx = {
clientMaxBodySize = "4G";
enable = true;
recommendedBrotliSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts = {
nextcloud-local.listen = [
{
addr = "localhost";
port = 45837;
}
];
main =
let
localNetworks = ''
allow 10.0.0.0/16;
allow fc00::/64;
deny all;
'';
phpPool = ''
index index.php index.html;
location ~ \.php$ {
fastcgi_pass unix:${config.services.phpfpm.pools.php.socket};
}
'';
in
{
default = true;
extraConfig = ''
add_header Alt-Svc 'h3=":443"; ma=2592000' always;
add_header X-Content-Type-Options 'nosniff' always;
'';
forceSSL = true;
locations = {
"/".extraConfig = phpPool;
"/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/";
"/grafana/".proxyPass = "http://unix:/run/grafana/grafana.sock:/";
"/local/".extraConfig = "${phpPool} ${localNetworks}";
"/nextcloud/".proxyPass = "http://localhost:45837/";
"/vaultwarden/" = {
extraConfig = localNetworks;
proxyPass = "http://localhost:46151";
proxyWebsockets = true;
};
};
quic = true;
root = "/srv/http";
useACMEHost = "bogaledev.ru";
};
};
};
phpfpm.pools.php = {
group = "php";
settings = {
"listen.group" = "nginx";
"listen.owner" = "nginx";
"pm" = "ondemand";
"pm.max_children" = 4;
};
sslCertDir = config.security.acme.certs."bogaledev.ru".directory;
in
{
forgejo = {
database.type = "postgres";
enable = true;
settings = {
mailer = {
ENABLED = true;
FROM = "Forgejo <forgejo@bogaledev.ru>";
SMTP_ADDR = "localhost";
SMTP_PORT = 25;
user = "php";
};
postgresql = {
enable = true;
ensureDatabases = [
"grafana"
"php"
];
ensureUsers =
let
user = name: {
ensureDBOwnership = true;
inherit name;
};
server = {
HTTP_ADDR = "/run/forgejo/forgejo.sock";
PROTOCOL = "http+unix";
ROOT_URL = "https://bogaledev.ru/git/";
SSH_PORT = 32831;
};
service = {
ENABLE_CAPTCHA = true;
REGISTER_EMAIL_CONFIRM = true;
};
};
};
grafana = {
enable = true;
settings = {
database = {
host = "/run/postgresql";
type = "postgres";
user = "grafana";
};
security.secret_key = "$__file{${config.sops.secrets.grafana-key.path}}";
server = {
enable_gzip = true;
protocol = "socket";
root_url = "https://bogaledev.ru/grafana";
};
};
};
nextcloud = {
config.dbtype = "pgsql";
database.createLocally = true;
enable = true;
hostName = "nextcloud-local";
maxUploadSize = "4G";
poolSettings = phpSettings;
settings = {
overwritewebroot = "/nextcloud";
trusted_domains = [
"bogaledev.ru"
"wl.bogaledev.ru"
];
};
};
nginx = {
clientMaxBodySize = "4G";
enable = true;
recommendedBrotliSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts = {
nextcloud-local.listen = [
{
addr = "localhost";
port = 45837;
}
];
main =
let
localNetworks = ''
allow 10.0.0.0/16;
allow fc00::/64;
deny all;
'';
phpPool = ''
index index.php index.html;
location ~ \.php$ {
fastcgi_pass unix:${config.services.phpfpm.pools.php.socket};
}
'';
in
{
default = true;
extraConfig = ''
add_header Alt-Svc 'h3=":443"; ma=2592000' always;
add_header X-Content-Type-Options 'nosniff' always;
'';
forceSSL = true;
locations = {
"/".extraConfig = phpPool;
"/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/";
"/grafana/".proxyPass = "http://unix:/run/grafana/grafana.sock:/";
"/local/".extraConfig = "${phpPool} ${localNetworks}";
"/nextcloud/".proxyPass = "http://localhost:45837/";
"/vaultwarden/" = {
extraConfig = localNetworks;
proxyPass = "http://localhost:46151";
proxyWebsockets = true;
};
};
quic = true;
root = "/srv/http";
useACMEHost = "bogaledev.ru";
};
};
};
phpfpm.pools.php = {
group = "php";
settings = phpSettings;
user = "php";
};
postgresql = {
enable = true;
ensureDatabases = [
in
map user [
"grafana"
"php"
];
ensureUsers =
let
user = name: {
ensureDBOwnership = true;
inherit name;
};
in
map user [
"grafana"
"php"
];
};
postgresqlBackup = {
compression = "none";
databases = [
"forgejo"
"grafana"
"nextcloud"
"php"
"vaultwarden"
];
enable = true;
startAt = "16:00";
};
vaultwarden = {
config = {
DOMAIN = "https://bogaledev.ru/vaultwarden/";
EMERGENCY_ACCESS_ALLOWED = false;
PASSWORD_HINTS_ALLOWED = false;
ROCKET_PORT = 46151;
SIGNUPS_ALLOWED = false;
TRASH_AUTO_DELETE_DAYS = 90;
};
configurePostgres = true;
dbBackend = "postgresql";
enable = true;
environmentFile = config.sops.secrets.vaultwarden-env.path;
package = pkgs.vaultwarden-postgresql;
};
};
sops.secrets = {
grafana-key = {
group = "grafana";
mode = "0440";
restartUnits = [ "grafana.service" ];
postgresqlBackup = {
compression = "none";
databases = [
"forgejo"
"grafana"
"nextcloud"
"php"
"vaultwarden"
];
enable = true;
startAt = "16:00";
};
vaultwarden-env.restartUnits = [ "vaultwarden.service" ];
};
}