diff --git a/nix-conf/system/configuration.nix b/nix-conf/system/configuration.nix index bb35932..fa613d0 100755 --- a/nix-conf/system/configuration.nix +++ b/nix-conf/system/configuration.nix @@ -17,13 +17,9 @@ with lib; ]; boot = _boot; -# prune old builds + # prune old builds nix.settings.auto-optimise-store = true; - system.stateVersion = "22.05"; - # users.users..uid = 1000; - # networking.hostName = "nixos"; - # Enable nix flakes nix.package = pkgs.nixFlakes; nix.extraOptions = '' @@ -117,5 +113,7 @@ with lib; } else { enable = false; }; }; + environment.noXlibs = lib.mkForce false; + } diff --git a/nix-conf/system/flake.lock b/nix-conf/system/flake.lock index fa1fc2e..79b4fba 100644 --- a/nix-conf/system/flake.lock +++ b/nix-conf/system/flake.lock @@ -1,26 +1,5 @@ { "nodes": { - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "utils": "utils" - }, - "locked": { - "lastModified": 1669071065, - "narHash": "sha256-KBpgj3JkvlPsJ3duOZqFJe6tgr+wc75t8sFmgRbBSbw=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "f7641a3ff398ccce952e19a199d775934e518c1d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1669140675, @@ -38,24 +17,8 @@ }, "root": { "inputs": { - "home-manager": "home-manager", "nixpkgs": "nixpkgs" } - }, - "utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/nix-conf/system/flake.nix b/nix-conf/system/flake.nix index 32d0125..d3a4dc9 100644 --- a/nix-conf/system/flake.nix +++ b/nix-conf/system/flake.nix @@ -11,6 +11,9 @@ system = "x86_64-linux"; modules = [ ./wsl-configuration.nix + { + system.stateVersion = "22.05"; + } ]; specialArgs = { # includeHardware = false; @@ -25,6 +28,9 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + { + system.stateVersion = "22.05"; + } ]; specialArgs = { hostname = "lizzi"; @@ -81,6 +87,9 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + { + system.stateVersion = "22.05"; + } ]; specialArgs = { hostname = "pixi"; @@ -134,6 +143,9 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + { + system.stateVersion = "22.05"; + } ]; specialArgs = { hostname = "nyx"; @@ -159,10 +171,148 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + { + system.stateVersion = "22.05"; + } ]; specialArgs = { hostname = "nixos"; }; }; + nixosConfigurations.bao = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs.hostname = "bao"; + modules = [ + ./configuration.nix + + ({ config, pkgs, lib, ... }: + let + gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils ]; + gpu_conf = { + # openCL + hardware.opengl = { + enable = true; + extraPackages = let + inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; + in + [rocm-opencl-icd rocm-opencl-runtime]; + # Vulkan + driSupport = true; + driSupport32Bit = true; + package = pkgs.mesa.drivers; + package32 = pkgs.pkgsi686Linux.mesa.drivers; + }; + }; + amd_rx470 = { + # early amd gpu usage + # boot.initrd.kernelModules = ["amdgpu"]; + services.xserver.enable = true; + services.xserver.videoDrivers = ["amdgpu"]; + }; + nv_rtx3060 = { + nixpkgs.config.allowUnfree = true; + services.xserver.enable = true; + services.xserver.videoDrivers = ["nvidia"]; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + systemPackages = [] ++ gpu_pkgs; + in + lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 + { + imports = + [ # Include the results of the hardware scan. + ./profiles/bao/hardware-configuration.nix + ]; + + # Use UEFI + boot.loader.systemd-boot.enable = true; + + networking.hostName = "bao"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + + + # Configure keymap in X11 + services.xserver.layout = "us"; + # services.xserver.xkbOptions = { + # "eurosign:e"; + # "caps:escape" # map caps to escape. + # }; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.alice = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # firefox + # thunderbird + # ]; + # }; + # Just an initial user to get this started lol + users.users.user = { + initialPassword = "pw123"; + extraGroups = [ "wheel" "networkmanager" ]; + isNormalUser = true; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + wget + ] ++ systemPackages; + + # 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; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = 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 = "22.11"; # Did you read the comment? + + })) + ]; + }; }; } diff --git a/nix-conf/system/profiles/bao/hardware-configuration.nix b/nix-conf/system/profiles/bao/hardware-configuration.nix new file mode 100644 index 0000000..56e94aa --- /dev/null +++ b/nix-conf/system/profiles/bao/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + # boot.initrd.kernelModules = [ "amdgpu" ]; + boot.initrd.kernelModules = []; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + # Might be wise to use /dev/nvme0p1 instead + { device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + # Might be wise to use /dev/nvme0p2 instead + { device = "/dev/disk/by-uuid/EBA6-394D"; + fsType = "vfat"; + }; + + 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.enp5s0.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; +}