NixOS on Steam Deck OLED

This commit is contained in:
Invariantspace 2024-03-02 15:10:23 -08:00
parent 0863fa0dfb
commit 4dedb233de
23 changed files with 375 additions and 108 deletions

View file

@ -2,7 +2,7 @@
{
imports = with inputs; [
disko.nixosModules.disko
disko.nixosModules.default
hardware.nixosModules.asus-zephyrus-ga402
] ++ [
./audio.nix

View file

@ -17,7 +17,7 @@ let usr = config.constants.userName; in {
lutris
nvtop-amd
picard
qbittorrent-qt5
qbittorrent
sweet-nova
tauon
telegram-desktop
@ -27,9 +27,9 @@ let usr = config.constants.userName; in {
winetricks
yorha-sound-theme
yuzu
] ++ (with libsForQt5; [
polonium
qt5.qtwebsockets
] ++ (with kdePackages; [
# polonium
qtwebsockets
]);
programs = {
firefox.enable = true;
@ -102,7 +102,6 @@ let usr = config.constants.userName; in {
xserver = {
enable = true;
displayManager = {
defaultSession = "plasmawayland";
autoLogin.user = usr;
sddm = {
enable = true;
@ -110,10 +109,7 @@ let usr = config.constants.userName; in {
wayland.enable = true;
};
};
desktopManager.plasma5 = {
enable = true;
useQtScaling = true;
};
desktopManager.plasma6.enable = true;
videoDrivers = [ "amdgpu" ];
};
};

View file

@ -11,6 +11,4 @@
nftables.enable = true;
wireless.iwd.enable = true;
};
services.resolved.enable = true;
}

View file

@ -1,27 +1,11 @@
{ config, ... }:
let hn = config.networking.hostName; in {
{
networking = {
domain = config.constants.domain;
firewall.trustedInterfaces = [ config.services.tailscale.interfaceName ];
hostId = "3ddd2ad2";
nftables.enable = true;
};
services = {
openssh = {
enable = true;
hostKeys = [{
comment = "host@${hn}";
path = "/etc/ssh/host";
rounds = 100;
type = "ed25519";
}];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
resolved.enable = true;
};
services.openssh.enable = true;
}

View file

@ -2,7 +2,7 @@
{
imports = with inputs; [
disko.nixosModules.disko
disko.nixosModules.default
hardware.nixosModules.common-cpu-amd
hardware.nixosModules.common-cpu-amd-pstate
] ++ [

View file

@ -1,6 +1,6 @@
{ config, ... }:
let hn = config.networking.hostName; in {
{
networking = {
domain = config.constants.domain;
firewall.trustedInterfaces = [ config.services.tailscale.interfaceName ];
@ -13,21 +13,5 @@ let hn = config.networking.hostName; in {
tempAddresses = "disabled";
wireless.iwd.enable = true;
};
services = {
openssh = {
enable = true;
hostKeys = [{
comment = "host@${hn}";
path = "/etc/ssh/host";
rounds = 100;
type = "ed25519";
}];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
resolved.enable = true;
};
services.openssh.enable = true;
}

View file

@ -0,0 +1,29 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`).
{ ... }:
{
# Configuration boot
boot.loader.grub.device = "nodev";
# Change secrets file
constants.sopsFile = ../../common/auths.yaml;
# Disable sudo password
security.sudo.wheelNeedsPassword = false;
# Set timezone automatically
services.automatic-timezoned.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

View file

@ -0,0 +1,17 @@
{ inputs, ... }:
{
imports = with inputs; [
disko.nixosModules.default
jovian.nixosModules.default
] ++ [
./configuration.nix
./disko.nix
./hardware-configuration.nix
./network.nix
# ./syncthing.nix
./tailscale.nix
./zfs.nix
../../common
];
}

73
linux/protostar/disko.nix Normal file
View file

@ -0,0 +1,73 @@
{ ... }:
{
disko.devices = {
# Partition the physical disk
disk.storage = {
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
esp = {
size = "1G";
type = "ef00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
# Construct the primary zfs pool for this system.
zpool.zroot = {
type = "zpool";
options = {
ashift = "12";
autotrim = "on";
listsnapshots = "on";
};
rootFsOptions = {
acltype = "posix";
atime = "off";
compression = "zstd";
dnodesize = "auto";
mountpoint = "none";
normalization = "formD";
xattr = "sa";
};
datasets = {
# Create dataset for home
home = {
type = "zfs_fs";
mountpoint = "/home";
};
# Create dataset for nix store
nix = {
type = "zfs_fs";
mountpoint = "/nix";
};
# Create dataset for root
root = {
type = "zfs_fs";
mountpoint = "/";
};
# Reserve space for performance
reservation = {
type = "zfs_fs";
options.refreservation = "128G";
};
};
};
};
}

18
linux/protostar/gui.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, ... }:
let usr = config.constants.userName; in {
jovian = {
decky-loader.enable = true;
steam = {
enable = true;
autoStart = true;
desktopSession = "plasma";
user = usr;
};
};
services.xserver = {
enable = true;
desktopManager.plasma6.enable = true;
};
}

View file

@ -0,0 +1,25 @@
# 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, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
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;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,17 @@
{ config, ... }:
let hn = config.networking.hostName; in {
networking = {
domain = config.constants.domain;
firewall.trustedInterfaces = [ config.services.tailscale.interfaceName ];
hostId = "e6449321";
networkmanager = {
enable = true;
wifi.backend = "iwd";
};
nftables.enable = true;
tempAddresses = "disabled";
wireless.iwd.enable = true;
};
services.openssh.enable = true;
}

View file

@ -0,0 +1,27 @@
{ config, ... }:
{
services.syncthing = let home = config.constants.homeDir; in {
enable = true;
configDir = "${home}/.config/syncthing";
dataDir = "${home}/.local/share/syncthing";
openDefaultPorts = true;
overrideDevices = true;
overrideFolders = true;
settings = let pc = "blitzar"; in {
devices.${pc} = {
name = pc;
id = "KGCBCIZ-GG6KMQ2-FLK5BWW-GLCEDML-5LCI24S-UKO5UWL-HWNCPYX-ZWWD5AQ";
};
folders.music = {
enable = true;
devices = [ pc ];
id = "Music";
label = "Music";
path = "~/Music";
type = "receiveonly";
};
};
user = config.constants.userName;
};
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
services.tailscale = {
enable = true;
port = 25172;
useRoutingFeatures = "client";
};
}

17
linux/protostar/zfs.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, ... }:
{
boot = {
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
loader.grub.zfsSupport = true;
zfs.enableUnstable = true;
};
services.zfs = {
autoScrub.enable = true;
trim.enable = true;
};
}

View file

@ -2,7 +2,7 @@
{
imports = [
inputs.mailserver.nixosModule
inputs.mailserver.nixosModules.default
./caddy.nix
./configuration.nix
./hardware-configuration.nix

View file

@ -16,20 +16,7 @@ let hn = config.networking.hostName; in {
apiTokenFile = config.sops.secrets."cloudflare/${hn}".path;
domains = builtins.attrNames config.services.caddy.virtualHosts;
};
openssh = {
enable = true;
settings = {
KbdInteractiveAuthentication = false;
PasswordAuthentication = false;
};
hostKeys = [{
comment = "host@${hn}";
path = "/etc/ssh/host";
rounds = 100;
type = "ed25519";
}];
};
resolved.enable = true;
openssh.enable = true;
};
sops.secrets."cloudflare/${hn}" = { };