Merge branch 'master' of git.bitlab21.com:sam/nixos

This commit is contained in:
Sam 2025-01-24 12:33:25 +00:00
commit 4b3aa6463e
5 changed files with 87 additions and 92 deletions

View File

@ -51,7 +51,7 @@ in {
../common/optional/fileserver/nfs-client/photos.nix
../common/optional/fileserver/nfs-client/personal.nix
../common/optional/printing.nix
# ../common/optional/printing.nix
../common/optional/backlight.nix
../common/optional/xmodmap-arrow-remaps.nix
../common/optional/nix-ld.nix

View File

@ -21,7 +21,6 @@ in {
extraGroups = [
"scanner"
"lp"
"wheel"
];
packages = with pkgs; [
@ -31,22 +30,9 @@ in {
};
environment.persistence."/persist" = {
hideMounts = true;
users.${username} = {
directories = [
"Sync"
"Keep"
".ssh"
".config"
".mozilla"
".local"
".zotero"
".var"
".steam"
];
files = [
];
};
directories = [
"/home/${username}"
];
};
sops.secrets = {

View File

@ -55,6 +55,10 @@ in {
../common/optional/gaming.nix
../common/optional/restic-backup.nix
../common/optional/fileserver/nfs-client/media.nix
../common/optional/fileserver/nfs-client/photos.nix
../common/optional/fileserver/nfs-client/personal.nix
../common/optional/distributed-builds/local-machine.nix
outputs.nixosModules.nixosAutoUpgrade

View File

@ -1,35 +1,19 @@
{
inputs,
config,
lib,
configVars,
outputs,
pkgs,
...
}: let
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
dev = "/dev/sda"; # depends on target hardware
encrypted = false; # currrently only applies to btrfs
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
impermanence = true;
btrfsMountDevice = "/dev/root_vg/root";
merlinIp = configVars.networking.addresses.merlin.ip;
piholeIp = configVars.networking.addresses.pihole.ip;
gatewayIp = configVars.networking.addresses.gateway.ip;
in {
imports = [
# Create users for this host
../common/users/media
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
./hardware-configuration.nix
# Impermanence
(import ../common/disks/btrfs/impermanence.nix {
@ -44,21 +28,12 @@ in {
# Import optional options
../common/optional/openssh.nix
../common/optional/persistence.nix
# ../common/optional/fileserver/media.nix
../common/optional/gaming.nix
../common/optional/printing.nix
../common/optional/fileserver/nfs-client/media.nix
# ../common/optional/printing.nix
../common/optional/distributed-builds/local-machine.nix
outputs.nixosModules.nixosAutoUpgrade
];
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
boot.kernelParams = ["i915.enable_psr=0"];
networking = {
hostName = "sparky";
networkmanager.enable = true;
@ -66,30 +41,23 @@ in {
nameservers = ["${piholeIp}" "${gatewayIp}" "8.8.8.8"];
};
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
# Add additional package names here
"nvidia-x11"
"nvidia-settings"
"nvidia-persistenced"
];
services.displayManager.defaultSession = "cinnamon";
services.libinput.enable = true;
system.services.nixosAutoUpgrade = {
enable = true;
persistent = true;
remote = "remotebuild@${merlinIp}";
reboot = false;
pushUpdates = false;
configDir = "/etc/nixos";
onCalendar = "*-*-* 07:00:00";
user = "media";
onCalendar = "*-*-* 06:00:00";
user = "root";
};
services.xserver = {
enable = true;
videoDrivers = ["nvidia"];
videoDrivers = ["modesetting"];
displayManager.lightdm.enable = true;
exportConfiguration = true;
deviceSection = ''
@ -99,19 +67,4 @@ in {
};
};
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport32Bit = true;
};
# Load nvidia driver
hardware.nvidia = {
# https://nixos.wiki/wiki/Nvidia
modesetting.enable = true;
powerManagement.enable = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
}

View File

@ -1,24 +1,76 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ config, lib, pkgs, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
# 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
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/.swapvol" =
{ device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/3DC4-7CCE";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [
{
device = "/.swapvol/swapfile";
size = 2 * 1024;
}
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# Add hardware support for intel gpus as specified here: https://nixos.wiki/wiki/Jellyfin
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;};
};
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
intel-vaapi-driver
vaapiVdpau
libvdpau-va-gl
intel-compute-runtime
# only available on unstable
unstable.vpl-gpu-rt
intel-media-sdk
];
};
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
boot.kernelParams = ["i915.enable_psr=0"];
}