feat: init

This commit is contained in:
Nick 2024-10-06 15:25:05 -05:00
commit c19ea940bd
320 changed files with 23845 additions and 0 deletions

34
systems/fallaryn/boot.nix Executable file
View file

@ -0,0 +1,34 @@
{
pkgs,
config,
...
}: {
boot = {
extraModulePackages = [
config.boot.kernelPackages.v4l2loopback.out
];
supportedFilesystems = ["ntfs"];
initrd = {
availableKernelModules = ["amdgpu" "nvme" "ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod"];
kernelModules = [];
};
kernelModules = ["kvm-amd" "vfio-pci" "v4l2loopback"];
kernelPackages = pkgs.linuxPackages_latest;
loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
systemd-boot.enable = false;
grub = {
enable = true;
device = "nodev";
useOSProber = true;
efiSupport = true;
};
};
};
}

13
systems/fallaryn/default.nix Executable file
View file

@ -0,0 +1,13 @@
{lib, ...}: {
imports = [
./boot.nix
./filesystem.nix
./graphics.nix
./hardware.nix
./networking.nix
./sops.nix
./ssh.nix
];
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
system.stateVersion = lib.mkForce "24.05";
}

65
systems/fallaryn/filesystem.nix Executable file
View file

@ -0,0 +1,65 @@
{
config,
flake,
...
}: let
inherit (flake.config.people) user2;
inherit (flake.config.system.device) fallaryn nas;
secrets0 = config.sops.secrets."network/fallaryn".path;
in {
imports = [];
fileSystems = let
synologyDrives = [
"folder2"
];
storageDrives = [
"storage0"
"storage1"
];
synologyMounts = folder: {
name = "${nas.${folder}.mount}";
value = {
device = nas.${folder}.device;
fsType = "cifs";
options = nas.${folder}.options ++ ["credentials=${secrets0}"];
};
};
storageMounts = storage: {
name = "${fallaryn.${storage}.mount}";
value = {
device = fallaryn.${storage}.device;
fsType = "ext4";
options = fallaryn.${storage}.options;
};
};
in
{
"/" = {
device = "/dev/disk/by-uuid/d02cb367-26e0-4708-8840-75dcc4362ff4";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-uuid/22BD-5A25";
fsType = "vfat";
options = fallaryn.boot.options;
};
}
// (builtins.listToAttrs (map synologyMounts synologyDrives))
// (builtins.listToAttrs (map storageMounts storageDrives));
swapDevices = [
{device = "/dev/disk/by-uuid/cc7ab213-26c9-4567-91ca-9dba6e98c9d1";}
];
systemd.tmpfiles.rules = [
"Z ${config.home-manager.users.${user2}.home.homeDirectory} 0755 ${user2} users -"
"Z ${fallaryn.storage0.mount} 0755 ${user2} users -"
"Z ${fallaryn.storage1.mount} 0755 ${user2} users -"
];
services.udisks2.enable = true;
}

17
systems/fallaryn/graphics.nix Executable file
View file

@ -0,0 +1,17 @@
{pkgs, ...}: {
hardware = {
graphics = {
enable = true;
extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
rocmPackages.clr.icd
pkgs.amdvlk
];
extraPackages32 = [
pkgs.driversi686Linux.amdvlk
];
};
};
boot.initrd.kernelModules = ["amdgpu"];
}

12
systems/fallaryn/hardware.nix Executable file
View file

@ -0,0 +1,12 @@
{
config,
lib,
pkgs,
...
}: {
hardware = {
firmware = [pkgs.rtl8761b-firmware];
enableAllFirmware = true;
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
};
}

29
systems/fallaryn/networking.nix Executable file
View file

@ -0,0 +1,29 @@
{
lib,
flake,
...
}: let
inherit (flake.config.system.device) fallaryn;
in {
networking = {
hostName = fallaryn.name;
networkmanager.enable = true;
useDHCP = lib.mkDefault true;
firewall = {
enable = true;
allowedTCPPorts = [];
};
};
services = {
avahi = {
enable = true;
openFirewall = true;
nssmdns4 = true;
};
sshd.enable = true;
openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
};
}

30
systems/fallaryn/sops.nix Executable file
View file

@ -0,0 +1,30 @@
{flake, ...}: let
inherit
(flake.config.people)
user2
;
in {
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
validateSopsFiles = false;
age = {
keyFile = "/var/lib/sops-nix/key.txt";
generateKey = false;
};
secrets = {
"ssh/private" = {
path = "/home/${user2}/.ssh/id_ed25519";
owner = user2;
};
"ssh/public" = {
path = "/home/${user2}/.ssh/id_ed25519.pub";
owner = user2;
};
"network/fallaryn" = {
path = "/etc/fallaryn-synology";
owner = "root";
mode = "600";
};
};
};
}

8
systems/fallaryn/ssh.nix Executable file
View file

@ -0,0 +1,8 @@
{flake, ...}: let
inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) sshKeys;
in {
users.users.${user0} = {
openssh.authorizedKeys.keys = sshKeys;
};
}