dead code removal

This commit is contained in:
Ivan Kirilov Dimitrov 2024-08-07 18:44:14 +02:00
parent 06dea9ce71
commit dec199a870
No known key found for this signature in database
GPG Key ID: 0BDAD4B211C49294
7 changed files with 530 additions and 535 deletions

View File

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

View File

@ -1,10 +1,6 @@
top @ {...}: { { ... }: {
flake.hardwareConfigurations = { flake.hardwareConfigurations = {
nova = { nova = { lib, modulesPath, ... }: {
lib,
modulesPath,
...
}: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = { boot = {
initrd = { initrd = {

View File

@ -1,7 +1,7 @@
toplevel @ { moduleWithSystem, ... }: { toplevel @ { moduleWithSystem, ... }: {
flake.homeManagerModules = { flake.homeManagerModules = {
base = moduleWithSystem ( base = moduleWithSystem (
top @ {...}: perSystem @ {config, ...}: { { ... }: { config, ... }: {
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.stateVersion = toplevel.config.flake.stateVersion; home.stateVersion = toplevel.config.flake.stateVersion;
xdg = { xdg = {
@ -23,7 +23,7 @@ toplevel @ {moduleWithSystem, ...}: {
} }
); );
ivand = moduleWithSystem ( ivand = moduleWithSystem (
top @ {...}: perSystem @ {pkgs, ...}: { { ... }: { pkgs, ... }: {
home = { home = {
username = "ivand"; username = "ivand";
homeDirectory = "/home/ivand"; homeDirectory = "/home/ivand";
@ -55,10 +55,9 @@ toplevel @ {moduleWithSystem, ...}: {
} }
); );
util = moduleWithSystem ( util = moduleWithSystem (
top @ {...}: perSystem @ { { ... }: { pkgs
pkgs, , config
config, , ...
...
}: { }: {
home = { home = {
packages = with pkgs; [ openssl mlocate uutils-coreutils-noprefix speedtest-cli ]; packages = with pkgs; [ openssl mlocate uutils-coreutils-noprefix speedtest-cli ];
@ -133,14 +132,16 @@ toplevel @ {moduleWithSystem, ...}: {
}; };
bat = { bat = {
enable = true; enable = true;
themes = let themes =
let
catppuccin = pkgs.fetchFromGitHub { catppuccin = pkgs.fetchFromGitHub {
owner = "catppuccin"; owner = "catppuccin";
repo = "bat"; repo = "bat";
rev = "82e7ca555f805b53d2b377390e4ab38c20282e83"; rev = "82e7ca555f805b53d2b377390e4ab38c20282e83";
sha256 = "sha256-/Ob9iCVyjJDBCXlss9KwFQTuxybmSSzYRBZxOT10PZg="; sha256 = "sha256-/Ob9iCVyjJDBCXlss9KwFQTuxybmSSzYRBZxOT10PZg=";
}; };
in { in
{
catppuccin-mocha = { catppuccin-mocha = {
src = catppuccin; src = catppuccin;
file = "themes/Catppuccin Mocha.tmTheme"; file = "themes/Catppuccin Mocha.tmTheme";
@ -174,8 +175,9 @@ toplevel @ {moduleWithSystem, ...}: {
} }
); );
shell = moduleWithSystem ( shell = moduleWithSystem (
top @ {...}: perSystem @ {pkgs, ...}: { { ... }: { pkgs, ... }: {
programs = let programs =
let
shellAliases = { shellAliases = {
cal = "cal $(date +%Y)"; cal = "cal $(date +%Y)";
GG = "git add . && git commit -m 'GG' && git push --set-upstream origin HEAD"; GG = "git add . && git commit -m 'GG' && git push --set-upstream origin HEAD";
@ -191,7 +193,8 @@ toplevel @ {moduleWithSystem, ...}: {
neofetch = "${pkgs.fastfetch}/bin/fastfetch -c all.jsonc"; neofetch = "${pkgs.fastfetch}/bin/fastfetch -c all.jsonc";
}; };
sessionVariables = { }; sessionVariables = { };
in { in
{
bash = { bash = {
inherit shellAliases sessionVariables; inherit shellAliases sessionVariables;
enable = true; enable = true;
@ -260,10 +263,9 @@ toplevel @ {moduleWithSystem, ...}: {
} }
); );
swayland = moduleWithSystem ( swayland = moduleWithSystem (
top @ {...}: perSystem @ { { ... }: { pkgs
pkgs, , config
config, , ...
...
}: { }: {
home = { home = {
packages = with pkgs; [ audacity gimp grim libnotify libreoffice-qt mupdf slurp transmission_4 wl-clipboard xdg-user-dirs xdg-utils xwayland telegram-desktop ]; packages = with pkgs; [ audacity gimp grim libnotify libreoffice-qt mupdf slurp transmission_4 wl-clipboard xdg-user-dirs xdg-utils xwayland telegram-desktop ];
@ -319,7 +321,8 @@ toplevel @ {moduleWithSystem, ...}: {
waybar = { waybar = {
enable = true; enable = true;
settings = { settings = {
mainBar = let mainBar =
let
in { in {
layer = "top"; layer = "top";
position = "top"; position = "top";
@ -617,7 +620,7 @@ toplevel @ {moduleWithSystem, ...}: {
} }
); );
web = moduleWithSystem ( web = moduleWithSystem (
top @ {...}: perSystem @ {...}: { { ... }: { ... }: {
programs = { programs = {
browserpass.enable = true; browserpass.enable = true;
firefox = { firefox = {

View File

@ -1,23 +1,19 @@
toplevel @ { toplevel @ { inputs
inputs, , withSystem
withSystem, , ...
... }:
}: let let
system = "x86_64-linux"; system = "x86_64-linux";
mods = toplevel.config.flake.nixosModules; mods = toplevel.config.flake.nixosModules;
hardwareConfigurations = toplevel.config.flake.hardwareConfigurations; hardwareConfigurations = toplevel.config.flake.hardwareConfigurations;
essential = with mods; [ grub base shell security wireless intranet ]; essential = with mods; [ grub base shell security wireless intranet ];
desktop = with mods; [ sound wayland ]; desktop = with mods; [ sound wayland ];
configWithModules = { configWithModules =
hardware ? {nixpkgs.hostPlatform = system;}, { hardware ? { nixpkgs.hostPlatform = system; }
modules, , modules
}: ,
withSystem system (ctx @ {
config,
inputs',
pkgs,
...
}: }:
withSystem system ({ config, inputs', pkgs, ... }:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs inputs' pkgs; inherit inputs inputs' pkgs;
@ -30,7 +26,8 @@ toplevel @ {
hardware = hardwareConfigurations.nova; hardware = hardwareConfigurations.nova;
modules = essential ++ desktop ++ mods; modules = essential ++ desktop ++ mods;
}; };
in { in
{
flake.nixosConfigurations = { flake.nixosConfigurations = {
nova = novaConfig [ mods.ivand ]; nova = novaConfig [ mods.ivand ];
nova-music = novaConfig (with mods; [ ivand music ]); nova-music = novaConfig (with mods; [ ivand music ]);

View File

@ -1,18 +1,16 @@
top @ { top @ { inputs, moduleWithSystem, ... }: {
inputs,
moduleWithSystem,
...
}: {
flake.nixosModules = { flake.nixosModules = {
grub = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { grub = moduleWithSystem ({ ... }: { pkgs, ... }: {
boot = { boot = {
loader = { loader = {
grub = let grub =
let
theme = pkgs.sleek-grub-theme.override { theme = pkgs.sleek-grub-theme.override {
withBanner = "Hello Ivan"; withBanner = "Hello Ivan";
withStyle = "bigSur"; withStyle = "bigSur";
}; };
in { in
{
enable = pkgs.lib.mkDefault true; enable = pkgs.lib.mkDefault true;
useOSProber = true; useOSProber = true;
efiSupport = true; efiSupport = true;
@ -24,7 +22,7 @@ top @ {
}; };
}; };
}); });
base = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { base = moduleWithSystem ({ ... }: { pkgs, ... }: {
imports = [ inputs.hosts.nixosModule ]; imports = [ inputs.hosts.nixosModule ];
system.stateVersion = top.config.flake.stateVersion; system.stateVersion = top.config.flake.stateVersion;
nix = { extraOptions = ''experimental-features = nix-command flakes''; }; nix = { extraOptions = ''experimental-features = nix-command flakes''; };
@ -57,7 +55,7 @@ top @ {
}; };
}; };
}); });
shell = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { shell = moduleWithSystem ({ ... }: { pkgs, ... }: {
programs = { programs = {
starship.enable = true; starship.enable = true;
zsh = { zsh = {
@ -85,7 +83,7 @@ top @ {
}; };
}; };
}); });
sound = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { sound = moduleWithSystem ({ ... }: { pkgs, ... }: {
services = { services = {
pipewire = { pipewire = {
enable = true; enable = true;
@ -95,7 +93,7 @@ top @ {
}; };
environment.systemPackages = with pkgs; [ pwvucontrol ]; environment.systemPackages = with pkgs; [ pwvucontrol ];
}); });
music = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { music = moduleWithSystem ({ ... }: { pkgs, ... }: {
imports = [ inputs.musnix.nixosModules.musnix ]; imports = [ inputs.musnix.nixosModules.musnix ];
environment.systemPackages = with pkgs; [ guitarix ]; environment.systemPackages = with pkgs; [ guitarix ];
services.pipewire = { services.pipewire = {
@ -112,7 +110,7 @@ top @ {
}; };
}; };
}); });
wayland = moduleWithSystem (toplevel @ {...}: perSystem @ {...}: { wayland = moduleWithSystem ({ ... }: { ... }: {
hardware.graphics.enable = true; hardware.graphics.enable = true;
security.pam.services.swaylock = { }; security.pam.services.swaylock = { };
xdg.portal = { xdg.portal = {
@ -130,7 +128,7 @@ top @ {
config.common.default = "*"; config.common.default = "*";
}; };
}); });
security = moduleWithSystem (toplevel @ {...}: perSystem @ {...}: { security = moduleWithSystem ({ ... }: { ... }: {
security = { security = {
sudo = { sudo = {
enable = false; enable = false;
@ -218,9 +216,11 @@ top @ {
}; };
}; };
}; };
ivand = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: let ivand = moduleWithSystem ({ ... }: { pkgs, ... }:
let
homeMods = top.config.flake.homeManagerModules; homeMods = top.config.flake.homeManagerModules;
in { in
{
imports = [ inputs.home-manager.nixosModules.default ]; imports = [ inputs.home-manager.nixosModules.default ];
home-manager = { home-manager = {
backupFileExtension = "bak"; backupFileExtension = "bak";
@ -276,17 +276,17 @@ top @ {
}; };
services.flatpak.enable = true; services.flatpak.enable = true;
}; };
ai = moduleWithSystem (toplevel @ {...}: perSystem @ {...}: { ai = moduleWithSystem ({ ... }: { ... }: {
services = { ollama.enable = true; }; services = { ollama.enable = true; };
}); });
anon = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { anon = moduleWithSystem ({ ... }: { pkgs, ... }: {
environment.systemPackages = with pkgs; [ tor-browser ]; environment.systemPackages = with pkgs; [ tor-browser ];
}); });
cryptocurrency = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { cryptocurrency = moduleWithSystem ({ ... }: { pkgs, ... }: {
environment.systemPackages = with pkgs; [ monero-cli ]; environment.systemPackages = with pkgs; [ monero-cli ];
services = { monero.enable = true; }; services = { monero.enable = true; };
}); });
monero-miner = moduleWithSystem (toplevel @ {...}: perSystem @ {...}: { monero-miner = moduleWithSystem ({ ... }: { ... }: {
services = { services = {
xmrig = { xmrig = {
enable = true; enable = true;
@ -307,15 +307,14 @@ top @ {
}; };
}; };
}); });
vps = moduleWithSystem (toplevel @ {...}: perSystem @ {...}: { vps = moduleWithSystem ({ ... }: { ... }: {
imports = [ imports = [
inputs.vpsadminos.nixosConfigurations.container inputs.vpsadminos.nixosConfigurations.container
]; ];
}); });
mailserver = moduleWithSystem (toplevel @ {...}: perSystem @ { mailserver = moduleWithSystem ({ ... }: { config
config, , pkgs
pkgs, , ...
...
}: { }: {
imports = [ imports = [
inputs.simple-nixos-mailserver.nixosModule inputs.simple-nixos-mailserver.nixosModule
@ -352,14 +351,16 @@ top @ {
$config['smtp_pass'] = "%p"; $config['smtp_pass'] = "%p";
''; '';
}; };
nginx.virtualHosts = let nginx.virtualHosts =
let
restrictToVpn = '' restrictToVpn = ''
allow 10.0.0.2/32; allow 10.0.0.2/32;
allow 10.0.0.3/32; allow 10.0.0.3/32;
allow 10.0.0.4/32; allow 10.0.0.4/32;
deny all; deny all;
''; '';
in { in
{
"${config.mailserver.fqdn}" = { "${config.mailserver.fqdn}" = {
extraConfig = restrictToVpn; extraConfig = restrictToVpn;
}; };
@ -373,9 +374,10 @@ top @ {
}; };
}; };
}); });
nginx = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { nginx = moduleWithSystem ({ ... }: { pkgs, ... }: {
services = { services = {
nginx = let nginx =
let
webshiteConfig = '' webshiteConfig = ''
add_header 'Referrer-Policy' 'origin-when-cross-origin'; add_header 'Referrer-Policy' 'origin-when-cross-origin';
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
@ -384,7 +386,8 @@ top @ {
serveStatic = exts: '' serveStatic = exts: ''
try_files $uri $uri/ ${pkgs.lib.strings.concatStringsSep " " (builtins.map (x: "$uri." + "${x}") exts)} =404; try_files $uri $uri/ ${pkgs.lib.strings.concatStringsSep " " (builtins.map (x: "$uri." + "${x}") exts)} =404;
''; '';
in { in
{
enable = true; enable = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
@ -465,7 +468,7 @@ top @ {
}; };
}; };
}); });
wireguard-output = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { wireguard-output = moduleWithSystem ({ ... }: { pkgs, ... }: {
networking = { networking = {
nat = { nat = {
enable = true; enable = true;
@ -474,10 +477,12 @@ top @ {
internalInterfaces = [ "wg0" ]; internalInterfaces = [ "wg0" ];
}; };
wg-quick.interfaces = { wg-quick.interfaces = {
wg0 = let wg0 =
let
iptables = "${pkgs.iptables}/bin/iptables"; iptables = "${pkgs.iptables}/bin/iptables";
ip6tables = "${pkgs.iptables}/bin/ip6tables"; ip6tables = "${pkgs.iptables}/bin/ip6tables";
in { in
{
address = [ "10.0.0.1/32" ]; address = [ "10.0.0.1/32" ];
listenPort = 51820; listenPort = 51820;
privateKeyFile = "/etc/wireguard/privatekey"; privateKeyFile = "/etc/wireguard/privatekey";
@ -511,7 +516,7 @@ top @ {
}; };
}; };
}); });
anonymous-dns = moduleWithSystem (toplevel @ {...}: perSystem @ {...}: { anonymous-dns = moduleWithSystem ({ ... }: { ... }: {
networking = { networking = {
nameservers = [ "127.0.0.1" "::1" ]; nameservers = [ "127.0.0.1" "::1" ];
dhcpcd.extraConfig = "nohook resolv.conf"; dhcpcd.extraConfig = "nohook resolv.conf";
@ -549,7 +554,7 @@ top @ {
}; };
}; };
}); });
firewall = moduleWithSystem (toplevel @ {...}: perSystem @ {lib, ...}: { firewall = moduleWithSystem ({ ... }: { lib, ... }: {
networking = { networking = {
firewall = lib.mkForce { firewall = lib.mkForce {
enable = true; enable = true;
@ -582,7 +587,7 @@ top @ {
}; };
}; };
}); });
rest = moduleWithSystem (toplevel @ {...}: perSystem @ {pkgs, ...}: { rest = moduleWithSystem ({ ... }: { pkgs, ... }: {
fileSystems."/mnt/export1981" = { fileSystems."/mnt/export1981" = {
device = "172.16.128.47:/nas/5490"; device = "172.16.128.47:/nas/5490";
fsType = "nfs"; fsType = "nfs";

View File

@ -1,9 +1,6 @@
top @ { { inputs, withSystem, ... }: {
inputs, flake.overlays.default = _final: _prev:
withSystem, let
...
}: {
flake.overlays.default = final: prev: let
system = "x86_64-linux"; system = "x86_64-linux";
in in
withSystem system ( withSystem system (

View File

@ -1,9 +1,6 @@
top @ {inputs, ...}: { { inputs, ... }: {
perSystem = perSystem @ { perSystem =
system, { system, pkgs, ... }: {
pkgs,
...
}: {
config.packages = { config.packages = {
nvim = inputs.ide.nvim.${system}.standalone.default { nvim = inputs.ide.nvim.${system}.standalone.default {
plugins.lsp.servers = { plugins.lsp.servers = {