From 395ec3d6e8c254b5a4a3b272a2f7e458c0bd37e8 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 12 Apr 2023 08:52:17 +0100 Subject: [PATCH] new system --- flake.nix | 3 +- system/configuration.nix | 47 ++++++++----------------------- system/hardware-configuration.nix | 30 ++++++++++++++------ 3 files changed, 35 insertions(+), 45 deletions(-) diff --git a/flake.nix b/flake.nix index 5b376f5..bb1d82a 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ in { nixosConfigurations = { - nixbookpro = lib.nixosSystem { + zenix = lib.nixosSystem { inherit system; modules = [ @@ -29,6 +29,7 @@ ./system/configuration.nix ]; }; + }; }; diff --git a/system/configuration.nix b/system/configuration.nix index 485a691..8774e33 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -2,16 +2,12 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ lib, config, pkgs, ... }: +{ config, pkgs, ... }: { imports = [ ./hardware-configuration.nix ]; - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "broadcom-sta" - ]; - nix.settings = { experimental-features = [ "nix-command" "flakes" ]; substituters = ["https://hyprland.cachix.org"]; @@ -22,23 +18,16 @@ # Use the systemd-boot EFI boot loader. boot.loader.grub.enable = true; + boot.loader.grub.version = 2; boot.loader.grub.devices = ["nodev"]; boot.loader.grub.useOSProber = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "nixbookpro"; # 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. + networking.hostName = "zenix"; + networking.networkmanager.enable = true; - # Set your time zone. time.timeZone = "Europe/London"; - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. i18n.defaultLocale = "en_GB.UTF-8"; console = { font = "Lat2-Terminus16"; @@ -73,14 +62,11 @@ qt5.platformTheme = "gtk2"; qt5.style = "gtk2"; - # Enable CUPS to print documents. services.printing.enable = true; - # enable flatpaks - services.flatpak.enable = true; + # services.flatpak.enable = true; xdg.portal.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.tristan = { isNormalUser = true; extraGroups = [ "wheel" "video" ]; @@ -88,29 +74,20 @@ shell = pkgs.zsh; }; - users.users.guest = { - isNormalUser = true; - extraGroups = [ ]; - initialPassword = "pass"; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget environment.systemPackages = with pkgs; [ - gnome.gnome-software - # discover tealdeer alsa-utils + neovim ]; services.dbus.enable = true; programs.light.enable = true; programs.zsh.enable = true; programs.dconf.enable = true; - # programs.hyprland = { - # enable = true; - # xwayland.enable = true; - # }; + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. @@ -128,7 +105,7 @@ services.tailscale.enable = true; # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 8080 8081 ]; + networking.firewall.allowedTCPPorts = [ ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; @@ -144,7 +121,7 @@ # 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.05"; # Did you read the comment? + system.stateVersion = "23.05"; # Did you read the comment? } diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix index 1458694..8f407a1 100644 --- a/system/hardware-configuration.nix +++ b/system/hardware-configuration.nix @@ -8,29 +8,41 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "ohci_pci" "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" "wl" ]; - boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; + { device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/cc0617df-8cbf-4618-abbc-df64c96de151"; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; }; fileSystems."/boot" = - { device = "/dev/disk/by-label/NIXBOOT"; + { device = "/dev/disk/by-uuid/FE7E-0DE3"; fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = + [ { device = "/dev/disk/by-uuid/da57b489-ab77-4830-b710-9f96cf43d053"; } + ]; # 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.enp5s0.useDHCP = lib.mkDefault true; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; }