formatting

This commit is contained in:
mjallen18
2024-02-28 21:49:51 -06:00
parent bdfd5e92b7
commit 347d30094b
40 changed files with 459 additions and 503 deletions

View File

@@ -1,4 +1,3 @@
# WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }:
@@ -6,8 +5,9 @@ let
folder = ../cachix;
toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
imports = lib.mapAttrsToList toImport
(lib.filterAttrs filterCaches (builtins.readDir folder));
in {
inherit imports;
nix.settings.substituters = ["https://cache.nixos.org/"];
}
nix.settings.substituters = [ "https://cache.nixos.org/" ];
}

View File

@@ -1,13 +1,10 @@
{
nix = {
settings = {
substituters = [
"https://nix-community.cachix.org"
];
substituters = [ "https://nix-community.cachix.org" ];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}
}

View File

@@ -21,35 +21,36 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = { self, nixpkgs, lanzaboote, impermanence, nix-flatpak, home-manager, nixos-hardware } @ inputs: {
nixosConfigurations = {
# Desktop
"matt-nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
impermanence.nixosModules.impermanence
lanzaboote.nixosModules.lanzaboote
# kde.nixosModules.plasma6
nix-flatpak.nixosModules.nix-flatpak
./hosts/desktop/configuration.nix
./share/impermanence
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.matt = import ./hosts/desktop/home.nix;
}
];
};
outputs = { self, nixpkgs, lanzaboote, impermanence, nix-flatpak, home-manager
, nixos-hardware }@inputs: {
nixosConfigurations = {
# Desktop
"matt-nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
impermanence.nixosModules.impermanence
lanzaboote.nixosModules.lanzaboote
# kde.nixosModules.plasma6
nix-flatpak.nixosModules.nix-flatpak
./hosts/desktop/configuration.nix
./share/impermanence
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.matt = import ./hosts/desktop/home.nix;
}
];
};
# Pi4
"nixos-pi4" = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./hosts/pi4/configuration.nix
];
# Pi4
"nixos-pi4" = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./hosts/pi4/configuration.nix
];
};
};
};
};
}

View File

@@ -1,13 +1,7 @@
{ config, lib, pkgs, ... }:
let
timezone = "America/Chicago";
in
{
imports =
[
../modules
../share
];
let timezone = "America/Chicago";
in {
imports = [ ../modules ../share ];
# Enable nix flakes and nix-command tools
nix.settings.experimental-features = [ "nix-command" "flakes" ];
@@ -23,17 +17,17 @@ in
# Disable pulse audio in favor of pipewire
pulseaudio.enable = false;
};
# Services configs
services = {
openssh.enable = true;
# Enable firmware updates
fwupd.enable = true;
# Enable CUPS to print documents.
printing.enable = true;
# configure pipewire
pipewire = {
enable = true;
@@ -56,8 +50,8 @@ in
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
magicOrExtension = ''\x7fELF....AI\x02'';
mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff";
magicOrExtension = "\\x7fELF....AI\\x02";
};
};
}
}

View File

