From c5ee0ba144c8442c03a2e0df5d2799fb97f71173 Mon Sep 17 00:00:00 2001 From: Thilo Billerbeck Date: Mon, 6 Nov 2023 23:43:36 +0100 Subject: [PATCH] added laptop config --- .gitignore | 2 +- .../thilo-laptop/hardware-configuration.nix | 37 ++++ configs/thilo-laptop/home.nix | 35 ++++ configs/thilo-laptop/nixos.nix | 163 ++++++++++++++++++ flake.nix | 9 + 5 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 configs/thilo-laptop/hardware-configuration.nix create mode 100644 configs/thilo-laptop/home.nix create mode 100644 configs/thilo-laptop/nixos.nix diff --git a/.gitignore b/.gitignore index f3dc3f1..b35fcc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -home.nix \ No newline at end of file +/home.nix \ No newline at end of file diff --git a/configs/thilo-laptop/hardware-configuration.nix b/configs/thilo-laptop/hardware-configuration.nix new file mode 100644 index 0000000..5b111a4 --- /dev/null +++ b/configs/thilo-laptop/hardware-configuration.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/2e1227f6-8725-43a3-aeb6-961df4ed9b25"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-6f077715-c436-4254-acb2-66d8be0a0c55".device = "/dev/disk/by-uuid/6f077715-c436-4254-acb2-66d8be0a0c55"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/877C-C918"; + 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.enp1s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/configs/thilo-laptop/home.nix b/configs/thilo-laptop/home.nix new file mode 100644 index 0000000..52946ed --- /dev/null +++ b/configs/thilo-laptop/home.nix @@ -0,0 +1,35 @@ +{ inputs, ... }: + +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.users.thilo = { + imports = [ + ./../../home-manager/modules/machine.nix + ]; + + machine = { + username = "thilo"; + isGeneric = false; + nixPackage = pkgs.nixUnstable; + isGnome = false; + noiseSuppression.enable = true; + isGraphical = true; + }; + + programs.obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [ + obs-vaapi + obs-teleport + droidcam-obs + obs-gstreamer + obs-shaderfilter + obs-command-source + obs-move-transition + advanced-scene-switcher + ]; + }; + }; +} diff --git a/configs/thilo-laptop/nixos.nix b/configs/thilo-laptop/nixos.nix new file mode 100644 index 0000000..5cd4711 --- /dev/null +++ b/configs/thilo-laptop/nixos.nix @@ -0,0 +1,163 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Setup keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + networking.hostName = "thilo-laptop"; # Define your hostname. + networking.networkmanager.enable = true; + time.timeZone = "Europe/Berlin"; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + # Configure console keymap + console.keyMap = "de"; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + + environment.gnome.excludePackages = with pkgs; [ + tracker + tracker-miners + ]; + + services = { + xserver = { + enable = true; +# displayManager.gdm.enable = true; +# desktopManager.gnome.enable = true; + displayManager.sddm.enable = true; + desktopManager.plasma5.enable = true; + layout = "us"; + xkbVariant = ""; + }; + gnome = { + tracker-miners.enable = false; + tracker.enable = false; + }; + printing.enable = true; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + tailscale = { + enable = true; + }; + flatpak.enable = true; + mullvad-vpn = { + enable = true; + package = pkgs.mullvad-vpn; + }; + }; + + # 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’. + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.thilo = { + uid = 1000; + description = "Thilo Billerbeck"; + shell = pkgs.zsh; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP9TwM1zgEQiU8Cl0OszpU/fba4NpG2rjNSoTvvm/Vcf thilo@thilo-pc" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHXL+1Q6MeNJoqaC4IlUXBIhLiRPzyM2Je11rQrXsiD" + # NEW + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN4DBDw+gSP6Wg/uf0unSxqSVV/y6OCcu7TLFdXYCmw7 thilo@avocadoom-laptop" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBX0RK+JzRkMsO/88NIyBXzQPr8/XkPX3IeClFmj9G8u thilo@thilo-pc" + ]; + extraGroups = [ + "dialout" + "adbusers" + "video" + "audio" + "wheel" + "docker" + "libvirtd" + "libvirt" + "networkmanager" + "qemu-libvirtd" + ]; + }; + + virtualisation = { + docker.enable = true; + podman.enable = true; + virtualbox.host.enable = true; + }; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + hardware.opengl.driSupport32Bit = true; + + hardware.bluetooth.enable = true; + services.blueman.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + zsh + ]; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + programs = { + steam.enable = true; + zsh.enable = true; + adb.enable = true; + droidcam.enable = true; + noisetorch.enable = true; + chromium = { + enable = true; + extensions = [ + "nngceckbapebfimnlniiiahkandclblb" # Bitwarden + "lhobafahddgcelffkeicbaginigeejlf" # Allow Cors + "dnhpnfgdlenaccegplpojghhmaamnnfp" # Augmented Steam + "mdjildafknihdffpkfmmpnpoiajfjnjd" # Consent-O-Matic + "eimadpbcbfnmbkopoojfekhnkhdbieeh" # Dark Reader + "ponfpcnoihfmfllpaingbgckeeldkhle" # Youtube Enhancer + "epocinhmkcnjfjobnglchpbncndobblj" # Mastodon Gaze + "blipmdconlkpinefehnmjammfjpmpbjk" # Lighthouse + "ggijpepdpiehgbiknmfpfbhcalffjlbj" # Open in mpv + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock Origin + ]; + }; + }; + + security.polkit.enable = true; + services.xserver.displayManager.defaultSession = "plasmawayland"; + + system.stateVersion = "23.05"; +} diff --git a/flake.nix b/flake.nix index 4ff72d4..f4cbd9f 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,15 @@ ]; specialArgs = { inherit inputs; }; }; + nixosConfigurations.thilo-laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + home-manager.nixosModules.home-manager + ./configs/thilo-laptop/nixos.nix + ./configs/thilo-laptop/home.nix + ]; + specialArgs = { inherit inputs; }; + }; homeConfigurations."thilo@thilo-pc-win" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ ./configs/wsl/home.nix ];