dotfiles/nix-conf/system/flake.nix

335 lines
10 KiB
Nix
Raw Normal View History

2022-11-06 20:23:10 +00:00
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
2022-12-23 09:20:17 +00:00
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-11-06 20:23:10 +00:00
};
2023-06-18 00:46:31 +00:00
outputs = {
self,
nixpkgs,
agenix,
...
}: let
lib = nixpkgs.lib;
proj_root = ./../..;
# TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- `
base_modules = [
agenix.nixosModule
{
age.secrets.s3fs = {
file = ../../secrets/s3fs.age;
# mode = "600"; # owner + group only
# owner = "hungtr";
# group = "users";
};
age.secrets."s3fs.digital-garden" = {
file = ../../secrets/s3fs.digital-garden.age;
};
age.secrets._nhitrl_cred = {
file = ../../secrets/_nhitrl.age;
};
environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
}
];
in {
# Windows with NixOS WSL
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
base_modules
++ [
./wsl-configuration.nix
2022-12-22 00:43:20 +00:00
{
system.stateVersion = "22.05";
}
];
2023-06-18 00:46:31 +00:00
specialArgs = {
# includeHardware = false;
hostname = "Felia";
_services.openssh = {
permitRootLogin = "no";
enable = true;
2022-11-14 22:10:46 +00:00
};
};
2023-06-18 00:46:31 +00:00
};
nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
base_modules
++ [
./configuration.nix
2022-12-22 00:43:20 +00:00
{
system.stateVersion = "22.05";
mod.tailscale.enable = true;
2022-12-22 00:43:20 +00:00
}
];
2023-06-18 00:46:31 +00:00
specialArgs = {
hostname = "lizzi";
_networking = {
interfaces.eth1.ipv4.addresses = [
{
address = "71.0.0.1";
prefixLength = 24;
2023-06-18 00:46:31 +00:00
}
];
firewall = {
enable = true;
2023-06-18 00:46:31 +00:00
allowedTCPPorts = [80 443 22];
};
2023-06-18 00:46:31 +00:00
useDHCP = false;
# required so that we get IP address from linode
interfaces.eth0.useDHCP = true;
};
_boot.loader.grub.enable = true;
_boot.loader.grub.version = 2;
_services.openssh = {
permitRootLogin = "no";
enable = true;
};
_services.gitea = {
enable = true;
stateDir = "/gitea";
rootUrl = "https://git.pegasust.com";
settings = {
repository = {
"ENABLE_PUSH_CREATE_USER" = true;
"ENABLE_PUSH_CREATE_ORG" = true;
};
};
2023-06-18 00:46:31 +00:00
};
# Highly suspect that thanks to nginx, ipv6 is disabled?
_services.nginx = {
enable = true;
clientMaxBodySize = "100m"; # Allow big file transfers over git :^)
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."git.pegasust.com" = {
# Gitea hostname
sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem";
sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem";
forceSSL = true; # Runs on port 80 and 443
locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea
};
};
};
2023-06-18 00:46:31 +00:00
};
# Generic machine
nixosConfigurations.pixi = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
base_modules
++ [
./configuration.nix
2022-12-22 00:43:20 +00:00
{
system.stateVersion = "22.05";
}
];
2023-06-18 00:46:31 +00:00
specialArgs = {
hostname = "pixi";
_networking = {
# interfaces.eth1.ipv4.addresses = [{
# address = "71.0.0.1";
# prefixLength = 24;
# }];
firewall = {
enable = false;
allowedTCPPorts = [80 443 22];
2022-11-28 01:30:29 +00:00
};
2023-06-18 00:46:31 +00:00
useDHCP = false;
# interfaces.eth0.useDHCP = true;
};
_boot.loader.grub.enable = true;
_boot.loader.grub.version = 2;
_services.openssh = {
permitRootLogin = "no";
enable = true;
};
_services.gitea = {
enable = true;
stateDir = "/gitea";
rootUrl = "https://git.pegasust.com";
settings = {
repository = {
"ENABLE_PUSH_CREATE_USER" = true;
"ENABLE_PUSH_CREATE_ORG" = true;
2022-11-28 01:30:29 +00:00
};
};
2023-06-18 00:46:31 +00:00
};
_services.nginx = {
enable = true;
clientMaxBodySize = "100m"; # Allow big file transfers over git :^)
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."git.pegasust.com" = {
# Gitea hostname
sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem";
sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem";
forceSSL = true; # Runs on port 80 and 443
locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea
2022-11-28 01:30:29 +00:00
};
};
};
2023-06-18 00:46:31 +00:00
};
nixosConfigurations.nyx = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
base_modules
++ [
./configuration.nix
2022-12-22 00:43:20 +00:00
{
system.stateVersion = "22.05";
}
];
2023-06-18 00:46:31 +00:00
specialArgs = {
hostname = "nyx";
_networking = {
enableIPv6 = false;
interfaces.eth1.ipv4.addresses = [
{
address = "71.0.0.2";
prefixLength = 24;
2023-06-18 00:46:31 +00:00
}
];
firewall.enable = true;
useDHCP = false;
interfaces.eth0.useDHCP = true;
};
_boot.loader.grub.enable = true;
_boot.loader.grub.version = 2;
_services.openssh = {
permitRootLogin = "no";
enable = true;
2022-11-14 22:10:46 +00:00
};
};
2023-06-18 00:46:31 +00:00
};
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
base_modules
++ [
./configuration.nix
2022-12-22 00:43:20 +00:00
{
system.stateVersion = "22.05";
}
];
2023-06-18 00:46:31 +00:00
specialArgs = {
hostname = "nixos";
};
2023-06-18 00:46:31 +00:00
};
nixosConfigurations.htran-dev = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
base_modules
++ [
./configuration.nix
{
system.stateVersion = "22.11";
mod.tailscale.enable = false;
networking.defaultGateway = {
address = "10.100.200.1";
# interface = "ens32";
};
networking.interfaces.ens32.ipv4.addresses = [
2023-06-18 00:46:31 +00:00
{
address = "10.100.200.230";
prefixLength = 24;
}
];
}
];
2023-06-18 00:46:31 +00:00
specialArgs = {
hostname = "htran-dev";
_networking = {
firewall.enable = true;
useDHCP = false;
interfaces.eth0.useDHCP = true;
};
_boot.loader.grub.enable = true;
_boot.loader.grub.version = 2;
_services.openssh = {
permitRootLogin = "no";
enable = true;
};
};
2023-06-18 00:46:31 +00:00
};
nixosConfigurations.bao = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs.hostname = "bao";
modules =
base_modules
++ [
2022-12-21 10:37:03 +00:00
./configuration.nix
./../../modules/storage.perso.sys.nix
2023-02-05 03:27:08 +00:00
./../../modules/kde.sys.nix
2022-12-22 23:04:04 +00:00
# GPU, sound, networking stuffs
2023-02-05 03:27:08 +00:00
./../../modules/pulseaudio.sys.nix
./../../modules/opengl.sys.nix
./../../modules/nvgpu.sys.nix
2023-06-18 00:46:31 +00:00
({
config,
pkgs,
lib,
...
}: {
mod.tailscale.enable = true;
# Use UEFI
boot.loader.systemd-boot.enable = true;
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
networking.hostName = "bao"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
time.timeZone = "America/Phoenix";
# Configure keymap in X11
services.xserver.layout = "us";
# services.xserver.xkbOptions = {
# "eurosign:e";
# "caps:escape" # map caps to escape.
# };
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
# Enable CUPS to print documents.
# services.printing.enable = true;
2023-06-18 00:46:31 +00:00
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Just an initial user to get this started lol
users.users.user = {
initialPassword = "pw123";
extraGroups = ["wheel" "networkmanager" "audio"];
isNormalUser = true;
};
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
# List services that you want to enable:
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
# Enable the OpenSSH daemon.
services.openssh.enable = true;
2022-12-21 10:37:03 +00:00
2023-06-18 00:46:31 +00:00
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
})
2022-12-21 10:37:03 +00:00
];
2022-11-06 20:23:10 +00:00
};
2023-06-18 00:46:31 +00:00
};
2022-11-06 20:23:10 +00:00
}