This commit is contained in:
Tao Tien 2024-10-13 21:17:25 -07:00
parent f561177af5
commit 8d086ffcca
10 changed files with 5545 additions and 37 deletions

16
flake.lock generated
View file

@ -339,6 +339,21 @@
"type": "github" "type": "github"
} }
}, },
"nixos-facter-modules": {
"locked": {
"lastModified": 1728725827,
"narHash": "sha256-io1UeGaV2HcmK1zCZPnawJu3CxKHhiZ83NBJ+qshWIo=",
"owner": "numtide",
"repo": "nixos-facter-modules",
"rev": "9f2a45b372830d28412160413d1d83f5ee11cc2f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nixos-facter-modules",
"type": "github"
}
},
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1728729581, "lastModified": 1728729581,
@ -505,6 +520,7 @@
"disko": "disko", "disko": "disko",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nixos-cosmic": "nixos-cosmic", "nixos-cosmic": "nixos-cosmic",
"nixos-facter-modules": "nixos-facter-modules",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_5",
"plasma-manager": "plasma-manager", "plasma-manager": "plasma-manager",

View file

@ -3,6 +3,7 @@
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
nixos-hardware.url = "nixos-hardware/master"; nixos-hardware.url = "nixos-hardware/master";
agenix = { agenix = {
url = "github:ryantm/agenix"; url = "github:ryantm/agenix";
@ -51,6 +52,7 @@
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
nixos-facter-modules,
nixos-hardware, nixos-hardware,
agenix, agenix,
disko, disko,
@ -67,6 +69,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
modules = [ modules = [
disko.nixosModules.disko
nixos-hardware.nixosModules.common-cpu-amd nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-cpu-amd-pstate nixos-hardware.nixosModules.common-cpu-amd-pstate
nixos-hardware.nixosModules.common-gpu-nvidia-nonprime nixos-hardware.nixosModules.common-gpu-nvidia-nonprime
@ -87,7 +90,16 @@
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
modules = [ modules = [
nixos-hardware.nixosModules.framework-16-7040-amd # nixos-hardware.nixosModules.framework-16-7040-amd
disko.nixosModules.disko
./systems/disk-config.nix
nixos-facter-modules.nixosModules.facter
{
config.facter.reportPath =
if builtins.pathExists ./systems/NOlaptop-facter.json
then ./systems/NOlaptop-facter.json
else throw "Have you forgotten to run nixos-anywhere with `--generate-hardware-config nixos-facter ./facter.json`?";
}
agenix.nixosModules.default agenix.nixosModules.default
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
./systems/BASED.nix ./systems/BASED.nix
@ -125,7 +137,7 @@
disko.nixosModules.disko disko.nixosModules.disko
{disko.devices.disk.disk1.device = "/dev/vda";} {disko.devices.disk.disk1.device = "/dev/vda";}
./systems/NOserver.nix ./systems/NOserver.nix
./extras/disk-config.nix ./extras/NOserver-disk-config.nix
./extras/minecraft-server.nix ./extras/minecraft-server.nix
]; ];
}; };

BIN
secrets/password-tao.age Normal file

Binary file not shown.

View file

@ -9,4 +9,5 @@ in {
"syncthing-NOcomputer.age".publicKeys = systems; "syncthing-NOcomputer.age".publicKeys = systems;
"syncthing-NOlaptop.age".publicKeys = systems; "syncthing-NOlaptop.age".publicKeys = systems;
"syncthing-uwuraid.age".publicKeys = systems; "syncthing-uwuraid.age".publicKeys = systems;
"password-tao.age".publicKeys = systems;
} }

View file

@ -76,6 +76,8 @@
]; ];
services.openssh.enable = true; services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
];
programs.ssh.startAgent = true; programs.ssh.startAgent = true;
services.printing.enable = lib.mkDefault true; services.printing.enable = lib.mkDefault true;
@ -155,7 +157,7 @@
boot.loader.systemd-boot.enable = lib.mkDefault true; boot.loader.systemd-boot.enable = lib.mkDefault true;
boot.loader.efi.canTouchEfiVariables = lib.mkDefault true; boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
boot.loader.timeout = lib.mkForce 1; boot.loader.timeout = lib.mkForce 1;
boot.supportedFilesystems = ["ntfs" "btrfs"]; # boot.supportedFilesystems = ["ntfs" "btrfs"];
hardware.enableAllFirmware = true; hardware.enableAllFirmware = true;
hardware.bluetooth.enable = lib.mkDefault true; hardware.bluetooth.enable = lib.mkDefault true;

