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 ];
systems = [ "x86_64-linux" ];
flake.stateVersion = "24.05";
perSystem = perSystem @ {system, ...}: {
perSystem = { system, ... }: {
config._module.args = {
pkgs = import inputs.nixpkgs {
inherit system;

View File

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

View File

@ -1,7 +1,7 @@
toplevel @ { moduleWithSystem, ... }: {
flake.homeManagerModules = {
base = moduleWithSystem (
top @ {...}: perSystem @ {config, ...}: {
{ ... }: { config, ... }: {
programs.home-manager.enable = true;
home.stateVersion = toplevel.config.flake.stateVersion;
xdg = {
@ -23,7 +23,7 @@ toplevel @ {moduleWithSystem, ...}: {
}
);
ivand = moduleWithSystem (
top @ {...}: perSystem @ {pkgs, ...}: {
{ ... }: { pkgs, ... }: {
home = {
username = "ivand";
homeDirectory = "/home/ivand";
@ -55,10 +55,9 @@ toplevel @ {moduleWithSystem, ...}: {
}
);
util = moduleWithSystem (
top @ {...}: perSystem @ {
pkgs,
config,
...
{ ... }: { pkgs
, config
, ...
}: {
home = {
packages = with pkgs; [ openssl mlocate uutils-coreutils-noprefix speedtest-cli ];
@ -133,14 +132,16 @@ toplevel @ {moduleWithSystem, ...}: {
};
bat = {
enable = true;
themes = let
themes =
let
catppuccin = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "82e7ca555f805b53d2b377390e4ab38c20282e83";
sha256 = "sha256-/Ob9iCVyjJDBCXlss9KwFQTuxybmSSzYRBZxOT10PZg=";
};
in {
in
{
catppuccin-mocha = {
src = catppuccin;
file = "themes/Catppuccin Mocha.tmTheme";
@ -174,8 +175,9 @@ toplevel @ {moduleWithSystem, ...}: {
}
);
shell = moduleWithSystem (
top @ {...}: perSystem @ {pkgs, ...}: {
programs = let
{ ... }: { pkgs, ... }: {
programs =
let
shellAliases = {
cal = "cal $(date +%Y)";
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";
};
sessionVariables = { };
in {
in
{
bash = {
inherit shellAliases sessionVariables;
enable = true;
@ -260,10 +263,9 @@ toplevel @ {moduleWithSystem, ...}: {
}
);
swayland = moduleWithSystem (
top @ {...}: perSystem @ {
pkgs,
config,
...
{ ... }: { 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 ];
@ -319,7 +321,8 @@ toplevel @ {moduleWithSystem, ...}: {
waybar = {
enable = true;
settings = {
mainBar = let
mainBar =
let
in {
layer = "top";
position = "top";
@ -617,7 +620,7 @@ toplevel @ {moduleWithSystem, ...}: {
}
);
web = moduleWithSystem (
top @ {...}: perSystem @ {...}: {
{ ... }: { ... }: {
programs = {
browserpass.enable = true;
firefox = {

View File

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

View File

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

View File

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

View File

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