@@ -5,31 +5,29 @@
{ config, lib, pkgs, ... }:
let
user = "matt";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "matt-nixos";
# discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages.
discover-wrapped = pkgs.symlinkJoin
{
name = "discover-flatpak-backend";
paths = [ pkgs.libsForQt5.discover ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak"
'';
};
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# ../../cachix/cachix.nix
../default.nix
];
discover-wrapped = pkgs.symlinkJoin {
name = "discover-flatpak-backend";
paths = [ pkgs.libsForQt5.discover ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak"
'';
};
in {
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
# ../../cachix/cachix.nix
../default.nix
];
share.hardware.amd = {
enable = true;
corectrl.enable = true;
corectrl.enablePolkit = true;
corectrl.enablePolkit = true;
};
# Configure bootloader with lanzaboot and secureboot
@@ -55,13 +53,11 @@ in
};
configurationLimit = 2;
};
# Override kernel to latest
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [
"quiet"
];
kernelParams = [ "quiet" ];
consoleLogLevel = 3;
bootspec.enable = true;
@@ -77,7 +73,7 @@ in
# Steam udev rules for remote play
steam-hardware.enable = true;
# opengl.enable = true;
# # Enables support for 32bit libs that steam uses
# opengl.driSupport32Bit = true;
@@ -88,7 +84,7 @@ in
# Enable the X11 windowing system.
xserver = {
enable = true;
# Enable the Plasma 6 Desktop Environment.
displayManager = {
sddm.enable = true;
@@ -147,10 +143,8 @@ in
};
# Time config
time = {
hardwareClockInLocalTime = true;
};
time = { hardwareClockInLocalTime = true; };
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
@@ -218,8 +212,10 @@ in
# Steam
steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
remotePlay.openFirewall =
true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall =
true; # Open ports in the firewall for Source Dedicated Server
};
};
@@ -236,18 +232,19 @@ in
packageOverrides = pkgs: {
steam = pkgs.steam.override {
extraPkgs = pkgs: with pkgs; [
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
libkrb5
keyutils
];
extraPkgs = pkgs:
with pkgs; [
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
libkrb5
keyutils
];
};
};
};

View File

