Compare commits

..

2 Commits
master ... test

Author SHA1 Message Date
8a987487d1
test 2024-08-04 15:44:57 +02:00
af9459ba81
miner installer 2024-08-04 15:34:50 +02:00
14 changed files with 524 additions and 847 deletions

View File

@ -21,4 +21,4 @@ generate format="install-iso" config="install-iso":
nix shell nixpkgs#nixos-generators --command nixos-generate -f {{format}} --flake ./#{{config}}
vps:
nixos-rebuild switch --flake ./#vps --target-host root@37.205.13.29
nixos-rebuild switch --flake ./#mailserver --target-host root@10.0.0.1

View File

@ -1,8 +1,8 @@
top @ { inputs, ... }: {
top@{ inputs, ... }: {
imports = [ ./nixos ./home ./packages ./overlays ./hardware-configurations ];
systems = [ "x86_64-linux" ];
flake.stateVersion = "24.05";
perSystem = { system, ... }: {
perSystem = perSystem@{ system, ... }: {
config._module.args = {
pkgs = import inputs.nixpkgs {
inherit system;

View File

@ -672,11 +672,11 @@
]
},
"locked": {
"lastModified": 1725863684,
"narHash": "sha256-HmdTBpuCsw35Ii35JUKO6AE6nae+kJliQb0XGd4hoLE=",
"lastModified": 1722462338,
"narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "be47a2bdf278c57c2d05e747a13ed31cef54a037",
"rev": "6e090576c4824b16e8759ebca3958c5b09659ee8",
"type": "github"
},
"original": {
@ -737,11 +737,11 @@
]
},
"locked": {
"lastModified": 1725674607,
"narHash": "sha256-vTaoz2yRd9g3NZNKYufZeB8UJ381aBPmRV91lEmV37o=",
"lastModified": 1722388081,
"narHash": "sha256-gJkry8rSaaZw+d+frABPgVjqBznCa7Jr3A5YLChSR4o=",
"owner": "StevenBlack",
"repo": "hosts",
"rev": "10b187280ec15374e4d2b28e7705046e7d535d91",
"rev": "d6039e35d071480c309363eff2690e8b963ab06a",
"type": "github"
},
"original": {
@ -806,11 +806,11 @@
]
},
"locked": {
"lastModified": 1725237485,
"narHash": "sha256-POpzmA7+ecCUEZsu2a5fgwYhJ60POzve+lMhxebmTz4=",
"lastModified": 1722213035,
"narHash": "sha256-FrJRRFbaJFm2iW1jddLbcSJwQmk3afMSwYm+7IBxeaw=",
"owner": "musnix",
"repo": "musnix",
"rev": "b5f3a47fd74193cb98c85cfeb6a25358150bdd90",
"rev": "0e23bb501576ae18b4d19836a91e12c87e4931ee",
"type": "github"
},
"original": {
@ -951,11 +951,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725634671,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
"lastModified": 1722421184,
"narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
"rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
"type": "github"
},
"original": {
@ -1068,11 +1068,11 @@
]
},
"locked": {
"lastModified": 1725234343,
"narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=",
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "567b938d64d4b4112ee253b9274472dc3a346eb6",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
@ -1128,11 +1128,11 @@
"nixpkgs-24_05": "nixpkgs-24_05"
},
"locked": {
"lastModified": 1722877200,
"narHash": "sha256-qgKDNJXs+od+1UbRy62uk7dYal3h98I4WojfIqMoGcg=",
"lastModified": 1721121314,
"narHash": "sha256-zwc7YXga/1ppaZMWFreZykXtFwBgXodxUZiUx969r+g=",
"owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver",
"rev": "af7d3bf5daeba3fc28089b015c0dd43f06b176f2",
"rev": "059b50b2e729729ea00c6831124d3837c494f3d5",
"type": "gitlab"
},
"original": {
@ -1248,11 +1248,11 @@
},
"vpsadminos": {
"locked": {
"lastModified": 1725810385,
"narHash": "sha256-+6UULi05KMHmLfhlrNGhMdLZUoQeC5Dc1nLFdINyeyI=",
"lastModified": 1722101851,
"narHash": "sha256-fM5Z8Qhk9/AbGYJ4VrJilGlFK9btBEF+ROtbYYJZJ1I=",
"owner": "vpsfreecz",
"repo": "vpsadminos",
"rev": "37c5eb47ca3f11deac83e4ada20a6c21d5487f29",
"rev": "2c8ff8462a6f4aefb7bd2663d6ddbedd9d161f2c",
"type": "github"
},
"original": {

View File

@ -20,10 +20,7 @@
};
sal = {
url = "github:ivandimitrov8080/sal";
inputs = {
nixpkgs.follows = "nixpkgs";
ide.follows = "ide";
};
inputs = { nixpkgs.follows = "nixpkgs"; ide.follows = "ide"; };
};
musnix = {
url = "github:musnix/musnix";
@ -38,5 +35,5 @@
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: inputs.parts.lib.mkFlake {inherit inputs;} {imports = [./.];};
outputs = inputs: inputs.parts.lib.mkFlake { inherit inputs; } { imports = [ ./. ]; };
}

View File

@ -1,4 +1,4 @@
_: {
top@{ ... }: {
flake.hardwareConfigurations = {
nova = { lib, modulesPath, ... }: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@ -12,14 +12,8 @@ _: {
extraModulePackages = [ ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/47536cbe-7265-493b-a2e3-bbd376a6f9af";
fsType = "btrfs";
};
"/boot" = {
device = "/dev/disk/by-uuid/4C3C-993A";
fsType = "vfat";
};
"/" = { device = "/dev/disk/by-uuid/47536cbe-7265-493b-a2e3-bbd376a6f9af"; fsType = "btrfs"; };
"/boot" = { device = "/dev/disk/by-uuid/4C3C-993A"; fsType = "vfat"; };
};
swapDevices = [ ];
networking.useDHCP = lib.mkForce true;

19
home/configs/default.nix Normal file
View File

@ -0,0 +1,19 @@
toplevel@{ inputs, withSystem, config, ... }:
{
flake.homeConfigurations.ivand = withSystem "x86_64-linux" (ctx@{ pkgs, ... }:
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules =
let
mods = config.flake.homeManagerModules;
in
with mods; [
base
ivand
shell
util
swayland
web
];
});
}

View File

@ -1,3 +1,3 @@
{
imports = [./modules];
imports = [ ./modules ./configs ];
}

View File

@ -1,7 +1,8 @@
toplevel @ { moduleWithSystem, ... }: {
toplevel@{ moduleWithSystem, ... }: {
flake.homeManagerModules = {
base = moduleWithSystem (
_: { config, ... }: {
top@{ ... }:
perSystem@{ config, ... }: {
programs.home-manager.enable = true;
home.stateVersion = toplevel.config.flake.stateVersion;
xdg = {
@ -23,7 +24,8 @@ toplevel @ { moduleWithSystem, ... }: {
}
);
ivand = moduleWithSystem (
_: { pkgs, ... }: {
top@{ ... }:
perSystem@{ pkgs, ... }: {
home = {
username = "ivand";
homeDirectory = "/home/ivand";
@ -34,148 +36,71 @@ toplevel @ { moduleWithSystem, ... }: {
git = with pkgs.lib; {
userName = mkForce "Ivan Kirilov Dimitrov";
userEmail = mkForce "ivan@idimitrov.dev";
signing = mkForce {
signByDefault = true;
key = "ivan@idimitrov.dev";
};
signing = mkForce { signByDefault = true; key = "ivan@idimitrov.dev"; };
};
ssh = {
matchBlocks = {
vpsfree-ivand = {
hostname = "10.0.0.1";
user = "ivand";
};
vpsfree-root = {
hostname = "10.0.0.1";
user = "root";
};
vpsfree-ivand = { hostname = "10.0.0.1"; user = "ivand"; };
vpsfree-root = { hostname = "10.0.0.1"; user = "root"; };
};
};
};
}
);
util = moduleWithSystem (
_: { pkgs
, config
, ...
}: {
top@{ ... }:
perSystem@{ pkgs, config, ... }: {
home = {
packages = with pkgs; [ openssl mlocate uutils-coreutils-noprefix speedtest-cli ];
sessionVariables = {
PAGER = "bat";
BAT_THEME = "catppuccin-mocha";
};
sessionVariables = { PAGER = "bat"; BAT_THEME = "catppuccin-mocha"; };
};
programs = {
password-store = {
enable = true;
package = pkgs.pass.withExtensions (e: with e; [ pass-otp pass-file ]);
settings = { PASSWORD_STORE_DIR = "${config.home.homeDirectory}/.password-store"; };
};
password-store = { enable = true; package = pkgs.pass.withExtensions (e: with e; [ pass-otp pass-file ]); settings = { PASSWORD_STORE_DIR = "${config.home.homeDirectory}/.password-store"; }; };
git = {
enable = true;
delta.enable = true;
extraConfig = {
color.ui = "auto";
pull.rebase = true;
push.autoSetupRemote = true;
};
aliases = {
a = "add .";
c = "commit";
d = "diff --cached";
p = "push";
pa = "!git remote | xargs -L1 git push --all";
};
extraConfig = { color.ui = "auto"; pull.rebase = true; push.autoSetupRemote = true; };
aliases = { a = "add ."; c = "commit"; d = "diff --cached"; p = "push"; pa = "!git remote | xargs -L1 git push --all"; };
};
tealdeer = {
enable = true;
settings = {
display = { compact = true; };
updates = { auto_update = true; };
};
settings = { display = { compact = true; }; updates = { auto_update = true; }; };
};
bottom = {
enable = true;
settings = {
flags = { rate = "250ms"; };
row = [
{
ratio = 40;
child = [{ type = "cpu"; } { type = "mem"; } { type = "net"; }];
}
{
ratio = 35;
child = [{ type = "temp"; } { type = "disk"; }];
}
{
ratio = 40;
child = [
{
type = "proc";
default = true;
}
];
}
{ ratio = 40; child = [{ type = "cpu"; } { type = "mem"; } { type = "net"; }]; }
{ ratio = 35; child = [{ type = "temp"; } { type = "disk"; }]; }
{ ratio = 40; child = [{ type = "proc"; default = true; }]; }
];
};
};
fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
nix-index = {
enable = true;
enableZshIntegration = false;
enableBashIntegration = false;
};
fzf = { enable = true; enableBashIntegration = true; enableZshIntegration = true; };
nix-index = { enable = true; enableZshIntegration = false; enableBashIntegration = false; };
bat = {
enable = true;
themes =
let
catppuccin = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "82e7ca555f805b53d2b377390e4ab38c20282e83";
sha256 = "sha256-/Ob9iCVyjJDBCXlss9KwFQTuxybmSSzYRBZxOT10PZg=";
};
catppuccin = pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "bat"; rev = "82e7ca555f805b53d2b377390e4ab38c20282e83"; sha256 = "sha256-/Ob9iCVyjJDBCXlss9KwFQTuxybmSSzYRBZxOT10PZg="; };
in
{
catppuccin-mocha = {
src = catppuccin;
file = "themes/Catppuccin Mocha.tmTheme";
};
catppuccin-macchiato = {
src = catppuccin;
file = "themes/Catppuccin Macchiato.tmTheme";
};
catppuccin-frappe = {
src = catppuccin;
file = "themes/Catppuccin Frappe.tmTheme";
};
catppuccin-latte = {
src = catppuccin;
file = "themes/Catppuccin Latte.tmTheme";
};
catppuccin-mocha = { src = catppuccin; file = "themes/Catppuccin Mocha.tmTheme"; };
catppuccin-macchiato = { src = catppuccin; file = "themes/Catppuccin Macchiato.tmTheme"; };
catppuccin-frappe = { src = catppuccin; file = "themes/Catppuccin Frappe.tmTheme"; };
catppuccin-latte = { src = catppuccin; file = "themes/Catppuccin Latte.tmTheme"; };
};
};
ssh.enable = true;
gpg.enable = true;
};
services = {
gpg-agent = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableNushellIntegration = true;
pinentryPackage = pkgs.pinentry-qt;
};
};
services = { gpg-agent = { enable = true; enableBashIntegration = true; enableZshIntegration = true; enableNushellIntegration = true; pinentryPackage = pkgs.pinentry-qt; }; };
}
);
shell = moduleWithSystem (
_: { pkgs, ... }: {
top@{ ... }:
perSystem@{ pkgs, ... }: {
programs =
let
shellAliases = {
@ -215,17 +140,10 @@ toplevel @ { moduleWithSystem, ... }: {
};
nushell = {
enable = true;
environmentVariables = { config = ''{ show_banner: false, completions: { quick: false partial: false algorithm: "prefix" } } ''; };
shellAliases = {
gcal = ''bash -c "cal $(date +%Y)" '';
la = "ls -al";
dev = "nix develop --command $env.SHELL";
};
};
kitty.shellIntegration = {
enableBashIntegration = true;
enableZshIntegration = true;
environmentVariables = { config = '' { show_banner: false, completions: { quick: false partial: false algorithm: "prefix" } } ''; };
shellAliases = { gcal = '' bash -c "cal $(date +%Y)" ''; la = "ls -al"; dev = "nix develop --command $env.SHELL"; };
};
kitty.shellIntegration = { enableBashIntegration = true; enableZshIntegration = true; };
tmux = {
enable = true;
clock24 = true;
@ -239,12 +157,7 @@ toplevel @ { moduleWithSystem, ... }: {
set-option -a terminal-features 'screen-256color:RGB'
'';
};
starship = {
enable = true;
enableNushellIntegration = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
starship = { enable = true; enableNushellIntegration = true; enableZshIntegration = true; enableBashIntegration = true; };
eza = {
enable = true;
enableZshIntegration = true;
@ -263,18 +176,11 @@ toplevel @ { moduleWithSystem, ... }: {
}
);
swayland = moduleWithSystem (
_: { pkgs
, config
, ...
}: {
top@{ ... }:
perSystem@{ pkgs, config, ... }: {
home = {
packages = with pkgs; [ audacity gimp grim libnotify libreoffice-qt mupdf slurp transmission_4 wl-clipboard xdg-user-dirs xdg-utils xwayland telegram-desktop ];
pointerCursor = with pkgs; {
name = "catppuccin-mocha-green-cursors";
package = catppuccin-cursors.mochaGreen;
size = 24;
gtk.enable = true;
};
packages = with pkgs; [ audacity gimp grim libnotify libreoffice-qt mupdf slurp transmission_4 wl-clipboard xdg-user-dirs xdg-utils xwayland ];
pointerCursor = with pkgs; { name = "catppuccin-mocha-green-cursors"; package = catppuccin-cursors.mochaGreen; size = 24; gtk.enable = true; };
};
wayland.windowManager.sway = {
enable = true;
@ -307,21 +213,17 @@ toplevel @ { moduleWithSystem, ... }: {
"${modifier}+Shift+c" = "kill";
"${modifier}+Shift+q" = "exit";
};
input = {
"*" = {
xkb_layout = "us,bg";
xkb_options = "grp:win_space_toggle";
xkb_variant = ",phonetic";
input = { "*" = { xkb_layout = "us,bg"; xkb_options = "grp:win_space_toggle"; xkb_variant = ",phonetic"; }; };
};
};
};
swaynag = { inherit (config.wayland.windowManager.sway) enable; };
swaynag = { enable = config.wayland.windowManager.sway.enable; };
};
programs = {
waybar = {
enable = true;
settings = {
mainBar =
let
in
{
layer = "top";
position = "top";
@ -332,47 +234,28 @@ toplevel @ { moduleWithSystem, ... }: {
modules-center = [ "clock#week" "clock#year" "clock#time" ];
modules-right = [ "network" "pulseaudio" "memory" "cpu" "battery" ];
"clock#time" = {
format = "{:%H:%M:%S}";
interval = 1;
tooltip = false;
};
"clock#week" = {
format = "{:%a}";
tooltip = false;
};
"clock#year" = {
format = "{:%Y-%m-%d}";
tooltip = false;
};
"clock#time" = { format = "{:%H:%M:%S}"; interval = 1; tooltip = false; };
"clock#week" = { format = "{:%a}"; tooltip = false; };
"clock#year" = { format = "{:%Y-%m-%d}"; tooltip = false; };
battery = {
format = "{icon} <span color='#cdd6f4'>{capacity}% {time}</span>";
format-time = " {H} h {M} m";
format-icons = [ "" "" "" "" "" ];
states = {
warning = 30;
critical = 15;
};
states = { warning = 30; critical = 15; };
tooltip = false;
};
cpu = { format = "<span color='#74c7ec'></span> {usage}%"; };
memory = {
format = "<span color='#89b4fa'></span> {percentage}%";
interval = 5;
};
memory = { format = "<span color='#89b4fa'></span> {percentage}%"; interval = 5; };
pulseaudio = {
format = "<span color='#a6e3a1'>{icon}</span> {volume}% | {format_source}";
format-muted = "<span color='#f38ba8'>󰝟</span> {volume}% | {format_source}";
format-source = "{volume}% <span color='#a6e3a1'></span>";
format-source-muted = "{volume}% <span color='#f38ba8'></span>";
format-icons = {
headphone = "";
default = [ "" "" "" ];
};
format-icons = { headphone = ""; default = [ "" "" "" ]; };
tooltip = false;
};
@ -385,16 +268,10 @@ toplevel @ { moduleWithSystem, ... }: {
tooltip = false;
};
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
"sway/workspaces" = { disable-scroll = true; all-outputs = true; };
};
};
};
systemd = {
enable = true;
target = "sway-session.target";
};
systemd = { enable = true; target = "sway-session.target"; };
style = ''
@define-color rosewater #f5e0dc;
@define-color flamingo #f2cdcd;
@ -524,14 +401,12 @@ toplevel @ { moduleWithSystem, ... }: {
animation-iteration-count: infinite;
animation-direction: alternate;
}
'';
''
;
};
swaylock = {
enable = true;
settings = {
show-failed-attempts = true;
image = config.home.homeDirectory + "/pic/bg.png";
};
settings = { show-failed-attempts = true; image = config.home.homeDirectory + "/pic/bg.png"; };
};
rofi = {
enable = true;
@ -551,52 +426,22 @@ toplevel @ { moduleWithSystem, ... }: {
};
kitty = {
enable = true;
font = {
package = pkgs.fira-code;
name = "FiraCodeNFM-Reg";
};
settings = {
background_opacity = "0.90";
cursor_shape = "beam";
};
};
imv = {
enable = true;
settings = { options.fullscreen = true; };
};
mpv = {
enable = true;
scripts = with pkgs.mpvScripts; [ uosc thumbfast ];
};
bash.profileExtra = ''[ "$(tty)" = "/dev/tty1" ] && exec sway '';
zsh.loginExtra = ''[ "$(tty)" = "/dev/tty1" ] && exec sway '';
nushell.loginFile.text = ''if (tty) == "/dev/tty1" { sway } '';
};
services = {
mako.enable = true;
cliphist = {
enable = true;
systemdTarget = "sway-session.target";
font = { package = pkgs.fira-code; name = "FiraCodeNFM-Reg"; };
settings = { background_opacity = "0.90"; cursor_shape = "beam"; };
};
imv = { enable = true; settings = { options.fullscreen = true; }; };
mpv = { enable = true; scripts = with pkgs.mpvScripts; [ uosc thumbfast ]; };
bash.profileExtra = '' [ "$(tty)" = "/dev/tty1" ] && exec sway '';
zsh.loginExtra = '' [ "$(tty)" = "/dev/tty1" ] && exec sway '';
nushell.loginFile.text = '' if (tty) == "/dev/tty1" { sway } '';
};
services = { mako.enable = true; cliphist = { enable = true; systemdTarget = "sway-session.target"; }; };
systemd.user = {
timers = {
rbingwp = {
Timer = {
OnCalendar = "*-*-* 10:00:00";
Persistent = true;
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
timers = { rbingwp = { Timer = { OnCalendar = "*-*-* 10:00:00"; Persistent = true; }; Install = { WantedBy = [ "timers.target" ]; }; }; };
services = {
wpd = {
Install = { WantedBy = [ "sway-session.target" ]; };
Unit = {
Description = "Switch background every x minutes";
After = "graphical-session-pre.target";
PartOf = "graphical-session.target";
};
Unit = { Description = "Switch background every x minutes"; After = "graphical-session-pre.target"; PartOf = "graphical-session.target"; };
Service = {
ExecStart = [ "${pkgs.wpd}/bin/wpd" ];
};
@ -619,27 +464,18 @@ toplevel @ { moduleWithSystem, ... }: {
}
);
web = moduleWithSystem (
_: _: {
top@{ ... }:
perSystem@{ ... }: {
programs = {
browserpass.enable = true;
firefox = {
enable = true;
profiles.ivand = {
id = 0;
search = {
default = "DuckDuckGo";
privateDefault = "DuckDuckGo";
force = true;
};
search = { default = "DuckDuckGo"; privateDefault = "DuckDuckGo"; force = true; };
bookmarks = [
{
name = "home-options";
url = "https://nix-community.github.io/home-manager/options.xhtml";
}
{
name = "nixvim-docs";
url = "https://nix-community.github.io/nixvim/";
}
{ name = "home-options"; url = "https://nix-community.github.io/home-manager/options.xhtml"; }
{ name = "nixvim-docs"; url = "https://nix-community.github.io/nixvim/"; }
];
settings = {
"general.smoothScroll" = true;
@ -663,52 +499,18 @@ toplevel @ { moduleWithSystem, ... }: {
TranslateEnabled = false;
SearchBar = "unified";
SearchSuggestEnabled = false;
SanitizeOnShutdown = {
Cache = true;
FormData = true;
Locked = true;
Cookies = false;
Downloads = false;
History = false;
Sessions = false;
SiteSettings = false;
OfflineApps = true;
};
FirefoxHome = {
Search = true;
Pocket = false;
Snippets = false;
TopSites = false;
Highlights = false;
};
UserMessaging = {
ExtensionRecommendations = false;
FeatureRecommendations = false;
UrlbarInterventions = false;
MoreFromMozilla = false;
SkipOnboarding = true;
};
SanitizeOnShutdown = { Cache = true; FormData = true; Locked = true; Cookies = false; Downloads = false; History = false; Sessions = false; SiteSettings = false; OfflineApps = true; };
FirefoxHome = { Search = true; Pocket = false; Snippets = false; TopSites = false; Highlights = false; };
UserMessaging = { ExtensionRecommendations = false; FeatureRecommendations = false; UrlbarInterventions = false; MoreFromMozilla = false; SkipOnboarding = true; };
Handlers = {
schemes = {
mailto = {
action = "useHelperApp";
ask = false;
handlers = [
{
name = "RoundCube";
uriTemplate = "https://mail.idimitrov.dev/?_task=mail&_action=compose&_to=%s";
}
];
mailto = { action = "useHelperApp"; ask = false; handlers = [{ name = "RoundCube"; uriTemplate = "https://mail.idimitrov.dev/?_task=mail&_action=compose&_to=%s"; }]; };
};
};
};
};
};
chromium = {
enable = true;
};
};
xdg.mimeApps.defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";

View File

@ -0,0 +1,283 @@
{ config, pkgs, ... }: {
fileSystems."/mnt/export1981" = {
device = "172.16.128.47:/nas/5490";
fsType = "nfs";
options = [ "nofail" ];
};
security = {
acme = {
acceptTerms = true;
defaults.email = "security@idimitrov.dev";
};
};
networking = {
nameservers = [ "127.0.0.1" "::1" ];
dhcpcd.extraConfig = "nohook resolv.conf";
firewall = pkgs.lib.mkForce {
enable = true;
allowedTCPPorts = [
25 # smtp
465 # smtps
80 # http
443 # https
];
allowedUDPPorts = [
25
465
80
443
51820 # wireguard
];
extraCommands = ''
iptables -N vpn # create a new chain named vpn
iptables -A vpn --src 10.0.0.2 -j ACCEPT # allow
iptables -A vpn --src 10.0.0.3 -j ACCEPT # allow
iptables -A vpn --src 10.0.0.4 -j ACCEPT # allow
iptables -A vpn -j DROP # drop everyone else
iptables -I INPUT -m tcp -p tcp --dport 22 -j vpn
'';
extraStopCommands = ''
iptables -F vpn
iptables -D INPUT -m tcp -p tcp --dport 22 -j vpn
iptables -X vpn
'';
};
nat = {
enable = true;
enableIPv6 = true;
externalInterface = "venet0";
internalInterfaces = [ "wg0" ];
};
wg-quick.interfaces = {
wg0 = {
address = [ "10.0.0.1/32" ];
listenPort = 51820;
privateKeyFile = "/etc/wireguard/privatekey";
postUp = ''
${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -j ACCEPT
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.0.0.1/24 -o venet0 -j MASQUERADE
${pkgs.iptables}/bin/ip6tables -A FORWARD -i wg0 -j ACCEPT
${pkgs.iptables}/bin/ip6tables -t nat -A POSTROUTING -s fdc9:281f:04d7:9ee9::1/64 -o venet0 -j MASQUERADE
'';
preDown = ''
${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -j ACCEPT
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.0.0.1/24 -o venet0 -j MASQUERADE
${pkgs.iptables}/bin/ip6tables -D FORWARD -i wg0 -j ACCEPT
${pkgs.iptables}/bin/ip6tables -t nat -D POSTROUTING -s fdc9:281f:04d7:9ee9::1/64 -o venet0 -j MASQUERADE
'';
peers = [
{
publicKey = "kI93V0dVKSqX8hxMJHK5C0c1hEDPQTgPQDU8TKocVgo=";
allowedIPs = [ "10.0.0.2/32" ];
}
{
publicKey = "RqTsFxFCcgYsytcDr+jfEoOA5UNxa1ZzGlpx6iuTpXY=";
allowedIPs = [ "10.0.0.3/32" ];
}
];
};
};
};
users = {
users.ivand = {
isNormalUser = true;
hashedPassword =
"$2b$05$hPrPcewxj4qjLCRQpKBAu.FKvKZdIVlnyn4uYsWE8lc21Jhvc9jWG";
extraGroups = [ "wheel" "adm" "mlocate" ];
openssh.authorizedKeys.keys = [
''
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICcLkzuCoBEg+wq/H+hkrv6pLJ8J5BejaNJVNnymlnlo ivan@idimitrov.dev
''
];
};
extraGroups = { mlocate = { }; };
};
services = {
dovecot2.sieve.extensions = [ "fileinto" ];
openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
};
};
roundcube = {
enable = true;
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login ]);
plugins = [
"persistent_login"
];
hostName = "${config.mailserver.fqdn}";
extraConfig = ''
$config['smtp_host'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
};
postgresql = {
enable = true;
ensureUsers = [
{
name = "root";
ensureClauses = {
superuser = true;
createrole = true;
createdb = true;
};
}
];
};
gitea = {
enable = true;
appName = "src";
database = {
type = "postgres";
};
settings = {
server = {
DOMAIN = "src.idimitrov.dev";
ROOT_URL = "https://src.idimitrov.dev/";
HTTP_PORT = 3001;
};
repository = {
DEFAULT_BRANCH = "master";
};
service = {
DISABLE_REGISTRATION = true;
};
};
};
dnscrypt-proxy2 = {
enable = true;
settings = {
cache = false;
ipv4_servers = true;
ipv6_servers = true;
dnscrypt_servers = true;
doh_servers = false;
odoh_servers = false;
require_dnssec = true;
require_nolog = true;
require_nofilter = true;
anonymized_dns = {
routes = [{ server_name = "*"; via = [ "sdns://gQ8yMTcuMTM4LjIyMC4yNDM" ]; }];
};
sources.public-resolvers = {
urls = [
"https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md"
"https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md"
];
cache_file = "/var/lib/dnscrypt-proxy/public-resolvers.md";
minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
};
};
};
nginx =
let
webshiteConfig = ''
add_header 'Referrer-Policy' 'origin-when-cross-origin';
add_header X-Content-Type-Options nosniff;
'';
restrictToVpn = ''
allow 10.0.0.2/32;
allow 10.0.0.3/32;
allow 10.0.0.4/32;
deny all;
'';
extensions = [ "html" "txt" "png" "jpg" "jpeg" ];
serveStatic = exts: ''
try_files $uri $uri/ ${pkgs.lib.strings.concatStringsSep " " (builtins.map (x: "$uri." + "${x}") exts)} =404;
'';
in
{
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
virtualHosts = {
"idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = "${pkgs.webshite}";
extraConfig = serveStatic extensions;
};
extraConfig = webshiteConfig;
};
"www.idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = "${pkgs.webshite}";
extraConfig = serveStatic extensions;
};
extraConfig = webshiteConfig;
};
"${config.mailserver.fqdn}" = {
extraConfig = restrictToVpn;
};
"src.idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:3001";
};
};
"pic.idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = "/var/pic";
extraConfig = ''
autoindex on;
${serveStatic ["png"]}
'';
};
};
};
};
};
systemd = {
timers = {
bingwp = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*-*-* 10:00:00";
Persistent = true;
};
};
};
services = {
bingwp = {
description = "Download bing image of the day";
script = ''
${pkgs.nushell}/bin/nu -c "http get ('https://bing.com' + ((http get https://www.bing.com/HPImageArchive.aspx?format=js&n=1).images.0.url)) | save ('/var/pic' | path join ( [ (date now | format date '%Y-%m-%d'), '.png' ] | str join ))"
${pkgs.nushell}/bin/nu -c "${pkgs.toybox}/bin/ln -sf (ls /var/pic | where type == file | get name | sort | last) /var/pic/latest.png"
'';
};
};
};
mailserver = {
enable = true;
localDnsResolver = false;
fqdn = "mail.idimitrov.dev";
domains = [ "idimitrov.dev" "mail.idimitrov.dev" ];
loginAccounts = {
"ivan@idimitrov.dev" = {
hashedPassword = "$2b$05$rTVIQD98ogXeCBKdk/YufulWHqpMCAlb7SHDPlh5y8Xbukoa/uQLm";
aliases = [ "admin@idimitrov.dev" ];
};
"security@idimitrov.dev" = {
hashedPassword = "$2b$05$rTVIQD98ogXeCBKdk/YufulWHqpMCAlb7SHDPlh5y8Xbukoa/uQLm";
};
};
certificateScheme = "acme-nginx";
hierarchySeparator = "/";
};
}

View File

@ -1,41 +1,30 @@
toplevel @ { inputs
, withSystem
, ...
}:
toplevel@{ inputs, withSystem, ... }:
let
system = "x86_64-linux";
mods = toplevel.config.flake.nixosModules;
inherit (toplevel.config.flake) hardwareConfigurations;
essential = with mods; [ grub base shell security wireless intranet ];
hardwareConfigurations = toplevel.config.flake.hardwareConfigurations;
essential = with mods; [ grub base shell security wireless wireguard ];
desktop = with mods; [ sound wayland ];
configWithModules =
{ hardware ? { nixpkgs.hostPlatform = system; }
, modules
,
}:
withSystem system ({ inputs', pkgs, ... }:
inputs.nixpkgs.lib.nixosSystem {
configWithModules = { hardware ? { nixpkgs.hostPlatform = system; }, modules }: withSystem system (ctx@{ config, inputs', pkgs, ... }: inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs inputs' pkgs;
packages = config.packages;
};
modules = [ hardware ] ++ modules;
});
novaConfig = mods:
configWithModules {
hardware = hardwareConfigurations.nova;
modules = essential ++ desktop ++ mods;
};
novaConfig = mods: configWithModules { hardware = hardwareConfigurations.nova; modules = essential ++ desktop ++ mods; };
installer = conf: conf // { hardware = import /mnt/etc/nixos/hardware-configuration.nix; };
in
{
flake.nixosConfigurations = {
flake.nixosConfigurations = rec {
nova = novaConfig [ mods.ivand ];
nova-music = novaConfig (with mods; [ ivand music ]);
nova-crypto = novaConfig (with mods; [ ivand cryptocurrency ]);
nova-nonya = novaConfig (with mods; [ ivand anon cryptocurrency ]);
nova-ai = novaConfig (with mods; [ ivand ai ]);
nova-containers = novaConfig (with mods; [ ivand containers ]);
install-iso = configWithModules { modules = with mods; [ grub base shell wireless ]; };
vps = configWithModules { modules = with mods; [ base shell security vps mailserver nginx wireguard-output anonymous-dns firewall rest ]; };
stara-miner = configWithModules { modules = essential ++ [ mods.monero-miner ]; };
install-iso = configWithModules { modules = (with mods; [ grub base shell wireless ]); };
mailserver = configWithModules { modules = (with mods; [ base shell security vps ]); };
stara-miner = configWithModules { modules = (with mods; [ base shell security monero-miner ]); };
stara-miner-installer = installer stara-miner;
};
}

View File

@ -1,3 +1,3 @@
{...}: {
imports = [./modules ./configs];
{ ... }: {
imports = [ ./modules ./configs ];
}

View File

@ -1,28 +1,18 @@
top @ { inputs, moduleWithSystem, ... }: {
top@{ inputs, moduleWithSystem, ... }: {
flake.nixosModules = {
grub = moduleWithSystem (_: { pkgs, ... }: {
grub = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
boot = {
loader = {
grub =
let
theme = pkgs.sleek-grub-theme.override {
withBanner = "Hello Ivan";
withStyle = "bigSur";
};
theme = pkgs.sleek-grub-theme.override { withBanner = "Hello Ivan"; withStyle = "bigSur"; };
in
{
inherit theme;
enable = pkgs.lib.mkDefault true;
useOSProber = true;
efiSupport = true;
device = "nodev";
splashImage = "${theme}/background.png";
};
efi.canTouchEfiVariables = true;
{ enable = pkgs.lib.mkDefault true; useOSProber = true; efiSupport = true; device = "nodev"; theme = theme; splashImage = "${theme}/background.png"; };
efi = { canTouchEfiVariables = true; };
};
};
});
base = moduleWithSystem (_: { pkgs, ... }: {
base = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
imports = [ inputs.hosts.nixosModule ];
system.stateVersion = top.config.flake.stateVersion;
nix = { extraOptions = ''experimental-features = nix-command flakes''; };
@ -35,26 +25,14 @@ top @ { inputs, moduleWithSystem, ... }: {
enableAllTerminfo = true;
};
users.defaultUserShell = pkgs.zsh;
programs = {
zsh.enable = true;
nix-ld.enable = true;
};
programs = { zsh.enable = true; nix-ld.enable = true; };
services = {
dbus.enable = true;
logind = {
killUserProcesses = true;
powerKeyLongPress = "reboot";
};
};
networking = {
stevenBlackHosts = {
enable = true;
blockFakenews = true;
blockGambling = true;
};
logind = { killUserProcesses = true; powerKeyLongPress = "reboot"; };
};
networking = { stevenBlackHosts = { enable = true; blockFakenews = true; blockGambling = true; blockSocial = true; }; };
});
shell = moduleWithSystem (_: { pkgs, ... }: {
shell = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
programs = {
starship.enable = true;
zsh = {
@ -82,17 +60,11 @@ top @ { inputs, moduleWithSystem, ... }: {
};
};
});
sound = moduleWithSystem (_: { pkgs, ... }: {
services = {
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
sound = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
services = { pipewire = { enable = true; alsa.enable = true; pulse.enable = true; }; };
environment.systemPackages = with pkgs; [ pwvucontrol ];
});
music = moduleWithSystem (_: { pkgs, ... }: {
music = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
imports = [ inputs.musnix.nixosModules.musnix ];
environment.systemPackages = with pkgs; [ guitarix ];
services.pipewire = {
@ -103,52 +75,28 @@ top @ { inputs, moduleWithSystem, ... }: {
enable = true;
rtcqs.enable = true;
soundcardPciId = "00:1f.3";
kernel = {
realtime = true;
packages = pkgs.linuxPackages-rt;
};
kernel = { realtime = true; packages = pkgs.linuxPackages-rt; };
};
});
wayland = moduleWithSystem (_: _: {
wayland = moduleWithSystem (toplevel@{ ... }: perSystem@{ ... }: {
hardware.graphics.enable = true;
security.pam.services.swaylock = { };
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
wlr = {
enable = true;
settings = {
screencast = {
output_name = "HDMI-A-1";
max_fps = 60;
};
};
};
wlr = { enable = true; settings = { screencast = { output_name = "HDMI-A-1"; max_fps = 60; }; }; };
config.common.default = "*";
};
});
security = moduleWithSystem (_: _: {
security = moduleWithSystem (toplevel@{ ... }: perSystem@{ ... }: {
security = {
sudo = {
enable = false;
execWheelOnly = true;
extraRules = [{ groups = [ "wheel" ]; }];
};
doas = {
enable = true;
extraRules = [
{
groups = [ "wheel" ];
noPass = true;
keepEnv = true;
}
];
};
sudo = { enable = false; execWheelOnly = true; extraRules = [{ groups = [ "wheel" ]; }]; };
doas = { enable = true; extraRules = [{ groups = [ "wheel" ]; noPass = true; keepEnv = true; }]; };
polkit.enable = true;
rtkit.enable = true;
};
});
intranet = {
wireguard = {
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.0.0.2/32" ];
@ -163,12 +111,6 @@ top @ { inputs, moduleWithSystem, ... }: {
];
};
};
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
};
};
};
wireless = {
networking = {
@ -208,19 +150,6 @@ top @ { inputs, moduleWithSystem, ... }: {
"KOTEKLAN_GUEST" = {
psk = "koteklankotek";
};
"TP-Link_BE7A" = {
psk = "84665461";
};
"Post120" = {
psk = "9996663333";
};
"MOONLIGHT2019" = {
psk = "seacrets";
};
"Kaiser Terrasse" = {
psk = "Internet12";
};
"ATHENS-HAWKS" = { };
"3G" = {
hidden = true;
};
@ -228,11 +157,8 @@ top @ { inputs, moduleWithSystem, ... }: {
};
};
};
ivand = moduleWithSystem (_: { pkgs, ... }:
let
homeMods = top.config.flake.homeManagerModules;
in
{
ivand = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }:
let homeMods = top.config.flake.homeManagerModules; in {
imports = [ inputs.home-manager.nixosModules.default ];
home-manager = {
backupFileExtension = "bak";
@ -271,41 +197,25 @@ top @ { inputs, moduleWithSystem, ... }: {
];
};
};
extraGroups = {
mlocate = { };
realtime = { };
};
extraGroups = { mlocate = { }; realtime = { }; };
};
programs.dconf.enable = true;
});
flatpak = {
xdg = {
portal = {
enable = true;
wlr.enable = true;
config.common.default = "*";
};
};
xdg = { portal = { enable = true; wlr.enable = true; config.common.default = "*"; }; };
services.flatpak.enable = true;
};
ai = moduleWithSystem (_: _: {
ai = moduleWithSystem (toplevel@{ ... }: perSystem@{ ... }: {
services = { ollama.enable = true; };
});
containers = moduleWithSystem (_: _: {
virtualisation.docker = {
enable = true;
storageDriver = "btrfs";
};
users.users.ivand.extraGroups = [ "docker" ];
});
anon = moduleWithSystem (_: { pkgs, ... }: {
anon = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
environment.systemPackages = with pkgs; [ tor-browser ];
});
cryptocurrency = moduleWithSystem (_: { pkgs, ... }: {
cryptocurrency = moduleWithSystem (toplevel@{ ... }: perSystem@{ pkgs, ... }: {
environment.systemPackages = with pkgs; [ monero-cli ];
services = { monero.enable = true; };
});
monero-miner = moduleWithSystem (_: _: {
monero-miner = moduleWithSystem (toplevel@{ ... }: perSystem@{ ... }: {
services = {
xmrig = {
enable = true;
@ -326,333 +236,12 @@ top @ { inputs, moduleWithSystem, ... }: {
};
};
});
vps = moduleWithSystem (_: { ... }: {
vps = moduleWithSystem (toplevel@{ ... }: perSystem@{ ... }: {
imports = [
inputs.vpsadminos.nixosConfigurations.container
];
});
mailserver = moduleWithSystem (_: { config
, pkgs
, ...
}: {
imports = [
inputs.simple-nixos-mailserver.nixosModule
../../hosts/vps/mailserver
];
mailserver = {
enable = true;
localDnsResolver = false;
fqdn = "mail.idimitrov.dev";
domains = [ "idimitrov.dev" "mail.idimitrov.dev" ];
loginAccounts = {
"ivan@idimitrov.dev" = {
hashedPassword = "$2b$05$rTVIQD98ogXeCBKdk/YufulWHqpMCAlb7SHDPlh5y8Xbukoa/uQLm";
aliases = [ "admin@idimitrov.dev" ];
};
"security@idimitrov.dev" = {
hashedPassword = "$2b$05$rTVIQD98ogXeCBKdk/YufulWHqpMCAlb7SHDPlh5y8Xbukoa/uQLm";
};
};
certificateScheme = "acme-nginx";
hierarchySeparator = "/";
};
services = {
dovecot2.sieve.extensions = [ "fileinto" ];
roundcube = {
enable = true;
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login ]);
plugins = [
"persistent_login"
];
hostName = "${config.mailserver.fqdn}";
extraConfig = ''
$config['smtp_host'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
};
nginx.virtualHosts =
let
restrictToVpn = ''
allow 10.0.0.2/32;
allow 10.0.0.3/32;
allow 10.0.0.4/32;
deny all;
'';
in
{
"${config.mailserver.fqdn}" = {
extraConfig = restrictToVpn;
};
};
postgresql.enable = true;
};
security = {
acme = {
acceptTerms = true;
defaults.email = "security@idimitrov.dev";
};
};
});
nginx = moduleWithSystem (_: { pkgs, ... }: {
services = {
nginx =
let
webshiteConfig = ''
add_header 'Referrer-Policy' 'origin-when-cross-origin';
add_header X-Content-Type-Options nosniff;
'';
extensions = [ "html" "txt" "png" "jpg" "jpeg" ];
serveStatic = exts: ''
try_files $uri $uri/ ${pkgs.lib.strings.concatStringsSep " " (builtins.map (x: "$uri." + "${x}") exts)} =404;
'';
in
{
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
virtualHosts = {
"idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = "${pkgs.webshite}";
extraConfig = serveStatic extensions;
};
extraConfig = webshiteConfig;
};
"www.idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = "${pkgs.webshite}";
extraConfig = serveStatic extensions;
};
extraConfig = webshiteConfig;
};
"src.idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:3001";
};
};
"pic.idimitrov.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
root = "/var/pic";
extraConfig = ''
autoindex on;
${serveStatic ["png"]}
'';
};
};
};
};
gitea = {
enable = true;
appName = "src";
database = {
type = "postgres";
};
settings = {
server = {
DOMAIN = "src.idimitrov.dev";
ROOT_URL = "https://src.idimitrov.dev/";
HTTP_PORT = 3001;
};
repository = {
DEFAULT_BRANCH = "master";
};
service = {
DISABLE_REGISTRATION = true;
};
};
};
postgresql = {
enable = true;
ensureUsers = [
{
name = "root";
ensureClauses = {
superuser = true;
createrole = true;
createdb = true;
};
}
];
};
};
});
wireguard-output = moduleWithSystem (_: { pkgs, ... }: {
networking = {
nat = {
enable = true;
enableIPv6 = true;
externalInterface = "venet0";
internalInterfaces = [ "wg0" ];
};
wg-quick.interfaces = {
wg0 =
let
iptables = "${pkgs.iptables}/bin/iptables";
ip6tables = "${pkgs.iptables}/bin/ip6tables";
in
{
address = [ "10.0.0.1/32" ];
listenPort = 51820;
privateKeyFile = "/etc/wireguard/privatekey";
postUp = ''
${iptables} -A FORWARD -i wg0 -j ACCEPT
${iptables} -t nat -A POSTROUTING -s 10.0.0.1/24 -o venet0 -j MASQUERADE
${ip6tables} -A FORWARD -i wg0 -j ACCEPT
${ip6tables} -t nat -A POSTROUTING -s fdc9:281f:04d7:9ee9::1/64 -o venet0 -j MASQUERADE
'';
preDown = ''
${iptables} -D FORWARD -i wg0 -j ACCEPT
${iptables} -t nat -D POSTROUTING -s 10.0.0.1/24 -o venet0 -j MASQUERADE
${ip6tables} -D FORWARD -i wg0 -j ACCEPT
${ip6tables} -t nat -D POSTROUTING -s fdc9:281f:04d7:9ee9::1/64 -o venet0 -j MASQUERADE
'';
peers = [
{
publicKey = "kI93V0dVKSqX8hxMJHK5C0c1hEDPQTgPQDU8TKocVgo=";
allowedIPs = [ "10.0.0.2/32" ];
}
{
publicKey = "RqTsFxFCcgYsytcDr+jfEoOA5UNxa1ZzGlpx6iuTpXY=";
allowedIPs = [ "10.0.0.3/32" ];
}
{
publicKey = "1e0mjluqXdLbzv681HlC9B8BfGN8sIXIw3huLyQqwXI=";
allowedIPs = [ "10.0.0.4/32" ];
}
];
};
};
};
});
anonymous-dns = moduleWithSystem (_: _: {
networking = {
nameservers = [ "127.0.0.1" "::1" ];
dhcpcd.extraConfig = "nohook resolv.conf";
};
services = {
dnscrypt-proxy2 = {
enable = true;
settings = {
cache = false;
ipv4_servers = true;
ipv6_servers = true;
dnscrypt_servers = true;
doh_servers = false;
odoh_servers = false;
require_dnssec = true;
require_nolog = true;
require_nofilter = true;
anonymized_dns = {
routes = [
{
server_name = "*";
via = [ "sdns://gQ8yMTcuMTM4LjIyMC4yNDM" ];
}
];
};
sources.public-resolvers = {
urls = [
"https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md"
"https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md"
];
cache_file = "/var/lib/dnscrypt-proxy/public-resolvers.md";
minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
};
};
};
};
});
firewall = moduleWithSystem (_: { lib, ... }: {
networking = {
firewall = lib.mkForce {
enable = true;
allowedTCPPorts = [
25 # smtp
465 # smtps
80 # http
443 # https
];
allowedUDPPorts = [
25
465
80
443
51820 # wireguard
];
extraCommands = ''
iptables -N vpn # create a new chain named vpn
iptables -A vpn --src 10.0.0.2 -j ACCEPT # allow
iptables -A vpn --src 10.0.0.3 -j ACCEPT # allow
iptables -A vpn --src 10.0.0.4 -j ACCEPT # allow
iptables -A vpn -j DROP # drop everyone else
iptables -I INPUT -m tcp -p tcp --dport 22 -j vpn
'';
extraStopCommands = ''
iptables -F vpn
iptables -D INPUT -m tcp -p tcp --dport 22 -j vpn
iptables -X vpn
'';
};
};
});
rest = moduleWithSystem (_: { pkgs, ... }: {
fileSystems."/mnt/export1981" = {
device = "172.16.128.47:/nas/5490";
fsType = "nfs";
options = [ "nofail" ];
};
users = {
users.ivand = {
isNormalUser = true;
hashedPassword = "$2b$05$hPrPcewxj4qjLCRQpKBAu.FKvKZdIVlnyn4uYsWE8lc21Jhvc9jWG";
extraGroups = [ "wheel" "adm" "mlocate" ];
openssh.authorizedKeys.keys = [
''
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICcLkzuCoBEg+wq/H+hkrv6pLJ8J5BejaNJVNnymlnlo ivan@idimitrov.dev
''
];
};
extraGroups = { mlocate = { }; };
};
services = {
openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
};
};
};
systemd = {
timers = {
bingwp = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*-*-* 10:00:00";
Persistent = true;
};
};
};
services = {
bingwp = {
description = "Download bing image of the day";
script = ''
${pkgs.nushell}/bin/nu -c "http get ('https://bing.com' + ((http get https://www.bing.com/HPImageArchive.aspx?format=js&n=1).images.0.url)) | save ('/var/pic' | path join ( [ (date now | format date '%Y-%m-%d'), '.png' ] | str join ))"
${pkgs.nushell}/bin/nu -c "${pkgs.toybox}/bin/ln -sf (ls /var/pic | where type == file | get name | sort | last) /var/pic/latest.png"
'';
};
};
};
});
};
}

View File

@ -1,8 +1,14 @@
{ withSystem, ... }: {
flake.overlays.default = _: _:
withSystem "x86_64-linux" (
{ config, ... }: with config.packages; {
inherit nvim bingwp screenshot cursors wpd webshite sal;
top@{ inputs, withSystem, ... }: {
flake.overlays.default = final: prev:
let system = "x86_64-linux"; in withSystem system (
{ config, ... }: {
nvim = config.packages.nvim;
bingwp = config.packages.bingwp;
screenshot = config.packages.screenshot;
cursors = config.packages.cursors;
wpd = config.packages.wpd;
webshite = config.packages.webshite;
sal = inputs.sal.packages.${system}.default;
}
);
}

View File

@ -1,6 +1,5 @@
{ inputs, ... }: {
perSystem =
{ system, pkgs, ... }: {
top@{ inputs, ... }: {
perSystem = perSystem@{ system, pkgs, ... }: {
config.packages = {
nvim = inputs.ide.nvim.${system}.standalone.default {
plugins.lsp.servers = {
@ -63,7 +62,6 @@
};
});
webshite = inputs.webshite.packages.${system}.default;
sal = inputs.sal.packages."x86_64-linux".default;
};
};
}