Modularizing the setup

This commit is contained in:
2025-08-20 10:08:10 -04:00
parent ecd8b1c9cf
commit a2ebeed8c6
9 changed files with 202 additions and 176 deletions

View File

@@ -8,177 +8,26 @@
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/shares.nix
./modules/sops.nix
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.supportedFilesystems = [ "vfat" "ext4" "cifs" ];
boot.kernelModules = [ "fuse" "coretemp" "cifs" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
systemd.tmpfiles.rules = [
"d /mnt/books 0755 root root -"
"d /mnt/books_extra 0755 root root -"
"d /mnt/music 0755 root root -"
"d /mnt/music_ext 0755 root root -"
"d /mnt/games 0755 root root -"
"d /mnt/games_ext 0755 root root -"
"d /mnt/roms_ext 0755 root root -"
"d /mnt/podcasts 0755 root root -"
"d /mnt/audiobooks 0755 root root -"
boot = {
kernelPackages = pkgs.linuxPackages_latest;
initrd.availableKernelModules = [
"xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"
];
fileSystems."/mnt/books" = {
device = "//10.0.0.76/Books";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/books_ext" = {
device = "//10.0.0.76/books_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/music" = {
device = "//10.0.0.76/music";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/music_ext" = {
device = "//10.0.0.76/music_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/games" = {
device = "//10.0.0.76/games";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/games_ext" = {
device = "//10.0.0.76/games_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/roms_ext" = {
device = "//10.0.0.76/roms_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/podcasts" = {
device = "//10.0.0.76/podcasts";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/audiobooks" = {
device = "//10.0.0.76/audiobooks";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
sops.secrets.smb = {
sopsFile = ./secrets/smb.creds;
format = "binary";
mode = "0400";
owner = "root";
group = "root";
};
networking.hostName = "xps13"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.wireless.backend = "iwd";
# networking.wireless.iwd.enable = true;
# networking.wireless.networks = {
# MyLocalTech = {
# pskRaw = "ac1030d721d26deb2c7db10073dfac73244e9621f4462e3e568017da03201e0e";
# };
# };
# networking.networkmanager.enable = true;
networking.wireless = {
enable = true;
userControlled.enable = true;
networks = {
MyLocalTech = {
pskRaw = "ac1030d721d26deb2c7db10073dfac73244e9621f4462e3e568017da03201e0e";
};
};
kernelModules = [ "fuse" "coretemp" "cifs" "kvm-intel" ];
initrd.kernelModules = [ "ath10k_pci" ];
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
supportedFilesystems = [ "vfat" "ext4" "cifs" ];
extraModulePackages = [ ];
extraModprobeConfig = ''
options ath10k_pcs irq_mode=1
options ath10k_core rawmode=1
'';
};
# Set your time zone.
time.timeZone = "America/New_York";
@@ -284,7 +133,6 @@
vim
curl
age
sops
];
# Some programs need SUID wrappers, can be configured further or are

View File

@@ -54,7 +54,7 @@
}
];
};
nixosConfigurations.xps13 = nixpkgs.lib.nixosSystem {
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit overlays; };
modules = [

View File

@@ -8,11 +8,6 @@
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/c888d639-8af5-44c9-8692-24756792a960";
@@ -63,6 +58,34 @@
libglvnd
];
};
systemd.services.wifi-powersave-off = {
description = "Disable WiFi Power Save";
wantedBy = [ "multi-user.target" ];
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig.Type = "oneshot";
script = ''
IF=$(${pkgs.iw}/bin/iw dev | ${pkgs.gawk}/bin/awk "/Interface/ {print \$2; exit}")
if [ -n "$IF" ]; then
${pkgs.iw}/bin/iw dev "$IF" set power_save off
fi
'';
};
networking.hostName = "xps13"; # Define your hostname.
# networking.networkmanager.enable = true;
networking.wireless = {
enable = true;
userControlled.enable = true;
networks = {
MyLocalTech = {
pskRaw = "ac1030d721d26deb2c7db10073dfac73244e9621f4462e3e568017da03201e0e";
};
};
extraConfig = ''
country=US
pmf=1
'';
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;

View File

@@ -41,7 +41,7 @@
* ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH8P/3yzsruekSaZ9b+yk429VTcfCtI1j8jnkNbPAgnr th3r00t@nixos
'';
imports = [
includes/hyprland.nix
modules/hyprland.nix
];
xdg.enable = true;
programs.nix-index.enable = true;

View File

@@ -41,7 +41,7 @@
* ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH8P/3yzsruekSaZ9b+yk429VTcfCtI1j8jnkNbPAgnr th3r00t@nixos
'';
imports = [
includes/hyprland.nix
modules/hyprland.nix
];
xdg.enable = true;
programs.nix-index.enable = true;

141
modules/shares.nix Normal file
View File

@@ -0,0 +1,141 @@
{ config, pkgs, ... }:
{
systemd.tmpfiles.rules = [
"d /mnt/books 0755 root root -"
"d /mnt/books_extra 0755 root root -"
"d /mnt/music 0755 root root -"
"d /mnt/music_ext 0755 root root -"
"d /mnt/games 0755 root root -"
"d /mnt/games_ext 0755 root root -"
"d /mnt/roms_ext 0755 root root -"
"d /mnt/podcasts 0755 root root -"
"d /mnt/audiobooks 0755 root root -"
];
fileSystems."/mnt/books" = {
device = "//10.0.0.76/Books";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/books_ext" = {
device = "//10.0.0.76/books_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/music" = {
device = "//10.0.0.76/music";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/music_ext" = {
device = "//10.0.0.76/music_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/games" = {
device = "//10.0.0.76/games";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/games_ext" = {
device = "//10.0.0.76/games_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/roms_ext" = {
device = "//10.0.0.76/roms_ext";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/podcasts" = {
device = "//10.0.0.76/podcasts";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/audiobooks" = {
device = "//10.0.0.76/audiobooks";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
}

14
modules/sops.nix Normal file
View File

@@ -0,0 +1,14 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
sops
];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.secrets.smb = {
sopsFile = ./secrets/smb.creds;
format = "binary";
mode = "0400";
owner = "root";
group = "root";
};
}