174 lines
4.4 KiB
Nix
Raw Normal View History

2023-01-26 00:24:32 +03:00
{ modulesPath, inputs, lib, pkgs, config, options, ... }:
2023-06-27 01:25:28 +03:00
let persistRoot = config.autoinstall.persist.persistRoot or "/persist";
2023-01-26 00:24:32 +03:00
in {
imports = with inputs.self; [
2024-01-19 17:58:20 +03:00
inputs.sops-nix.nixosModules.sops
2024-01-21 17:40:07 +03:00
./backups.nix
2023-01-26 00:24:32 +03:00
./boot.nix
2023-01-26 00:43:11 +03:00
./hardware-configuration.nix
2024-01-21 17:40:07 +03:00
./usb-hdd.nix
2023-01-26 00:24:32 +03:00
./virtualisation.nix
2023-10-13 19:43:02 +03:00
customProfiles.hardened
customRoles.hypervisor
2024-01-21 16:32:12 +03:00
2023-10-13 19:43:02 +03:00
customProfiles.acme
2024-01-21 16:32:12 +03:00
customProfiles.attic
customProfiles.atticd
2023-10-13 19:43:02 +03:00
customProfiles.authentik
customProfiles.battery-historian
customProfiles.fail2ban
customProfiles.gitea
2024-01-21 16:32:12 +03:00
customProfiles.homepage
customProfiles.hoyolab
customProfiles.inpx-web
customProfiles.it-tools
2023-10-13 19:43:02 +03:00
customProfiles.joplin-server
2024-01-21 16:32:12 +03:00
customProfiles.media-stack
customProfiles.minio
2023-10-13 19:43:02 +03:00
customProfiles.nginx
2024-01-21 16:32:12 +03:00
customProfiles.ocis
customProfiles.openbooks
customProfiles.outline
customProfiles.radicale
customProfiles.spdf
2023-10-13 19:43:02 +03:00
customProfiles.tinyproxy
customProfiles.vaultwarden
customProfiles.vscode-server
customProfiles.webhooks
customProfiles.wiki
2024-01-21 16:32:12 +03:00
customProfiles.yandex-db
2023-06-27 01:25:28 +03:00
2023-10-13 19:43:02 +03:00
(import customProfiles.blocky {
2024-01-21 16:32:37 +03:00
inherit config pkgs;
2024-01-21 17:40:07 +03:00
inherit (import ./dns-mapping.nix) dnsmasq-list;
2023-06-27 01:25:28 +03:00
})
(import customProfiles.headscale {
inherit config pkgs;
2024-01-21 17:40:07 +03:00
inherit (import ./dns-mapping.nix) headscale-list;
})
2023-01-26 00:24:32 +03:00
];
deviceSpecific.devInfo = {
2024-01-21 19:29:36 +03:00
cpu.vendor = "intel";
drive.type = "ssd";
gpu.vendor = "other";
2023-01-26 00:24:32 +03:00
ram = 12;
fileSystem = "zfs";
};
deviceSpecific.enableVirtualisation = true;
2024-01-21 19:29:36 +03:00
deviceSpecific.vpn.tailscale.enable = true;
2023-01-26 00:24:32 +03:00
deviceSpecific.isServer = true;
zramSwap = {
enable = true;
algorithm = "zstd";
2023-05-24 21:28:50 +03:00
memoryPercent = 150;
2023-01-26 00:24:32 +03:00
};
# Impermanence
persist = {
enable = true;
cache.clean.enable = true;
state = {
files = [ "/etc/machine-id" ];
};
2023-01-26 00:24:32 +03:00
};
fileSystems."/home".neededForBoot = true;
fileSystems.${persistRoot}.neededForBoot = true;
boot.initrd.postDeviceCommands = lib.mkAfter ''
zfs rollback -r rpool/nixos/root@empty
zfs rollback -r rpool/user/home@empty
'';
2023-06-23 18:28:56 +03:00
environment.memoryAllocator.provider = "libc";
2023-01-26 00:24:32 +03:00
# build hell
environment.noXlibs = lib.mkForce false;
# minimal profile
documentation.nixos.enable = lib.mkForce false;
programs.command-not-found.enable = lib.mkForce false;
xdg.autostart.enable = lib.mkForce false;
xdg.icons.enable = lib.mkForce false;
xdg.mime.enable = lib.mkForce false;
xdg.sounds.enable = lib.mkForce false;
services.udisks2.enable = lib.mkForce false;
2023-08-04 02:37:47 +03:00
fonts.enableDefaultPackages = lib.mkForce false;
fonts.packages =
2023-06-27 01:25:28 +03:00
[ (pkgs.nerdfonts.override { fonts = [ "FiraCode" "VictorMono" ]; }) ];
2023-01-26 00:24:32 +03:00
security.polkit.enable = true;
services.zfs = {
autoScrub.enable = true;
2023-11-22 05:57:58 +03:00
autoScrub.interval = "monthly";
2023-01-26 00:24:32 +03:00
trim.enable = true;
trim.interval = "weekly";
};
# hardened
networking.firewall.enable = true;
2023-06-27 01:25:28 +03:00
networking.firewall.allowedTCPPorts = lib.mkDefault [ ];
networking.firewall.allowedUDPPorts = lib.mkDefault [ ];
2023-01-26 00:24:32 +03:00
systemd.coredump.enable = false;
programs.firejail.enable = true;
networking.wireless.enable = false;
networking.networkmanager.enable = false;
networking.hostName = config.device;
2023-01-13 04:03:15 +03:00
networking.nameservers = [ "192.168.0.1" ];
networking.defaultGateway = "192.168.0.1";
networking.bridges.br0.interfaces = [ "enp2s0f0" ];
networking.interfaces.br0 = {
useDHCP = false;
ipv4.addresses = [{
2023-01-26 00:43:11 +03:00
address = "192.168.0.10";
prefixLength = 24;
2023-01-13 04:03:15 +03:00
}];
};
networking.extraHosts = ''
2024-01-21 19:29:36 +03:00
127.0.0.1 auth.ataraxiadev.com
2023-01-13 04:03:15 +03:00
127.0.0.1 code.ataraxiadev.com
2023-06-14 03:39:35 +03:00
127.0.0.1 cache.ataraxiadev.com
2024-01-21 19:29:36 +03:00
127.0.0.1 s3.ataraxiadev.com
2023-01-13 04:03:15 +03:00
'';
nix.optimise.automatic = false;
2023-01-13 04:03:15 +03:00
services.logind.lidSwitch = "lock";
services.logind.lidSwitchDocked = "lock";
services.logind.lidSwitchExternalPower = "lock";
2024-01-21 19:29:36 +03:00
systemd.services.systemd-timesyncd.wantedBy = [ "multi-user.target" ];
systemd.timers.systemd-timesyncd = { timerConfig.OnCalendar = "hourly"; };
2023-01-26 00:24:32 +03:00
home-manager.users.${config.mainuser} = {
home.file.".config/libvirt/libvirt.conf".text = ''
uri_default = "qemu:///system"
'';
2023-01-13 04:03:15 +03:00
home.packages = with pkgs; [
2023-06-27 01:25:28 +03:00
bat
bottom
comma
2023-11-11 03:15:07 +03:00
dig.dnsutils
2023-07-30 03:27:14 +03:00
fd
2023-06-27 01:25:28 +03:00
kitty
micro
nix-index-update
2023-07-30 03:27:14 +03:00
p7zip
2023-06-27 01:25:28 +03:00
podman-compose
pwgen
2023-11-11 03:14:37 +03:00
rclone
2023-07-30 03:27:14 +03:00
repgrep
2023-11-11 03:14:37 +03:00
restic
2024-01-21 19:29:36 +03:00
rsync
2023-11-11 03:14:37 +03:00
rustic-rs
2023-06-27 01:25:28 +03:00
smartmontools
2023-01-13 04:03:15 +03:00
];
2023-01-26 00:24:32 +03:00
xdg.mime.enable = false;
home.stateVersion = "22.11";
};
system.stateVersion = "22.11";
}