5448
systems/NOlaptop-facter.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -66,42 +66,21 @@
''; '';
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.availableKernelModules = [ # boot.initrd.availableKernelModules = [
"nvme" # "nvme"
"sd_mod" # "sd_mod"
"thunderbolt" # "thunderbolt"
"usb_storage" # "usb_storage"
"xhci_pci" # "xhci_pci"
"usbhid" # "usbhid"
"uas" # "uas"
]; # ];
boot.kernelParams = [ boot.kernelParams = [
"amdgpu.abmlevel=1" "amdgpu.abmlevel=1"
]; ];
boot.kernelModules = ["kvm-amd"]; # boot.kernelModules = ["kvm-amd"];
powerManagement.cpuFreqGovernor = "powersave"; powerManagement.cpuFreqGovernor = "powersave";
systemd.sleep.extraConfig = "HibernateDelaySec=360m"; systemd.sleep.extraConfig = "HibernateDelaySec=360m";
fileSystems."/home/tao/games" = {
device = "/dev/disk/by-uuid/d97a81dc-669c-41d1-912b-829f88fd6f69";
fsType = "btrfs";
options = ["subvol=/home/tao/games" "nosuid" "nodev" "noatime" "compress-force=zstd:3" "users" "rw" "exec" "discard=async"];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/d97a81dc-669c-41d1-912b-829f88fd6f69";
fsType = "btrfs";
options = ["subvol=home" "noatime" "compress-force=zstd:3" "discard=async"];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/d97a81dc-669c-41d1-912b-829f88fd6f69";
fsType = "btrfs";
options = ["noatime" "compress-force=zstd:3" "discard=async"];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/8E28-E53F";
fsType = "vfat";
};
swapDevices = [{device = "/dev/disk/by-uuid/36216521-db46-4bb0-8994-38a36d5c4528";}];
networking.hostName = "NOlaptop"; networking.hostName = "NOlaptop";
} }

49
systems/disk-config.nix Normal file
View file

@ -0,0 +1,49 @@
{lib, ...}: {
disko.devices = {
disk.disk1 = {
device = lib.mkDefault "/dev/disk/by-diskseq/1";
type = "disk";
content = {
type = "gpt";
partitions = {
esp = {
name = "ESP";
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
plainSwap = {
size = "32G";
content = {
type = "swap";
discardPolicy = "both";
resumeDevice = true;
};
};
root = {
name = "root";
size = "100%";
content = {
type = "filesystem";
format = "bcachefs";
mountOptions = ["noatime"];
extraArgs = [
"--compression zstd"
"--background_compression zstd"
"--discard"
];
subvolumes = {
"/home" = {};
"/nix" = {};
};
};
};
};
};
};
};
}

View file

@ -98,9 +98,9 @@
devices = { devices = {
# we do a lil anti-patterns https://github.com/ryantm/agenix?tab=readme-ov-file#builtinsreadfile-anti-pattern # we do a lil anti-patterns https://github.com/ryantm/agenix?tab=readme-ov-file#builtinsreadfile-anti-pattern
# bootstrap by commenting out devices first and rebuild switch impurely # bootstrap by commenting out devices first and rebuild switch impurely
"nocomputer".id = builtins.readFile config.age.secrets.syncthing-NOcomputer.path; # "nocomputer".id = builtins.readFile config.age.secrets.syncthing-NOcomputer.path;
"nolaptop".id = builtins.readFile config.age.secrets.syncthing-NOlaptop.path; # "nolaptop".id = builtins.readFile config.age.secrets.syncthing-NOlaptop.path;
"uwuraid".id = builtins.readFile config.age.secrets.syncthing-uwuraid.path; # "uwuraid".id = builtins.readFile config.age.secrets.syncthing-uwuraid.path;
}; };
folders = let folders = let
devs = [ devs = [
@ -173,6 +173,7 @@
users.users.tao = { users.users.tao = {
isNormalUser = true; isNormalUser = true;
passwordFile = config.age.secrets.password-tao.path;
extraGroups = ["audio" "video" "wheel" "libvirtd" "dialout" "game"]; extraGroups = ["audio" "video" "wheel" "libvirtd" "dialout" "game"];
shell = pkgs.nushell; shell = pkgs.nushell;
}; };