@@ -4,67 +4,65 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "ahci" "usbhid" "uas" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "nvme" "ahci" "usbhid" "uas" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "none";
fsType = "tmpfs";
};
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ];
};
fileSystems."/etc" =
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=etc" "compress=zstd" "noatime" ];
};
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=etc" "compress=zstd" "noatime" ];
};
fileSystems."/root" =
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ];
};
fileSystems."/root" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=log" "compress=zstd" "noatime" ];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=log" "compress=zstd" "noatime" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=home" "compress=zstd" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs";
options = [ "subvol=home" "compress=zstd" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1058-F967";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1058-F967";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/1db92c49-aa8d-4ca2-b453-83bfcd1d36dd"; }
];
[{ device = "/dev/disk/by-uuid/1db92c49-aa8d-4ca2-b453-83bfcd1d36dd"; }];
fileSystems."/home/matt/Games" =
{ device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3";
fsType = "ext4";
};
fileSystems."/home/matt/1TB" =
{ device = "/dev/disk/by-uuid/7f9c2d1e-64ee-d901-2084-2d1e64eed901";
fsType = "ext4";
};
fileSystems."/home/matt/Games" = {
device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3";
fsType = "ext4";
};
fileSystems."/home/matt/1TB" = {
device = "/dev/disk/by-uuid/7f9c2d1e-64ee-d901-2084-2d1e64eed901";
fsType = "ext4";
};
# 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
@@ -75,5 +73,6 @@
# networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,8 +1,14 @@
{ pkgs, ... }:
{ pkgs, ... }:
let
vulkan-hdr-layer = import ./vulkan-hdr-layer.nix { inherit (pkgs) lib stdenv fetchFromGitHub meson pkg-config vulkan-loader ninja writeText vulkan-headers vulkan-utility-libraries jq wayland; libX11 = pkgs.xorg.libX11; libXrandr = pkgs.xorg.libXrandr; libxcb = pkgs.xorg.libxcb; };
in
{
vulkan-hdr-layer = import ./vulkan-hdr-layer.nix {
inherit (pkgs)
lib stdenv fetchFromGitHub meson pkg-config vulkan-loader ninja writeText
vulkan-headers vulkan-utility-libraries jq wayland;
libX11 = pkgs.xorg.libX11;
libXrandr = pkgs.xorg.libXrandr;
libxcb = pkgs.xorg.libxcb;
};
in {
home.username = "matt";
home.homeDirectory = "/home/matt";
@@ -30,7 +36,7 @@ in
programs.command-not-found.enable = true;
home.packages = with pkgs; [
home.packages = with pkgs; [
firefox
tree
lm_sensors
@@ -46,6 +52,8 @@ in
python3
virt-manager
orca-slicer
nixfmt
deadnix
# Other packages
vulkan-hdr-layer
];

View File

@@ -1,4 +1,6 @@
{ lib, stdenv, fetchFromGitHub, meson, pkg-config, vulkan-loader, ninja, writeText, vulkan-headers, vulkan-utility-libraries, jq, libX11, libXrandr, libxcb, wayland }:
{ lib, stdenv, fetchFromGitHub, meson, pkg-config, vulkan-loader, ninja
, writeText, vulkan-headers, vulkan-utility-libraries, jq, libX11, libXrandr
, libxcb, wayland }:
stdenv.mkDerivation rec {
pname = "vulkan-hdr-layer";
@@ -18,7 +20,15 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ vulkan-headers meson ninja pkg-config jq ];
buildInputs = [ vulkan-headers vulkan-loader vulkan-utility-libraries libX11 libXrandr libxcb wayland ];
buildInputs = [
vulkan-headers
vulkan-loader
vulkan-utility-libraries
libX11
libXrandr
libxcb
wayland
];
# Help vulkan-loader find the validation layers
setupHook = writeText "setup-hook" ''
@@ -31,4 +41,4 @@ stdenv.mkDerivation rec {
platforms = platforms.linux;
license = licenses.mit;
};
}
}

View File

@@ -5,21 +5,20 @@
{ config, lib, pkgs, ... }:
let
user = "admin";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "jallen-nas";
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../default.nix
];
in {
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
../default.nix
];
nas-apps = {
jellyfin.enable = true;
jellyseerr.enable = true;
sabnzbd.enable = true;
radarr.enable = true;
@@ -82,7 +81,6 @@ in
dataDir = "/mnt/ssd/nix-app-data/grafana";
};
services.prometheus = {
enable = true;
port = 9001;
@@ -95,19 +93,33 @@ in
smartctl = {
enable = true;
group = "disk";
devices = [ "/dev/sda" "/dev/sdb" "/dev/sdc" "/dev/sdd" "/dev/sde" "/dev/sdf" "/dev/sdg" "/dev/sdh" "/dev/sdi" "/dev/nvme0n1" "/dev/nvme1n1" ];
devices = [
"/dev/sda"
"/dev/sdb"
"/dev/sdc"
"/dev/sdd"
"/dev/sde"
"/dev/sdf"
"/dev/sdg"
"/dev/sdh"
"/dev/sdi"
"/dev/nvme0n1"
"/dev/nvme1n1"
];
};
};
scrapeConfigs = [
{
job_name = hostname;
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}"];
}];
}
];
scrapeConfigs = [{
job_name = hostname;
static_configs = [{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${
toString config.services.prometheus.exporters.smartctl.port
}"
];
}];
}];
};
share.hardware.nvidia = {
@@ -130,13 +142,11 @@ in
efiSysMountPoint = "/boot";
};
};
# Override kernel to latest
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = [
"nohibernate"
];
kernelParams = [ "nohibernate" ];
consoleLogLevel = 3;
bootspec.enable = true;
@@ -152,7 +162,7 @@ in
# # Nvidia
# nvidia = {
# package = config.boot.kernelPackages.nvidiaPackages.beta;
# # Modesetting is required.
# modesetting.enable = true;
@@ -176,7 +186,7 @@ in
# # accessible via `nvidia-settings`.
# nvidiaSettings = true;
# };
# # Enable OpenGL
# opengl = {
# enable = true;
@@ -193,7 +203,7 @@ in
# # Load nvidia driver for Xorg and Wayland
# videoDrivers = ["nvidia"];
# Enable the Plasma 6 Desktop Environment.
displayManager = {
sddm.enable = true;
@@ -279,7 +289,8 @@ in
firewall = {
enable = true;
allowPing = true;
extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns''; # TODO is this needed?
extraCommands =
"iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; # TODO is this needed?
allowedTCPPorts = [ 2342 61208 ];
allowedUDPPorts = [ 2342 61208 ];
};
@@ -335,7 +346,15 @@ in
# Admin account
users."${user}" = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "docker" "podman" "libvirtd" "nas-apps" "jallen-nas" ]; # Enable sudo for the user.
extraGroups = [
"wheel"
"networkmanager"
"docker"
"podman"
"libvirtd"
"nas-apps"
"jallen-nas"
]; # Enable sudo for the user.
initialHashedPassword = password;
shell = pkgs.fish;
openssh.authorizedKeys.keys = [
@@ -367,7 +386,7 @@ in
group = "jallen-nas";
extraGroups = [ "jallen-nas" ]; # Enable sudo for the user.
hashedPassword = password;
};
};
};
# Virtualisation

