diff --git a/flake.nix b/flake.nix index 55eff64..44f0352 100644 --- a/flake.nix +++ b/flake.nix @@ -255,6 +255,37 @@ } ]; }; + + ymir = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + # Get the system config + ./hosts/ymir/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 + agenix.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/ymir/home.nix + ./modules/linux/home-manager + ./modules/cross-platform/home-manager + ]; + }; + } + ]; + }; }; devShells = { diff --git a/hosts/ymir/configuration.nix b/hosts/ymir/configuration.nix new file mode 100644 index 0000000..838a4a6 --- /dev/null +++ b/hosts/ymir/configuration.nix @@ -0,0 +1,128 @@ +{ + inputs, + pkgs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.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.linuxKernel.packages.linux_xanmod_latest; + + # 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; + }; + + # Enable networking + networking.networkmanager.enable = true; + networking.nameservers = ["192.168.0.10" "1.1.1.1"]; + services.resolved = { + enable = true; + fallbackDns = ["192.168.0.10" "1.1.1.1"]; + }; + + # 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 fstrim + services.fstrim.enable = true; + + # Enable seatd + services.seatd.enable = true; + + # Enable flatpak + services.flatpak.enable = true; + + # Enable ratbagd to customize mouse options + services.ratbagd.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; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.crony = { + isNormalUser = true; + description = "Crony"; + extraGroups = ["networkmanager" "wheel" "video" "input" "audio" "gamemode" "seat"]; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = 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/ymir/hardware-configuration.nix b/hosts/ymir/hardware-configuration.nix new file mode 100644 index 0000000..e0970af --- /dev/null +++ b/hosts/ymir/hardware-configuration.nix @@ -0,0 +1,43 @@ +# 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 = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/0fbf752d-9234-42bd-9e04-8246de85e8d6"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/3156-31B6"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; + + swapDevices = []; + + # 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/ymir/home.nix b/hosts/ymir/home.nix new file mode 100644 index 0000000..9cf0207 --- /dev/null +++ b/hosts/ymir/home.nix @@ -0,0 +1,39 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [ + inputs.nvf.homeManagerModules.default + inputs.nix-index-database.hmModules.nix-index + inputs.nix-flatpak.homeManagerModules.nix-flatpak + ]; + + # Some info + home.username = "crony"; + home.homeDirectory = "/home/crony"; + + # Enable syncthing + services.syncthing.enable = true; + + # Default environmental variables + home.sessionVariables = { + EDITOR = "nvim"; + WINEPREFIX = "$HOME/.local/share/wineprefix/default"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Disable emulators for now + crony.emulators.enable = false; + + # Disable restic for now + crony.restic.enable = false; + + # Fix gtkrc-2.0 collision + home.file."/home/crony/.gtkrc-2.0".force = true; + + # DO NOT CHANGE ALSO + home.stateVersion = "24.11"; # Please read the comment before changing. +}