From feefcfc89b00d4955dbb3314c20be035f3db206f Mon Sep 17 00:00:00 2001 From: tzlil Date: Sat, 29 Jul 2023 20:53:14 +0300 Subject: disko for laptop, wip rewrite --- hosts/navi/default.nix | 163 ++++++++++++++++++++++++++++++++++ hosts/navi/hardware-configuration.nix | 71 +++++++++++++++ 2 files changed, 234 insertions(+) create mode 100644 hosts/navi/default.nix create mode 100644 hosts/navi/hardware-configuration.nix (limited to 'hosts/navi') diff --git a/hosts/navi/default.nix b/hosts/navi/default.nix new file mode 100644 index 0000000..a8702a8 --- /dev/null +++ b/hosts/navi/default.nix @@ -0,0 +1,163 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: { + imports = [ + ./hardware-configuration.nix + # ../../profiles/core.nix + ../../profiles/graphical.nix + ../../mixins/tailscale.nix + ../../mixins/cli.nix + ../../mixins/greet.nix + # ../../mixins/hyprland.nix + ../../mixins/sway.nix + ../../mixins/pipewire.nix + ../../mixins/multimedia.nix + # ../../mixins/emacs + ../../mixins/syncthing.nix + ]; + + config = { + system.stateVersion = "23.11"; + boot = { + tmp.cleanOnBoot = true; + initrd = { + supportedFilesystems = ["btrfs"]; + availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "usbhid" "snd_usb_audio"]; + }; + supportedFilesystems = ["ntfs"]; + kernelModules = ["kvm-intel" "snd-seq" "snd-rawmidi" "bridge"]; + kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + # extraModulePackages = [ config.boot.kernelPackages.rtl8821ce ]; + loader = { + systemd-boot = { + enable = true; + }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + }; + }; + + time.timeZone = lib.mkDefault "Israel"; + + # fileSystems."/" = { + # device = "none"; + # fsType = "tmpfs"; + # # hyprland doesnt compile with noexec root + # options = ["defaults" "size=8G" "mode=755"]; + # }; + + # fileSystems."/boot" = { + # device = "/dev/disk/by-uuid/34CB-F158"; + # fsType = "vfat"; + # }; + + # fileSystems."/nix" = { + # device = "/dev/disk/by-uuid/8a8cc550-034e-4545-a958-564779f51061"; + # fsType = "btrfs"; + # }; + + zramSwap = { + enable = true; + algorithm = "zstd"; + }; + + networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + # # iwd networking stuffs + # networking.networkmanager.enable = lib.mkForce false; + # networking.wireless.iwd.enable = true; + # services.connman = { + # enable = true; + # wifi.backend = "iwd"; + # }; + # networking.wireless.dbusControlled = true; + # home-manager.users.tzlil.home.packages = [pkgs.cmst]; + # networking.wireless.userControlled.enable = true; + # networking.wireless.enable = true; + # services.connman.enable = true; + + # services.tor = { + # enable = true; + # openFirewall = true; + # client.enable = true; + # torsocks.enable = true; + # }; + environment.persistence."/nix/persist".directories = [ + "/etc/NetworkManager/system-connections" + { + directory = "/home/tzlil/.config/SchildiChat"; + user = "tzlil"; + group = "users"; + } + { + directory = "/home/tzlil/.local/share/Terraria"; + user = "tzlil"; + group = "users"; + } + + { + directory = "/home/tzlil/.local/share/Steam"; + user = "tzlil"; + group = "users"; + } + "/var/lib/docker" + ]; + + home-manager.users.tzlil = { + home.packages = [pkgs.schildichat-desktop-wayland pkgs.keepassxc]; + programs.qutebrowser = { + enable = true; + settings.colors.webpage.darkmode.enabled = true; + }; + }; + + programs.steam.enable = true; + + # programs.firejail.wrappedBinaries = { + # mullvad-browser = { + # executable = lib.getExe pkgs.mullvad-browser; + # extraArgs = [ + # "--env=MOZ_ENABLE_WAYLAND=1" + # "--env=GTK_THEME=Adwaita:dark" + # ]; + # # profile = "${pkgs.firejail}/etc/firejail/firefox.profile"; + # }; + # }; + + # greeter.initialSession = "${pkgs.fish}/bin/fish"; + + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [rocm-opencl-icd rocm-opencl-runtime]; + driSupport = true; + driSupport32Bit = true; + }; + + networking.firewall.allowedTCPPorts = [25565]; + + services = { + power-profiles-daemon.enable = true; + thermald.enable = true; + tlp = { + settings = { + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + }; + }; + acpid.enable = true; + }; + + services.blueman.enable = true; + + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; + }; +} diff --git a/hosts/navi/hardware-configuration.nix b/hosts/navi/hardware-configuration.nix new file mode 100644 index 0000000..7b24c68 --- /dev/null +++ b/hosts/navi/hardware-configuration.nix @@ -0,0 +1,71 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: let + device = "/dev/nvme0n1"; +in { + imports = [ + inputs.disko.nixosModules.disko + inputs.hardware.nixosModules.common-cpu-intel + inputs.hardware.nixosModules.common-gpu-intel + ]; + + hardware.firmware = [pkgs.rtw88-firmware]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + hardware.enableAllFirmware = true; + + hardware.bluetooth.enable = true; + + disko.devices = { + disk.${baseNameOf device} = { + inherit device; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + type = "EF00"; + size = "512M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "luks"; + name = "cryptroot"; + content = { + type = "btrfs"; + extraArgs = ["-f"]; + subvolumes = { + "/nix" = { + mountOptions = ["compress=zstd" "noatime"]; + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + }; + }; + nodev."/" = { + fsType = "tmpfs"; + mountOptions = [ + "size=8G" + "defaults" + "mode=755" + ]; + }; + }; +} -- cgit 1.4.1