View File

@@ -4,58 +4,56 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "nvme" "mpt3sas" "xhci_pci" "ahci" "uas" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "nvme" "mpt3sas" "xhci_pci" "ahci" "uas" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "none";
fsType = "tmpfs";
};
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/C6E9-7371";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/C6E9-7371";
fsType = "vfat";
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=nix" "compress-force=zstd" "noatime" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=nix" "compress-force=zstd" "noatime" ];
};
fileSystems."/etc" =
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=etc" "compress-force=zstd" "noatime" ];
};
fileSystems."/etc" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=etc" "compress-force=zstd" "noatime" ];
};
fileSystems."/root" =
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=root" "compress-force=zstd" "noatime" ];
};
fileSystems."/root" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=root" "compress-force=zstd" "noatime" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=log" "compress-force=zstd" "noatime" ];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=log" "compress-force=zstd" "noatime" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=home" "compress-force=zstd"];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs";
options = [ "subvol=home" "compress-force=zstd" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/c08ba901-a8a9-4006-9688-002bb24da1b6"; }
];
[{ device = "/dev/disk/by-uuid/c08ba901-a8a9-4006-9688-002bb24da1b6"; }];
# 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
@@ -77,5 +75,6 @@
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -6,18 +6,18 @@
let
user = "matt";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
SSID = "Joeys Jungle";
SSIDpassword = "kR8v&3Qd";
interface = "wlan0";
timezone = "America/Chicago";
hostname = "nixos-pi4";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./docker-pi4.nix
];
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
./docker-pi4.nix
];
# Enable nix flakes and nix-command tools
nix.settings.experimental-features = [ "nix-command" "flakes" ];
@@ -43,12 +43,7 @@ in {
};
};
environment.systemPackages = with pkgs; [
vim
raspberrypi-eeprom
htop
git
];
environment.systemPackages = with pkgs; [ vim raspberrypi-eeprom htop git ];
services.openssh.enable = true;

View File

@@ -25,9 +25,7 @@
"/media/T5/tv:/tv"
];
ports = [ "8096:8096" ];
environment = {
JELLYFIN_LOG_DIR = "/log";
};
environment = { JELLYFIN_LOG_DIR = "/log"; };
};
}

View File

