From 0058f4553e4771c11eb8cfd8812a3de777de6d75 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 23 Jun 2025 22:59:06 -0700 Subject: [PATCH] cleanup --- README.md | 8 +- etcnixos/common.nix | 57 ++++++++++---- etcnixos/hardware_desktop.nix | 30 ------- etcnixos/hardware_laptop.nix | 22 ------ etcnixos/system-mreow.nix | 48 ----------- etcnixos/system-yarn.nix | 3 - home-manager/gui.nix | 1 - home-manager/home-yarn.nix | 9 +-- home-manager/progs/alacritty.nix | 131 ------------------------------- 9 files changed, 45 insertions(+), 264 deletions(-) delete mode 100644 home-manager/progs/alacritty.nix diff --git a/README.md b/README.md index 9259409..933dc87 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,12 @@ # My Dotfiles ✨ These are my dotfiles for my laptop and desktop (which I use [NixOS](https://nixos.org/) and [home-manager](https://github.com/nix-community/home-manager) on). -## Structure -The `nix` folder contains two sub directories, `etcnixos` and `home-manager`. The former is the contents of `/etc/nixos` (hence the name), whereas the latter is the contents of `~/.config/home-manager`. -`justfile` is the [just](https://github.com/casey/just) script I use for updating my NixOS system and syncing the changes with this repo. - ## What do I use? Browser: Firefox 🦊 (actually [Zen Browser](https://github.com/zen-browser/desktop) :p) -Text Editor: [helix](https://github.com/helix-editor/helix) +Text Editor: [Doom Emacs](https://github.com/doomemacs/doomemacs) -Terminal: [alacritty](https://github.com/alacritty/alacritty) +Terminal: [ghostty](https://github.com/ghostty-org/ghostty) Shell: [fish](https://fishshell.com/) with the [pure](https://github.com/pure-fish/pure) prompt diff --git a/etcnixos/common.nix b/etcnixos/common.nix index 15017e2..f5d9526 100644 --- a/etcnixos/common.nix +++ b/etcnixos/common.nix @@ -20,8 +20,14 @@ inputs.nixos-hardware.nixosModules.common-pc-ssd inputs.chaotic.nixosModules.default inputs.disko.nixosModules.disko + inputs.lanzaboote.nixosModules.lanzaboote ]; + hardware.enableRedistributableFirmware = true; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + swapDevices = [ ]; + nix = { # optimize the store optimise.automatic = true; @@ -33,30 +39,58 @@ ]; }; + system.activationScripts = { + # extract all my secureboot keys + # TODO! proper secrets management + "secureboot-keys".text = '' + #!/bin/sh + rm -fr ${config.boot.lanzaboote.pkiBundle} || true + mkdir -p ${config.boot.lanzaboote.pkiBundle} + ${pkgs.gnutar}/bin/tar xf ${./secrets/secureboot.tar} -C ${config.boot.lanzaboote.pkiBundle} + chown -R root:wheel ${config.boot.lanzaboote.pkiBundle} + chmod -R 500 ${config.boot.lanzaboote.pkiBundle} + ''; + }; + # kernel options boot = { kernelPackages = pkgs.linuxPackages_cachyos-lto; # kernelPackages = pkgs.linuxPackages_latest; # kernelPackages = pkgs.linuxPackages; - kernel.sysctl = { - # dmesg shushhhhh - "kernel.printk" = "2 4 1 7"; + lanzaboote = { + enable = true; + # TODO: proper secrets management so this is not stored in nix store + pkiBundle = "/var/lib/sbctl"; }; # Bootloader. loader = { - systemd-boot.enable = true; efi.canTouchEfiVariables = true; timeout = 1; + /* + Lanzaboote currently replaces the systemd-boot module. + This setting is usually set to true in configuration.nix + generated at installation time. So we force it to false + for now. + */ + systemd-boot.enable = lib.mkForce false; + }; initrd = { compressor = "zstd"; + availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usbhid" + ]; }; kernelModules = [ + "kvm-amd" "ip_tables" "iptable_nat" "msr" @@ -95,7 +129,7 @@ mullvad-vpn.enable = true; }; - # Set your time zone. + # EST time.timeZone = "America/New_York"; security = { @@ -117,18 +151,6 @@ # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - # Enable Bluetooth hardware.bluetooth = { enable = true; @@ -218,6 +240,7 @@ }; system.stateVersion = "24.11"; + nixpkgs.hostPlatform = "x86_64-linux"; documentation.enable = true; documentation.man.enable = true; diff --git a/etcnixos/hardware_desktop.nix b/etcnixos/hardware_desktop.nix index 17e40e4..c1e2481 100644 --- a/etcnixos/hardware_desktop.nix +++ b/etcnixos/hardware_desktop.nix @@ -1,6 +1,3 @@ -# 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, @@ -8,22 +5,7 @@ modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot.initrd.availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usb_storage" - "usbhid" - "sd_mod" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - fileSystems."/" = { device = "/dev/disk/by-uuid/ff51be5a-b87b-4e6a-9c1d-796ceeaca153"; fsType = "ext4"; @@ -44,16 +26,4 @@ options = [ "nofail" ]; }; - 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; } diff --git a/etcnixos/hardware_laptop.nix b/etcnixos/hardware_laptop.nix index bc83470..625a17a 100644 --- a/etcnixos/hardware_laptop.nix +++ b/etcnixos/hardware_laptop.nix @@ -6,15 +6,6 @@ ... }: { - boot.initrd.availableKernelModules = [ - "xhci_pci" - "thunderbolt" - "nvme" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - disko.devices = { disk = { main = { @@ -59,17 +50,4 @@ }; }; - 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.wlp166s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - hardware.enableRedistributableFirmware = true; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/etcnixos/system-mreow.nix b/etcnixos/system-mreow.nix index 231fc96..ca69172 100644 --- a/etcnixos/system-mreow.nix +++ b/etcnixos/system-mreow.nix @@ -12,7 +12,6 @@ ./hardware_laptop.nix inputs.nixos-hardware.nixosModules.framework-amd-ai-300-series - inputs.lanzaboote.nixosModules.lanzaboote ]; # completely and utterly broken @@ -38,38 +37,6 @@ }; }; - boot = { - lanzaboote = { - enable = true; - # TODO: proper secrets management so this is not stored in nix store - pkiBundle = "/var/lib/sbctl"; - }; - - # Bootloader. - loader = { - /* - Lanzaboote currently replaces the systemd-boot module. - This setting is usually set to true in configuration.nix - generated at installation time. So we force it to false - for now. - */ - systemd-boot.enable = lib.mkForce false; - }; - }; - - system.activationScripts = { - # extract all my secureboot keys - # TODO! proper secrets management - "secureboot-keys".text = '' - #!/bin/sh - rm -fr ${config.boot.lanzaboote.pkiBundle} || true - mkdir -p ${config.boot.lanzaboote.pkiBundle} - ${pkgs.gnutar}/bin/tar xf ${./secrets/secureboot.tar} -C ${config.boot.lanzaboote.pkiBundle} - chown -R root:wheel ${config.boot.lanzaboote.pkiBundle} - chmod -R 500 ${config.boot.lanzaboote.pkiBundle} - ''; - }; - programs.gamescope = { enable = true; capSysNice = true; @@ -79,21 +46,6 @@ gamescopeSession.enable = true; }; - # this is a life saver. - # literally no documentation about this anywhere. - # might be good to write about this... - # https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/ - systemd.services.greetd.serviceConfig = { - Type = "idle"; - StandardInput = "tty"; - StandardOutput = "tty"; - StandardError = "journal"; # Without this errors will spam on screen - # Without these bootlogs will spam on screen - TTYReset = true; - TTYVHangup = true; - TTYVTDisallocate = true; - }; - system.activationScripts = { # FIX: https://github.com/NixOS/nix/issues/2982 "profile-channel-dummy".text = '' diff --git a/etcnixos/system-yarn.nix b/etcnixos/system-yarn.nix index 27f7788..7f4cd03 100644 --- a/etcnixos/system-yarn.nix +++ b/etcnixos/system-yarn.nix @@ -20,9 +20,6 @@ networking.hostId = "abf570f9"; boot = { - # fixes zenpower driver issue - kernelPackages = lib.mkForce pkgs.linuxPackages_latest; - kernelParams = [ # allow overclocking (I actually underclock but lol) "amdgpu.ppfeaturemask=0xFFF7FFFF" diff --git a/home-manager/gui.nix b/home-manager/gui.nix index 844b7da..5b4d321 100644 --- a/home-manager/gui.nix +++ b/home-manager/gui.nix @@ -7,7 +7,6 @@ { imports = [ ./no-gui.nix - # ./progs/alacritty.nix ./progs/ghostty.nix ./progs/emacs.nix # ./progs/trezor.nix # - broken diff --git a/home-manager/home-yarn.nix b/home-manager/home-yarn.nix index f9e6629..67b1b26 100644 --- a/home-manager/home-yarn.nix +++ b/home-manager/home-yarn.nix @@ -6,7 +6,9 @@ ... }: { - imports = [ ./gui.nix ]; + imports = [ + ./gui.nix + ]; home.packages = with pkgs; [ protontricks @@ -15,11 +17,6 @@ bs-manager ]; - programs.alacritty.settings = { - window.decorations = lib.mkForce "full"; - window.opacity = lib.mkForce 1.0; - }; - programs.obs-studio = { enable = true; plugins = with pkgs.obs-studio-plugins; [ diff --git a/home-manager/progs/alacritty.nix b/home-manager/progs/alacritty.nix deleted file mode 100644 index 63484a2..0000000 --- a/home-manager/progs/alacritty.nix +++ /dev/null @@ -1,131 +0,0 @@ -{ pkgs, ... }: -{ - home.sessionVariables = { - TERMINAL = "alacritty"; - }; - - programs.alacritty = { - enable = true; - package = pkgs.alacritty; - settings = { - # some programs can't handle alacritty - env.TERM = "xterm-256color"; - - window = { - # using a window manager, no decorations needed - decorations = "none"; - - # semi-transparent - opacity = 0.90; - - # padding between the content of the terminal and the edge - padding = { - x = 10; - y = 10; - }; - - dimensions = { - columns = 80; - lines = 40; - }; - }; - - scrolling = { - history = 1000; - multiplier = 3; - }; - - font = - let - baseFont = { - family = "JetBrains Mono Nerd Font"; - style = "Regular"; - }; - in - { - size = 12; - - normal = baseFont; - - bold = baseFont // { - style = "Bold"; - }; - - italic = baseFont // { - style = "Italic"; - }; - - offset.y = 0; - glyph_offset.y = 0; - }; - - # color scheme - colors = - let - normal = { - black = "0x1b1e28"; - red = "0xd0679d"; - green = "0x5de4c7"; - yellow = "0xfffac2"; - blue = "#435c89"; - magenta = "0xfcc5e9"; - cyan = "0xadd7ff"; - white = "0xffffff"; - }; - - bright = { - black = "0xa6accd"; - red = normal.red; - green = normal.green; - yellow = normal.yellow; - blue = normal.cyan; - magenta = "0xfae4fc"; - cyan = "0x89ddff"; - white = normal.white; - }; - in - { - inherit normal bright; - primary = { - background = "0x131621"; - foreground = bright.black; - }; - - cursor = { - text = "CellBackground"; - cursor = "CellForeground"; - }; - - search = - let - foreground = normal.black; - background = normal.cyan; - in - { - matches = { - inherit foreground background; - }; - - focused_match = { - inherit foreground background; - }; - }; - - selection = { - text = "CellForeground"; - background = "0x303340"; - }; - - vi_mode_cursor = { - text = "CellBackground"; - cursor = "CellForeground"; - }; - }; - - cursor = { - style = "Underline"; - vi_mode_style = "Underline"; - }; - }; - }; -}