From 80876090331dbfb7e0bb55f537682751c22c3b42 Mon Sep 17 00:00:00 2001 From: Zephrynis <132010650+zephrynis@users.noreply.github.com> Date: Mon, 6 Oct 2025 01:46:40 +0100 Subject: [PATCH] its all bad, time to restart from scratch --- README.md | 62 ------------- flake.nix | 58 ------------ home/users/user/home.nix | 17 ---- hosts/laptop/configuration.nix | 31 ------- hosts/laptop/hardware-configuration.nix | 39 -------- hosts/pc/configuration.nix | 25 ------ hosts/pc/hardware-configuration.nix | 19 ---- modules/common.nix | 63 ------------- packages/zen-browser.nix | 114 ------------------------ 9 files changed, 428 deletions(-) delete mode 100644 README.md delete mode 100644 flake.nix delete mode 100644 home/users/user/home.nix delete mode 100644 hosts/laptop/configuration.nix delete mode 100644 hosts/laptop/hardware-configuration.nix delete mode 100644 hosts/pc/configuration.nix delete mode 100644 hosts/pc/hardware-configuration.nix delete mode 100644 modules/common.nix delete mode 100644 packages/zen-browser.nix diff --git a/README.md b/README.md deleted file mode 100644 index b835f96..0000000 --- a/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# Nix flake for PC and Laptop - -This flake provides two NixOS hosts (pc and laptop) with shared modules and Home Manager. - -## Layout - -- `flake.nix` — Flake inputs/outputs, two `nixosConfigurations` (pc, laptop) -- `modules/common.nix` — Common NixOS settings for both hosts -- `hosts/pc` — PC host config + its `hardware-configuration.nix` -- `hosts/laptop` — Laptop host config + its `hardware-configuration.nix` -- `home/users/user/home.nix` — Home Manager configuration for the user - -## Quick start - -1) Update variables: - -- In `flake.nix`, set `user = ""`. -- Rename `home/users/user/` to `home/users//` and edit `home.nix` accordingly. -- In each host's `configuration.nix`, the Home Manager import uses `${user}` so it will follow automatically once the flake variable is set. -- Set `networking.hostName` per host if you want different names. - -2) Generate real hardware configs on each device: - -On each machine, clone this repo and inside that host folder run: - -```bash -sudo nixos-generate-config --show-hardware-config > hosts//hardware-configuration.nix -``` - -Replace the placeholder UUIDs and modules in the template with the generated content. - -3) Switch configuration on the machine: - -From the repo root on the machine you are configuring: - -```bash -sudo nixos-rebuild switch --flake .#pc -# or -sudo nixos-rebuild switch --flake .#laptop -``` - -If building from another machine for a remote target, add `--target-host` and optionally `--use-remote-sudo`. - -4) Home Manager only (optional): - -Home Manager is integrated as a NixOS module. If you want to apply only HM changes after login: - -```bash -home-manager switch --flake .#@ -``` - -5) Format the repo (optional): - -```bash -nix fmt -``` - -## Notes - -- This flake targets x86_64-linux only. If you need ARM support, you'll need to add an aarch64 system and review the inputs. -- Update `system.stateVersion` and `home.stateVersion` only when you deliberately accept new defaults. -- To pin a newer NixOS release, change inputs `nixpkgs` and `home-manager` to the latest stable branch and review release notes. diff --git a/flake.nix b/flake.nix deleted file mode 100644 index a7588e8..0000000 --- a/flake.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - description = "Nix flake for PC and laptop with shared modules and Home Manager"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; # You can bump to a newer release later (e.g., nixos-24.11) - - home-manager = { - url = "github:nix-community/home-manager/release-25.05"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = { self, nixpkgs, home-manager, ... }: - let - # Change this to your preferred login name once you clone on the machine(s) - user = "user"; - - mkFormatter = system: let pkgs = import nixpkgs { inherit system; }; in pkgs.alejandra; - in - { - # Two NixOS hosts. This flake targets x86_64-linux only. - nixosConfigurations = { - pc = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - inherit user; - # Only pass what host modules need from inputs to stay tidy - inputs = { inherit home-manager; }; - }; - modules = [ ./hosts/pc/configuration.nix ]; - }; - - laptop = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - inherit user; - inputs = { inherit home-manager; }; - }; - modules = [ ./hosts/laptop/configuration.nix ]; - }; - }; - - # `nix fmt` support - formatter = { - x86_64-linux = mkFormatter "x86_64-linux"; - }; - - # Expose custom packages - packages = { - x86_64-linux = let -nixpkgs48 = nixpkgs; # alias - pkgs = import nixpkgs { system = "x86_64-linux"; }; - in { - zen-browser = pkgs.callPackage ./packages/zen-browser.nix { inherit (pkgs) buildMozillaMach buildNpmPackage fetchFromGitHub lib fetchurl git pkg-config python3 vips runtimeShell writeScriptBin; }; - }; - }; - }; -} diff --git a/home/users/user/home.nix b/home/users/user/home.nix deleted file mode 100644 index ee381d6..0000000 --- a/home/users/user/home.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, pkgs, ... }: -{ - home.username = "user"; # set by flake variable in system configs; keep consistent - home.homeDirectory = "/home/user"; - - # Set once on first deploy; bump if you intentionally accept breaking changes - home.stateVersion = "24.05"; - - programs.home-manager.enable = true; - - programs.bash.enable = true; - programs.starship = { enable = true; enableBashIntegration = true; }; - - home.packages = with pkgs; [ - fastfetch - ]; -} diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix deleted file mode 100644 index a979c0a..0000000 --- a/hosts/laptop/configuration.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, lib, pkgs, inputs, user, ... }: -{ - imports = [ - ../../modules/common.nix - ./hardware-configuration.nix - inputs.home-manager.nixosModules.home-manager - ]; - - networking.hostName = "laptop"; - - # UEFI bootloader configuration (systemd-boot) - boot.loader.systemd-boot.enable = true; - # Allow writing EFI variables (required to install the loader) - boot.loader.efi.canTouchEfiVariables = true; - - # Host-specific tweaks - powerManagement.powertop.enable = true; # example: laptop power savings - services.tlp.enable = true; - - users.users.${user} = { - isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" ]; - }; - - # Home Manager user wiring - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.${user} = import ../../home/users/${user}/home.nix; - }; -} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix deleted file mode 100644 index d70fa85..0000000 --- a/hosts/laptop/hardware-configuration.nix +++ /dev/null @@ -1,39 +0,0 @@ -# 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" "uas" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/96e3003f-3f4f-4104-93e1-755f2922327c"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/94ED-E007"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - 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.eno1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} \ No newline at end of file diff --git a/hosts/pc/configuration.nix b/hosts/pc/configuration.nix deleted file mode 100644 index 299112f..0000000 --- a/hosts/pc/configuration.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ config, lib, pkgs, inputs, user, ... }: -{ - imports = [ - ../../modules/common.nix - ./hardware-configuration.nix - inputs.home-manager.nixosModules.home-manager - ]; - - networking.hostName = "pc"; - - # Host-specific tweaks - services.printing.enable = true; # example: enable printing on PC - - users.users.${user} = { - isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" ]; - }; - - # Home Manager user wiring - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.${user} = import ../../home/users/${user}/home.nix; - }; -} diff --git a/hosts/pc/hardware-configuration.nix b/hosts/pc/hardware-configuration.nix deleted file mode 100644 index 04d06f0..0000000 --- a/hosts/pc/hardware-configuration.nix +++ /dev/null @@ -1,19 +0,0 @@ -# NOTE: Replace with the actual generated hardware config from the PC. -# Generate on the PC with: -# sudo nixos-generate-config --show-hardware-config > hardware-configuration.nix -{ config, lib, pkgs, modulesPath, ... }: -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; - fsType = "ext4"; - }; - - swapDevices = [ ]; -} diff --git a/modules/common.nix b/modules/common.nix deleted file mode 100644 index 9fe02e4..0000000 --- a/modules/common.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - nix = { - settings = { - experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 14d"; - }; - }; - - time.timeZone = "UTC"; - - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_TIME = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - }; - }; - - console = { - keyMap = "us"; - earlySetup = true; - }; - - networking.networkmanager.enable = true; - - services.openssh = { - enable = true; - settings = { - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - PermitRootLogin = "no"; - }; - }; - - security.sudo.wheelNeedsPassword = false; - - users.defaultUserShell = pkgs.bashInteractive; # change to zsh if preferred - - environment.systemPackages = with pkgs; [ - alacritty - # Custom Zen Browser package (defined in ../packages/zen-browser.nix) - (pkgs.callPackage ../packages/zen-browser.nix { inherit (pkgs) buildMozillaMach buildNpmPackage fetchFromGitHub lib fetchurl git pkg-config python3 vips runtimeShell writeScriptBin; }) - ]; - - # Allow proprietary software if needed - nixpkgs.config = { - allowUnfree = true; - # Permit evaluation of packages marked broken (zen-browser currently sets broken = true) - allowBroken = true; - }; - - # Set the minimal stateVersion. When you upgrade, bump per host. - system.stateVersion = "24.05"; # do not change without reading the manual -} diff --git a/packages/zen-browser.nix b/packages/zen-browser.nix deleted file mode 100644 index acea7cd..0000000 --- a/packages/zen-browser.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ buildMozillaMach -, buildNpmPackage -, fetchFromGitHub -, lib -, fetchurl -, git -, pkg-config -, python3 -, vips -, runtimeShell -, writeScriptBin -, ... }: - -let - zenVersion = "1.12.5b"; - firefoxVersion = "138.0.3"; - - firefoxSrc = fetchurl { - url = "https://archive.mozilla.org/pub/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.xz"; - hash = "sha256-on86tB1jWyodhBgonR3tzWy1MhSMfWPT+Ll8ZkRVE+Q="; - }; - - patchedSrc = buildNpmPackage { - pname = "firefox-zen-browser-src-patched"; - version = zenVersion; - - src = fetchFromGitHub { - owner = "zen-browser"; - repo = "desktop"; - rev = zenVersion; - sha256 = "sha256-6CovYcJBbR9QtcNqZEC4tmukWTqra1b4VepmO21TwhM="; - fetchSubmodules = true; - }; - - postUnpack = '' - tar xf ${firefoxSrc} - mkdir -p source/engine - mv firefox-${firefoxVersion} source/engine - ''; - - npmDepsHash = "sha256-NwX8+gpz66dl70QyvEETTgTwyAtlv+OaqGtgpeCvvUY="; - - makeCacheWritable = true; - - nativeBuildInputs = [ - git - python3 - pkg-config - (writeScriptBin "sips" '' - #!${runtimeShell} - echo >&2 "$@" - '') - (writeScriptBin "iconutil" '' - #!${runtimeShell} - echo >&2 "$@" - '') - ]; - - buildInputs = [ vips ]; - - buildPhase = '' - npm run surfer ci --brand release --display-version ${zenVersion} - npm run import - python ./scripts/update_en_US_packs.py - ''; - - installPhase = '' - cp -r engine $out - - cd $out - for i in $(find . -type l); do - realpath=$(readlink $i) - rm $i - cp $realpath $i - done - ''; - - dontFixup = true; - }; -in -( - (buildMozillaMach { - pname = "zen-browser"; - packageVersion = zenVersion; - version = firefoxVersion; - applicationName = "Zen Browser"; - binaryName = "zen"; - branding = "browser/branding/release"; - requireSigning = false; - allowAddonSideload = true; - - src = patchedSrc; - - extraConfigureFlags = [ "--with-app-basename=Zen" ]; - - meta = { - description = "Firefox based browser with a focus on privacy and customization"; - homepage = "https://zen-browser.app/"; - downloadPage = "https://zen-browser.app/download/"; - changelog = "https://zen-browser.app/release-notes/#${zenVersion}"; - license = lib.licenses.mpl20; - maintainers = with lib.maintainers; [ matthewpi titaniumtown eveeifyeve ]; - broken = true; - platforms = lib.platforms.unix; - mainProgram = "zen"; - }; - }).override { - pgoSupport = false; - crashreporterSupport = false; - enableOfficialBranding = false; - } -).overrideAttrs (prev: { - patches = builtins.filter (p: !(lib.hasInfix "firefox-mac-missing-vector-header.patch" p)) prev.patches; -})