@@ -4,33 +4,30 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ec969af6-d557-408a-a149-ba23d31fd8a2";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/ec969af6-d557-408a-a149-ba23d31fd8a2";
fsType = "ext4";
};
fileSystems."/media/T5" =
{ device = "/dev/disk/by-uuid/191ce486-899d-4718-81e3-5c9b3ea860e4";
fsType = "ext4";
};
fileSystems."/media/T5" = {
device = "/dev/disk/by-uuid/191ce486-899d-4718-81e3-5c9b3ea860e4";
fsType = "ext4";
};
fileSystems."/FIRMWARE" =
{ device = "/dev/disk/by-uuid/5A9F-FC90";
fsType = "vfat";
};
fileSystems."/FIRMWARE" = {
device = "/dev/disk/by-uuid/5A9F-FC90";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/d9909ef7-c345-48f7-b210-ad7cbe72224b"; }
];
[{ device = "/dev/disk/by-uuid/d9909ef7-c345-48f7-b210-ad7cbe72224b"; }];
# 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

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.collabora;
let cfg = config.nas-apps.collabora;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -16,9 +13,9 @@ in {
# ...
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.collabora = {
enable = mkEnableOption "collabora docker service";
autoStart = mkOption {
type = types.bool;
default = true;

View File

@@ -1,14 +1,11 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.jellyfin;
let cfg = config.nas-apps.jellyfin;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
systemd.services.jellyfin-nvidia-docker = {
path = [ pkgs.bash pkgs.docker ];
script = ''
@@ -74,4 +71,4 @@ in {
# # PGID = "1000";
# # };
# # };
# }
# }

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.jellyfin = {
enable = mkEnableOption "jellyfin docker service";
autoStart = mkOption {
type = types.bool;
default = true;
@@ -55,4 +54,4 @@ with lib;
};
};
}
}

View File

@@ -1,24 +1,19 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.jellyseerr;
let cfg = config.nas-apps.jellyseerr;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.port}:5055" ];
volumes = [
"${cfg.configPath}:/config"
];
volumes = [ "${cfg.configPath}:/config" ];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.jellyseerr = {
enable = mkEnableOption "jellyseerr docker service";
autoStart = mkOption {
type = types.bool;
default = true;
@@ -45,4 +44,4 @@ with lib;
};
};
}
}

View File

