From 6cfc2b32a701a363e2fb6fce1f534116305d389a Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Wed, 16 Jul 2025 14:50:44 +0200 Subject: [PATCH] Rei III --- flake.lock | 12 +- flake.nix | 22 +- home/machines/ayanami.nix | 31 +++ hosts/ayanami-new/configuration.nix | 222 ++++++++++++++++++ hosts/ayanami-new/hardware-configuration.nix | 57 +++++ .../configuration.nix | 0 .../hardware-configuration.nix | 0 7 files changed, 336 insertions(+), 8 deletions(-) create mode 100644 home/machines/ayanami.nix create mode 100644 hosts/ayanami-new/configuration.nix create mode 100644 hosts/ayanami-new/hardware-configuration.nix rename hosts/{ayanami => ayanami-old}/configuration.nix (100%) rename hosts/{ayanami => ayanami-old}/hardware-configuration.nix (100%) diff --git a/flake.lock b/flake.lock index fdae0f4..da3d93e 100644 --- a/flake.lock +++ b/flake.lock @@ -453,11 +453,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1751211869, - "narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=", + "lastModified": 1752436162, + "narHash": "sha256-Kt1UIPi7kZqkSc5HVj6UY5YLHHEzPBkgpNUByuyxtlw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b43c397f6c213918d6cfe6e3550abfe79b5d1c51", + "rev": "dfcd5b901dbab46c9c6e80b265648481aafb01f8", "type": "github" }, "original": { @@ -693,11 +693,11 @@ }, "unstable": { "locked": { - "lastModified": 1751180975, - "narHash": "sha256-BKk4yDiXr4LdF80OTVqYJ53Q74rOcA/82EClXug8xsY=", + "lastModified": 1752596105, + "narHash": "sha256-lFNVsu/mHLq3q11MuGkMhUUoSXEdQjCHvpReaGP1S2k=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a48741b083d4f36dd79abd9f760c84da6b4dc0e5", + "rev": "dab3a6e781554f965bde3def0aa2fda4eb8f1708", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1a145fa..b8e2cd9 100644 --- a/flake.nix +++ b/flake.nix @@ -75,11 +75,11 @@ mkHomes = machines: extraArgs: nixlib.genAttrs machines (machine: mkHome ({inherit machine; } // extraArgs)); - allMachines = [ "laptop" "desktop" "headless" "pvv-terminal" "ikari" ]; + allMachines = [ "ayanami" "desktop" "headless" "pvv-terminal" "ikari" ]; in { - homeConfigurations = mkHomes [ "laptop" "headless" "ikari" ] { } + homeConfigurations = mkHomes [ "ayanami" "headless" "ikari" ] { } // mkHomes [ "desktop" ] { username = "dan"; } // mkHomes [ "pvv-terminal" ] { username = "danio"; homeDirectory = "/home/pvv/d/danio"; }; @@ -94,7 +94,25 @@ nixos-hardware.nixosModules.lenovo-thinkpad-l480 ]; }; + ayanami-new = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = false; + home-manager.useUserPackages = true; + home-manager.users.daniel = import ./home/machines/ayanami.nix; + home-manager.extraSpecialArgs = { + overlays = defaultOverlays; + }; + } + ./hosts/ayanami-new/configuration.nix + ]; + }; soryu-old = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { diff --git a/home/machines/ayanami.nix b/home/machines/ayanami.nix new file mode 100644 index 0000000..7bbfb29 --- /dev/null +++ b/home/machines/ayanami.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, overlays, ... }: +{ + nixpkgs.overlays = overlays; + nixpkgs.config.allowUnfreePredicate = (pkg: true); + nixpkgs.config.allowUnfree = true; + + imports = [ ../profiles ]; + + machine = { + name = "Ayanami"; + eth = "enp5s0"; + wlan = "wlp3s0"; + secondary-fs = null; + }; + + profiles.base.enable = true; + profiles.base.plus = true; + profiles.xsession.enable = true; + profiles.audio.fancy = true; + profiles.zsh.enable = true; + + profiles.games.enable = true; + + profiles.timetracking.enable = true; + + home.packages = [ + pkgs.unstable.osu-lazer-bin + ]; + + home.stateVersion = "24.11"; +} diff --git a/hosts/ayanami-new/configuration.nix b/hosts/ayanami-new/configuration.nix new file mode 100644 index 0000000..dec4a17 --- /dev/null +++ b/hosts/ayanami-new/configuration.nix @@ -0,0 +1,222 @@ +# 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’). + +{ config, lib, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../common/builder.nix + ]; + + + services.restic.backups."main" = { + repositoryFile = "/root/restic-main-repo"; + passwordFile = "/root/restic-main-password"; + pruneOpts = [ + "--keep-last 2" + "--keep-within 3d" + "--keep-daily 7" + "--keep-weekly 5" + "--keep-monthly 12" + "--keep-yearly 5" + ]; + paths = [ + "/home/daniel" + "/var/lib" + ]; + exclude = [ + "/home/*/.cache" + + "/home/*/.local/share/Trash" + + "/home/*/.cargo" + + "/home/*/.local/share/Steam/*" + "!/home/*/.local/share/Steam/compatdata" + + "/home/*/mnt" + ]; + extraBackupArgs = [ + "--one-file-system" + ]; + }; + + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + nixpkgs.config = { + allowUnfree = true; + rocmSupport = true; + }; + + # Use the systemd-boot EFI boot loader. + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.systemd-boot = { + enable = true; + netbootxyz = { enable = true; sortKey = "y_netbootxyz"; }; + edk2-uefi-shell = { enable = true; sortKey = "z_edk2-uefi-shell"; }; + }; + + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + boot.kernelPackages = pkgs.linuxPackages_latest; + + # programs.adb.enable = true; + + systemd.enableEmergencyMode = false; + + networking.hostName = "ayanami"; + networking.networkmanager.enable = true; + networking.useDHCP = false; + + hardware.bluetooth.enable = true; + + zramSwap = { + enable = true; + memoryMax = 24 * 1024 * 1024 * 1024; # 24 GB ZRAM + }; + + services.resolved.enable = true; + services.resolved.dnssec = "false"; + + services.gnome.gnome-keyring.enable = true; + + programs.steam = { + enable = true; + remotePlay.openFirewall = false; + dedicatedServer.openFirewall = false; + }; + + services.tailscale.enable = true; + + networking.firewall.interfaces."tailscale0" = let + all = { from = 0; to = 65535; }; + in { + allowedUDPPortRanges = [ all ]; + allowedTCPPortRanges = [ all ]; + }; + + # Select internationalisation properties. + console.keyMap = "no-latin1"; + + time.timeZone = "Europe/Oslo"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + wget vim git + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.openssh.openFirewall = false; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = true; + networking.firewall.allowedTCPPorts = [ ]; + networking.firewall.allowedUDPPorts = [ ]; + + + security.rtkit.enable = false; # Enable again when mumble is fixed + services.pipewire = { + enable = true; + extraLv2Packages = [ pkgs.rnnoise-plugin.lv2 ]; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + hardware.graphics.enable = true; + hardware.graphics.enable32Bit = true; + hardware.graphics.extraPackages = with pkgs; [ + libva rocmPackages.clr.icd + ]; + hardware.amdgpu.opencl.enable = true; + + systemd.tmpfiles.rules = + let + rocmEnv = pkgs.symlinkJoin { + name = "rocm-combined"; + paths = with pkgs.rocmPackages; [ + rocblas + hipblas + clr + ]; + }; + in [ + "L+ /opt/rocm - - - - ${rocmEnv}" + ]; + + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.displayManager = { + defaultSession = "xsession"; + session = [ + { manage = "desktop"; + name = "xsession"; + start = "exec $HOME/.xsession"; + } + ]; + }; + services.xserver.xkb.layout = "no"; + # services.xserver.xkbOptions = "eurosign:e"; + + i18n = { + defaultLocale = "nb_NO.UTF-8"; + extraLocales = [ "en_US.UTF-8/UTF-8" "nn_NO.UTF-8/UTF-8" ]; + extraLocaleSettings = { + LC_COLLATE = "nb_NO.UTF-8"; + LC_MESSAGES = "en_US.UTF-8"; + }; + }; + + services.xserver.displayManager.lightdm.enable = true; + services.xserver.videoDrivers = ["amdgpu"]; + + programs.zsh.enable = true; + + virtualisation.docker.enable = true; + virtualisation.libvirtd.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + + +# networking.nameservers = lib.mkForce [ "192.168.0.25" ]; + +# services.ipfs.enable = true; +# services.ipfs.gatewayAddress = "/ip4/127.0.0.1/tcp/5002"; + + nix.trustedUsers = [ "daniel" ]; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + users.users.daniel = { + isNormalUser = true; + uid = 1000; + shell = pkgs.zsh; + extraGroups = [ "wheel" "networkmanager" "docker" "video" "libvirtd" ]; + initialPassword = "Abc123"; + }; + + programs.dconf.enable = true; + services.dbus.packages = with pkgs; [ dconf ]; + + # This value determines the NixOS release with which your system is to be + # compatible, in order to avoid breaking some software such as database + # servers. You should change this only after NixOS release notes say you + # should. + system.stateVersion = "24.11"; # Did you read the comment? +} diff --git a/hosts/ayanami-new/hardware-configuration.nix b/hosts/ayanami-new/hardware-configuration.nix new file mode 100644 index 0000000..2a813d1 --- /dev/null +++ b/hosts/ayanami-new/hardware-configuration.nix @@ -0,0 +1,57 @@ +# 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_renesas" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/65fda346-b80f-410d-9577-891cdbf3e4b2"; + fsType = "btrfs"; + options = [ "subvol=root" "compress=zstd" ]; + }; + + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/5ec9c954-9862-4d1d-bd61-bda34caf504b"; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/65fda346-b80f-410d-9577-891cdbf3e4b2"; + fsType = "btrfs"; + options = [ "subvol=home" "compress=zstd" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/65fda346-b80f-410d-9577-891cdbf3e4b2"; + fsType = "btrfs"; + options = [ "subvol=nix" "noatime" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/ED9D-8221"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/6f23c4a2-2936-4d44-b5c0-03132b720742"; } + ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/ayanami/configuration.nix b/hosts/ayanami-old/configuration.nix similarity index 100% rename from hosts/ayanami/configuration.nix rename to hosts/ayanami-old/configuration.nix diff --git a/hosts/ayanami/hardware-configuration.nix b/hosts/ayanami-old/hardware-configuration.nix similarity index 100% rename from hosts/ayanami/hardware-configuration.nix rename to hosts/ayanami-old/hardware-configuration.nix