From 653ca585ee8eb02dca7e2f657a936a4384bd964a Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Tue, 30 Sep 2025 04:34:28 +0200 Subject: [PATCH] feat: add new hosts, skadi. --- flake.nix | 38 +++++ hosts/skadi/configuration.nix | 206 +++++++++++++++++++++++++ hosts/skadi/disk-config.nix | 60 +++++++ hosts/skadi/hardware-configuration.nix | 30 ++++ hosts/skadi/home.nix | 49 ++++++ 5 files changed, 383 insertions(+) create mode 100644 hosts/skadi/configuration.nix create mode 100644 hosts/skadi/disk-config.nix create mode 100644 hosts/skadi/hardware-configuration.nix create mode 100644 hosts/skadi/home.nix diff --git a/flake.nix b/flake.nix index 653caa1..ee01a86 100644 --- a/flake.nix +++ b/flake.nix @@ -358,6 +358,44 @@ } ]; }; + + skadi = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + # Get the system config + ./hosts/skadi/configuration.nix + # Enable stylix + inputs.stylix.nixosModules.stylix + # Load updated auto-cpufreq + auto-cpufreq.nixosModules.default + # Load my modules + ./modules/linux/nixos + # Still no specific modules here + # ./modules/cross-platform/nixos + # Use agenix for secrets + agenix.nixosModules.default + # Use disko for creating filesystem + disko.nixosModules.disko + # Use flatpak for one package globally + nix-flatpak.nixosModules.nix-flatpak + # Use chaotic for some packages + chaotic.nixosModules.default + # Setup home manager for my user + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.extraSpecialArgs = {inherit inputs;}; + home-manager.backupFileExtension = "backup"; + home-manager.users.crony = { + imports = [ + ./hosts/skadi/home.nix + ./modules/linux/home-manager + ./modules/cross-platform/home-manager + ]; + }; + } + ]; + }; }; devShells = { diff --git a/hosts/skadi/configuration.nix b/hosts/skadi/configuration.nix new file mode 100644 index 0000000..8c2147a --- /dev/null +++ b/hosts/skadi/configuration.nix @@ -0,0 +1,206 @@ +{ + inputs, + config, + pkgs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ./disk-config.nix + inputs.home-manager.nixosModules.home-manager + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable aarch64 emulation + boot.binfmt.emulatedSystems = ["aarch64-linux"]; + + # Use the xanmod kernel + boot.kernelPackages = pkgs.linuxPackages_cachyos-lto; + services.scx = { + enable = true; + package = pkgs.scx_git.full; + scheduler = "scx_lavd"; + extraArgs = ["--autopower"]; + }; + + # Get nicer hostname + networking.hostName = "ymir"; # Define your hostname. + + # Enable flakes + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Enable trusted users + nix.settings.trusted-users = ["root" "@wheel"]; + + # Setup gpu + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + modesetting.enable = true; + open = true; + nvidiaSettings = true; + }; + + # Enable networking + networking.networkmanager.enable = true; + networking.nameservers = ["192.168.0.5"]; + services.resolved = { + enable = true; + fallbackDns = ["192.168.0.5"]; + }; + + # Set your time zone. + time.timeZone = "Europe/Zagreb"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "hr_HR.UTF-8"; + LC_IDENTIFICATION = "hr_HR.UTF-8"; + LC_MEASUREMENT = "hr_HR.UTF-8"; + LC_MONETARY = "hr_HR.UTF-8"; + LC_NAME = "hr_HR.UTF-8"; + LC_NUMERIC = "hr_HR.UTF-8"; + LC_PAPER = "hr_HR.UTF-8"; + LC_TELEPHONE = "hr_HR.UTF-8"; + LC_TIME = "hr_HR.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + options = "caps:escape"; + }; + + # Enable seatd + services.seatd.enable = true; + + # Enable flatpak + services.flatpak = { + enable = true; + packages = [ + ]; + }; + + # Enable ratbagd to customize mouse options + services.ratbagd.enable = true; + + # Enable noisetorch + programs.noisetorch.enable = true; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + }; + # Fix not saving my state + hardware.alsa.enablePersistence = true; + + # Enable appimages + programs.appimage = { + enable = true; + binfmt = true; + }; + + # Enable light for image control + programs.light.enable = true; + + # Enable polkit + security.polkit.enable = true; + + # programs.river = { + # enable = true; + # extraPackages = []; + # }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.crony = { + isNormalUser = true; + description = "Crony"; + # hashedPasswordFile = "${config.age.secrets.crony-passwd.path}"; + extraGroups = ["networkmanager" "wheel" "video" "input" "audio" "gamemode" "seat" "realtime"]; + }; + + # users.users.root.hashedPasswordFile = "${config.age.secrets.root-passwd.path}"; + + # users.mutableUsers = false; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Setup community cache + + nix.settings = { + substituters = [ + "https://nix-community.cachix.org" + "https://hyprland.cachix.org" + ]; + trusted-substituters = [ + "https://hyprland.cachix.org" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; + }; + + nixpkgs.config.permittedInsecurePackages = [ + "qtwebengine-5.15.19" + "ventoy-1.1.07" + ]; + + # Optimise storage + nix.optimise = { + automatic = true; + dates = ["weekly"]; + }; + + # Enable my flake specific settings + # crony.nvidia.enable = true; + crony.gaming.enable = true; + crony.nbfc.enable = true; + crony.wireguard.enable = true; + crony.additional-hardware.enable = true; + crony.secrets.enable = true; + crony.ryzenadj.enable = false; + crony.auto-cpufreq.enable = true; + crony.hyprland-nixos.enable = true; + crony.ollama.enable = false; + crony.sunshine.enable = true; + crony.nfs-share.enable = true; + crony.sddm.enable = true; + + # List packages installed in system profile + environment.systemPackages = with pkgs; [ + neovim + lm_sensors + libva-utils + alsa-utils + ]; + + # Enable nixd to see nixpkgs path + nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"]; + + # DO NOT CHANGE + system.stateVersion = "24.11"; +} diff --git a/hosts/skadi/disk-config.nix b/hosts/skadi/disk-config.nix new file mode 100644 index 0000000..a496f62 --- /dev/null +++ b/hosts/skadi/disk-config.nix @@ -0,0 +1,60 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypt"; + settings.allowDiscards = true; + content = { + type = "btrfs"; + extraArgs = ["-f"]; + subvolumes = { + "@" = { + mountpoint = "/"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "@home" = { + mountpoint = "/home"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "@nix" = { + mountpoint = "/nix"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/skadi/hardware-configuration.nix b/hosts/skadi/hardware-configuration.nix new file mode 100644 index 0000000..d45cece --- /dev/null +++ b/hosts/skadi/hardware-configuration.nix @@ -0,0 +1,30 @@ +# 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" "ahci" "usbhid" "usb_storage" "sd_mod"]; + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/skadi/home.nix b/hosts/skadi/home.nix new file mode 100644 index 0000000..f4aad8e --- /dev/null +++ b/hosts/skadi/home.nix @@ -0,0 +1,49 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [ + inputs.nvf.homeManagerModules.default + inputs.nix-index-database.homeModules.nix-index + inputs.nix-flatpak.homeManagerModules.nix-flatpak + inputs.agenix.homeManagerModules.default + ]; + + # Some info + home.username = "crony"; + home.homeDirectory = "/home/crony"; + + # Enable syncthing + services.syncthing.enable = true; + + # Default environmental variables + home.sessionVariables = { + EDITOR = "nvim"; + TERMINAL = "foot"; + WINEPREFIX = "$HOME/.local/share/wineprefix/default"; + SECOND_BRAIN = "$HOME/docs/sb"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Enable crony flake specific settings + crony.mangohud.enable = true; + crony.gaming.enable = true; + crony.flatpak.enable = true; + crony.wayland.enable = true; + crony.river.enable = false; + crony.hyprland.enable = true; + crony.home-secrets.enable = true; + crony.restic.enable = true; + crony.neovim.enable = true; + crony.qutebrowser.enable = true; + crony.mpv.enable = true; + crony.browsers.enable = true; + crony.desktop.enable = true; + crony.shell-additions.enable = true; + + # DO NOT CHANGE ALSO + home.stateVersion = "24.11"; # Please read the comment before changing. +}