Add penguin configuration

This commit is contained in:
2025-08-19 00:34:18 +08:00
parent 2835a0a72e
commit c594ff128f
7 changed files with 296 additions and 14 deletions

View File

@@ -0,0 +1,76 @@
{
pkgs,
inputs,
lib,
...
}:
let
inherit (inputs) disko agenix home-manager;
in
{
imports = [
disko.nixosModules.disko
agenix.nixosModules.default
home-manager.nixosModules.home-manager
./disko-config.nix
./hardware-configuration.nix
];
config = {
my_users.enable = true;
my_nix.enable = true;
networking.hostName = "penguin";
boot = {
tmp.cleanOnBoot = true;
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
time.timeZone = "Asia/Singapore";
networking.firewall = {
enable = true;
allowedTCPPorts = [
22
3000
3001
];
networkmanager.enable = true;
nftables.enable = true;
trustedInterfaces = [ "tailscale0" ];
};
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
users.users.cs3223 = lib.snowfall.mkUser {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
services.tailscale.enable = true;
nixpkgs.config = {
rocmSupport = true;
};
programs._1password.enable = true;
environment.systemPackages = with pkgs; [
git
neovim
];
virtualisation.podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
system.stateVersion = "25.11";
};
}

View File

@@ -0,0 +1,91 @@
{
disko.devices = {
disk = {
disk1 = {
type = "disk";
device = "/dev/nvme1n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
crypt_p1 = {
size = "100%";
content = {
type = "luks";
name = "crypt_p1";
passwordFile = "/tmp/disk.key";
settings = {
allowDiscards = true;
};
};
};
};
};
};
disk2 = {
type = "disk";
device = "/dev/nvme2n1";
content = {
type = "gpt";
partitions = {
crypt_p2 = {
size = "100%";
content = {
type = "luks";
name = "crypt_p2";
settings = {
allowDiscards = true;
};
content = {
type = "btrfs";
extraArgs = [
"-d raid1"
"/dev/mapper/crypt_p1"
];
subvolumes = {
"@" = { };
"@/root" = {
mountpoint = "/";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"@/home" = {
mountpoint = "/home";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"@/nix" = {
mountpoint = "/nix";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"@/swap" = {
# mountpoint = "/.swapvol";
# swap.swapfile.size = "64G";
mountOptions = [ "noatime" ];
};
};
};
};
};
};
};
};
};
};
}

View File

@@ -0,0 +1,29 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0f0np0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0f1np1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}