probably broken, car ride modularizing

This commit is contained in:
Danilo Reyes
2024-06-07 17:07:21 -06:00
parent f9a7f9d8de
commit 46cdbd8a09
23 changed files with 639 additions and 360 deletions

View File

@@ -1,15 +1,17 @@
{ config, lib, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}:
{
imports = [
# <agenix/modules/age.nix>
./hardware-configuration.nix
../../base.nix
../../gnome.nix
./obs-studio.nix
../../pkgs/obs-studio.nix
];
programs.obs-studio = {
enable = true;
enableVirtualCamera = true;
};
my = {
emacs.enable = true;
apps = {
@@ -53,40 +55,46 @@
networking = {
hostName = "workstation";
firewall = let
openPorts = [
6674 # ns-usbloader
];
openPortRanges = [{
from = 1714; # kdeconnect
to = 1764; # kdeconnect
}];
in {
allowedTCPPorts = openPorts;
allowedUDPPorts = openPorts;
allowedTCPPortRanges = openPortRanges;
allowedUDPPortRanges = openPortRanges;
};
firewall =
let
openPorts = [
6674 # ns-usbloader
];
openPortRanges = [
{
from = 1714; # kdeconnect
to = 1764; # kdeconnect
}
];
in
{
allowedTCPPorts = openPorts;
allowedUDPPorts = openPorts;
allowedTCPPortRanges = openPortRanges;
allowedUDPPortRanges = openPortRanges;
};
};
nix = let
featuresList = [
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
"gccarch-znver3"
"gccarch-skylake"
"gccarch-alderlake"
];
in {
distributedBuilds = true;
settings = {
cores = 16;
trusted-users = [ "nixremote" ];
system-features = featuresList;
nix =
let
featuresList = [
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
"gccarch-znver3"
"gccarch-skylake"
"gccarch-alderlake"
];
in
{
distributedBuilds = true;
settings = {
cores = 16;
trusted-users = [ "nixremote" ];
system-features = featuresList;
};
};
};
nixpkgs.config = {
allowUnfree = true;
@@ -96,11 +104,14 @@
users = {
groups.nixremote.gid = 555;
users = {
jawz.packages = (with pkgs; [
gocryptfs # encrypted filesystem! shhh!!!
torrenttools # create torrent files from the terminal!
vcsi # video thumbnails for torrents, can I replace it with ^?
]);
jawz.packages = (
with pkgs;
[
gocryptfs # encrypted filesystem! shhh!!!
torrenttools # create torrent files from the terminal!
vcsi # video thumbnails for torrents, can I replace it with ^?
]
);
nixremote = {
isNormalUser = true;
createHome = true;
@@ -130,11 +141,10 @@
enable = true;
package = pkgs.gnomeExtensions.gsconnect;
};
# nh = {
# enable = true;
# clean.enable = true;
# clean.extraArgs = "--keep-since 4d --keep 3";
# };
obs-studio = {
enable = true;
enableVirtualCamera = true;
};
};
services.resilio = {
@@ -151,11 +161,7 @@
virtualisation = {
podman = {
enable = true;
# Create a `docker` alias for podman, to use it as a drop-in replacement
dockerCompat = true;
# Required for containers under podman-compose to be able to talk to each other.
defaultNetwork.settings.dns_enabled = true;
};
};

View File

@@ -1,9 +1,15 @@
{ config, pkgs, modulesPath, lib, ... }: {
{
config,
pkgs,
modulesPath,
lib,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
nixpkgs.hostPlatform = "x86_64-linux";
hardware = {
cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
bluetooth = {
enable = true;
settings.General = {
@@ -48,62 +54,74 @@
device = "/dev/disk/by-uuid/e9618e85-a631-4374-b2a4-22c376d6e41b";
preLVM = true;
};
# extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ];
# extraModprobeConfig = ''
# options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
# '';
initrd = {
availableKernelModules =
[ "xhci_pci" "ahci" "usbhid" "nvme" "usb_storage" "sd_mod" ];
availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"nvme"
"usb_storage"
"sd_mod"
];
kernelModules = [ ];
};
};
fileSystems = let
nfsMount = (server: nfsDisk: {
device = "${server}:/${nfsDisk}";
fsType = "nfs";
options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ];
});
btrfsMount = subvol: {
device = "/dev/mapper/nvme";
fsType = "btrfs";
options = [
"subvol=${subvol}"
"ssd"
"compress=lzo"
"x-systemd.device-timeout=0"
"space_cache=v2"
"commit=120"
"datacow"
] ++ (if subvol == "nixos" then [ "noatime" ] else [ ]);
};
in {
"/" = btrfsMount "nixos" // { };
"/home" = btrfsMount "home" // { };
"/mnt/games" = btrfsMount "games" // { };
"/mnt/miniserver/pool" = nfsMount "miniserver" "pool" // { };
"/mnt/miniserver/jawz" = nfsMount "miniserver" "jawz" // { };
#"/mnt/server/pool" = nfsMount "server" "pool" // { };
#"/mnt/server/jawz" = nfsMount "server" "jawz" // { };
# "/mnt/miniserver/btrfs" = nfsMount "btrfs" // { };
"/boot" = {
device = "/dev/disk/by-uuid/ac6d349a-96b9-499e-9009-229efd7743a5";
fsType = "ext4";
};
"/boot/efi" = {
device = "/dev/disk/by-uuid/B05D-B5FB";
fsType = "vfat";
};
fileSystems =
let
nfsMount = (
server: nfsDisk: {
device = "${server}:/${nfsDisk}";
fsType = "nfs";
options = [
"x-systemd.automount"
"noauto"
"x-systemd.idle-timeout=600"
];
}
);
btrfsMount = subvol: {
device = "/dev/mapper/nvme";
fsType = "btrfs";
options = [
"subvol=${subvol}"
"ssd"
"compress=lzo"
"x-systemd.device-timeout=0"
"space_cache=v2"
"commit=120"
"datacow"
] ++ (if subvol == "nixos" then [ "noatime" ] else [ ]);
};
in
{
"/" = btrfsMount "nixos" // { };
"/home" = btrfsMount "home" // { };
"/mnt/games" = btrfsMount "games" // { };
"/mnt/miniserver/pool" = nfsMount "miniserver" "pool" // { };
"/mnt/miniserver/jawz" = nfsMount "miniserver" "jawz" // { };
#"/mnt/server/pool" = nfsMount "server" "pool" // { };
#"/mnt/server/jawz" = nfsMount "server" "jawz" // { };
# "/mnt/miniserver/btrfs" = nfsMount "btrfs" // { };
"/boot" = {
device = "/dev/disk/by-uuid/ac6d349a-96b9-499e-9009-229efd7743a5";
fsType = "ext4";
};
"/boot/efi" = {
device = "/dev/disk/by-uuid/B05D-B5FB";
fsType = "vfat";
};
};
swapDevices = [{
device = "/dev/disk/by-partuuid/c1bd22d7-e62c-440a-88d1-6464be1aa1b0";
randomEncryption = {
enable = true;
cipher = "aes-xts-plain64";
keySize = 512;
sectorSize = 4096;
};
}];
swapDevices = [
{
device = "/dev/disk/by-partuuid/c1bd22d7-e62c-440a-88d1-6464be1aa1b0";
randomEncryption = {
enable = true;
cipher = "aes-xts-plain64";
keySize = 512;
sectorSize = 4096;
};
}
];
}

View File

@@ -1,42 +0,0 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.programs.obs-studio;
in {
options.programs.obs-studio = {
enable = mkEnableOption "OBS Studio program";
package = mkOption {
type = types.package;
default = pkgs.obs-studio;
defaultText = "pkgs.obs-studio";
description = "Set obs-studio package to use.";
};
enableVirtualCamera = mkOption {
type = types.bool;
default = false;
description = ''
Installs and sets up the v4l2loopback kernel module, necesary for OBS
to start a virtual camera.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
boot = mkIf cfg.enableVirtualCamera {
extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
extraModprobeConfig = ''
options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
'';
};
security.polkit.enable = mkIf cfg.enableVirtualCamera true;
};
meta.maintainers = with lib.maintainers; [ CaptainJawZ ];
}