@@ -1,28 +1,23 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.mariadb;
let cfg = config.nas-apps.mariadb;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.port}:3306" ];
volumes = [
"${cfg.configPath}:/config"
];
volumes = [ "${cfg.configPath}:/config" ];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
MYSQL_ROOT_PASSWORD = cfg.rootPassword;
MYSQL_DATABASE = cfg.databaseName;
MYSQL_USER = cfg.databaseUser;
MYSQL_PASSWORD = cfg.databasePassword;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
MYSQL_ROOT_PASSWORD = cfg.rootPassword;
MYSQL_DATABASE = cfg.databaseName;
MYSQL_USER = cfg.databaseUser;
MYSQL_PASSWORD = cfg.databasePassword;
};
};
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.mariadb = {
enable = mkEnableOption "mariadb docker service";
autoStart = mkOption {
type = types.bool;
default = true;

View File

@@ -1,25 +1,19 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.nextcloud;
let cfg = config.nas-apps.nextcloud;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.dataPath}:/data"
];
volumes = [ "${cfg.configPath}:/config" "${cfg.dataPath}:/data" ];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.nextcloud = {
enable = mkEnableOption "nextcloud docker service";
autoStart = mkOption {
type = types.bool;
default = true;
@@ -54,4 +53,4 @@ with lib;
default = "America/Chicago";
};
};
}
}

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.radarr;
let cfg = config.nas-apps.radarr;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -13,14 +10,14 @@ in {
image = cfg.image;
ports = [ "${cfg.port}:7878" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies"
"${cfg.downloadsPath}:/downloads"
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies"
"${cfg.downloadsPath}:/downloads"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.radarr = {
enable = mkEnableOption "radarr docker service";
autoStart = mkOption {
type = types.bool;
default = true;

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.sabnzbd;
let cfg = config.nas-apps.sabnzbd;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -13,16 +10,16 @@ in {
image = cfg.image;
ports = [ "${cfg.port}:8080" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies"
"${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads"
"${cfg.downloadsIncompletePath}:/downloads-incomplete"
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies"
"${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads"
"${cfg.downloadsIncompletePath}:/downloads-incomplete"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-apps.sabnzbd = {
enable = mkEnableOption "sabnzbd docker service";
autoStart = mkOption {
type = types.bool;
default = true;

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.sonarr;
let cfg = config.nas-apps.sonarr;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -13,14 +10,14 @@ in {
image = cfg.image;
ports = [ "${cfg.port}:8989" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads"
"${cfg.configPath}:/config"
"${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};

View File

@@ -1,9 +1,8 @@
{lib, ... }:
with lib;
{
{ lib, ... }:
with lib; {
options.nas-apps.sonarr = {
enable = mkEnableOption "sonarr docker service";
autoStart = mkOption {
type = types.bool;
default = true;

View File

@@ -1,14 +1,11 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-apps.swag;
let cfg = config.nas-apps.swag;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [ cfg.httpPort cfg.httpsPort ];
allowedUDPPorts = [ cfg.httpPort cfg.httpsPort ];
@@ -18,17 +15,15 @@ in {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${toString cfg.httpPort}:80" "${toString cfg.httpsPort}:443" ];
volumes = [
"${cfg.configPath}:/config"
];
volumes = [ "${cfg.configPath}:/config" ];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
EMAIL = cfg.email;
URL = cfg.url;
VALIDATION = cfg.validation;
SUBDOMAINS = cfg.subdomains;
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
EMAIL = cfg.email;
URL = cfg.url;
VALIDATION = cfg.validation;
SUBDOMAINS = cfg.subdomains;
};
};
};

View File

@@ -1,6 +1,5 @@
{lib, ... }:
with lib;
{
{ lib, ... }:
with lib; {
options.nas-apps.swag = {
enable = mkEnableOption "swag docker service";
@@ -13,7 +12,7 @@ with lib;
type = types.int;
default = 80;
};
httpsPort = mkOption {
type = types.int;
default = 443;

View File

@@ -1,5 +1,4 @@
{ ... }:
{
{ ... }: {
imports = [
./samba
./apps/collabora
@@ -13,4 +12,4 @@
./apps/sonarr
./apps/swag
];
}
}

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.nas-samba;
let cfg = config.nas-samba;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
# make shares visible for Windows clients
@@ -24,7 +21,7 @@ in {
};
};
};
services.samba = {
enable = true;
securityType = "user";
@@ -42,26 +39,26 @@ in {
guest account = nobody
map to guest = bad user
'';
shares =
let
make = name: share: nameValuePair "${name}"
{
path = share.sharePath;
public = if share.enableTimeMachine then false else share.public;
private = if !share.public || share.enableTimeMachine then "yes" else "no";
browseable = if share.browseable then "yes" else "no";
writable = "yes";
"read only" = if share.readOnly then "yes" else "no";
"guest ok" = if share.guestOk then "yes" else "no";
"create mask" = share.createMask;
"directory mask" = share.directoryMask;
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no";
"vfs objects" = "catia fruit streams_xattr";
"fruit:time machine max size" = share.timeMachineMaxSize;
};
in
mapAttrs' make cfg.shares;
shares = let
make = name: share:
nameValuePair "${name}" {
path = share.sharePath;
public = if share.enableTimeMachine then false else share.public;
private =
if !share.public || share.enableTimeMachine then "yes" else "no";
browseable = if share.browseable then "yes" else "no";
writable = "yes";
"read only" = if share.readOnly then "yes" else "no";
"guest ok" = if share.guestOk then "yes" else "no";
"create mask" = share.createMask;
"directory mask" = share.directoryMask;
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
"fruit:time machine" =
if share.enableTimeMachine then "yes" else "no";
"vfs objects" = "catia fruit streams_xattr";
"fruit:time machine max size" = share.timeMachineMaxSize;
};
in mapAttrs' make cfg.shares;
};
};
}

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.nas-samba = {
enable = mkEnableOption "nas samba service";
autoStart = mkOption {
type = types.bool;
default = true;
@@ -22,48 +21,46 @@ with lib;
};
shares = mkOption {
type = types.attrsOf (types.submodule
{
options = {
public = mkOption {
type = types.bool;
default = false;
};
sharePath = mkOption {
type = types.str;
default = "";
};
readOnly = mkOption {
type = types.bool;
default = false;
};
browseable = mkOption {
type = types.bool;
default = true;
};
guestOk = mkOption {
type = types.bool;
default = true;
};
createMask = mkOption {
type = types.str;
default = "0644";
};
directoryMask = mkOption {
type = types.str;
default = "0755";
};
enableTimeMachine = mkOption {
type = types.bool;
default = false;
};
timeMachineMaxSize = mkOption {
type = types.str;
default = "0K";
};
type = types.attrsOf (types.submodule {
options = {
public = mkOption {
type = types.bool;
default = false;
};
}
);
sharePath = mkOption {
type = types.str;
default = "";
};
readOnly = mkOption {
type = types.bool;
default = false;
};
browseable = mkOption {
type = types.bool;
default = true;
};
guestOk = mkOption {
type = types.bool;
default = true;
};
createMask = mkOption {
type = types.str;
default = "0644";
};
directoryMask = mkOption {
type = types.str;
default = "0755";
};
enableTimeMachine = mkOption {
type = types.bool;
default = false;
};
timeMachineMaxSize = mkOption {
type = types.str;
default = "0K";
};
};
});
default = { };
};
};

View File

@@ -1,14 +1,13 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.share.hardware.amd;
let cfg = config.share.hardware.amd;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
boot.kernelParams = [ (if cfg.corectrl.enable then "amdgpu.ppfeaturemask=0xffffffff" else "") ];
boot.kernelParams = [
(if cfg.corectrl.enable then "amdgpu.ppfeaturemask=0xffffffff" else "")
];
# Configure programs
programs.corectrl.enable = cfg.corectrl.enable;
@@ -42,7 +41,7 @@ in {
return polkit.Result.YES;
}
});
'';
'';
};
};
}

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.share.hardware.amd = {
enable = mkEnableOption "amd hardware config";
corectrl.enable = mkOption {
type = types.bool;
default = false;

View File

@@ -1,7 +1 @@
{ ... }:
{
imports = [
./amd
./nvidia
];
}
{ ... }: { imports = [ ./amd ./nvidia ]; }

View File

@@ -1,5 +1,4 @@
{ pkgs, lib, LT, config, utils, inputs, ... }@args:
{
{ pkgs, lib, LT, config, utils, inputs, ... }@args: {
# Set up impernance configuration for things like bluetooth
# In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints.
@@ -11,10 +10,16 @@
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
"/etc/secureboot"
{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
];
files = [
{ file = "/etc/nix/id_rsa"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
{
directory = "/var/lib/colord";
user = "colord";
group = "colord";
mode = "u=rwx,g=rx,o=";
}
];
files = [{
file = "/etc/nix/id_rsa";
parentDirectory = { mode = "u=rwx,g=,o="; };
}];
};
}
}

View File

@@ -1,18 +1,18 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.share.hardware.nvidia;
let cfg = config.share.hardware.nvidia;
in {
imports = [
./options.nix
];
imports = [ ./options.nix ];
config = mkIf cfg.enable {
hardware = {
# Nvidia
nvidia = {
package = if cfg.enableBeta then config.boot.kernelPackages.nvidiaPackages.beta else config.boot.kernelPackages.nvidiaPackages.latest;
package = if cfg.enableBeta then
config.boot.kernelPackages.nvidiaPackages.beta
else
config.boot.kernelPackages.nvidiaPackages.latest;
# Modesetting is required.
modesetting.enable = true;
@@ -36,7 +36,7 @@ in {
# accessible via `nvidia-settings`.
nvidiaSettings = cfg.nvidiaSettings;
};
# Enable OpenGL
opengl = {
enable = true;
@@ -45,14 +45,12 @@ in {
};
};
# Services configs
services.xserver = {
# Load nvidia driver for Xorg and Wayland
videoDrivers = ["nvidia"];
videoDrivers = [ "nvidia" ];
};
# Virtualisation
virtualisation.docker.enableNvidia = cfg.enableNvidiaDocker;
};

View File

@@ -1,9 +1,8 @@
{ lib, ... }:
with lib;
{
with lib; {
options.share.hardware.nvidia = {
enable = mkEnableOption "nvidia hardware config";
enableOpen = mkOption {
type = types.bool;
default = false;