diff options
| author | tv <tv@krebsco.de> | 2026-11-26 13:18:31 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-26 13:18:31 +0000 |
| commit | 40e0d1268b0457d71f6aa946fe5ed6a5bf22c789 (patch) | |
| tree | 795494daaef87b8a36120fc53dc53363dfe589e8 /systems/qi | |
| parent | 7b15342234d0f6f6b01645c294eb1eb3b543787c (diff) | |
qi: init
Diffstat (limited to 'systems/qi')
| -rw-r--r-- | systems/qi/base.nix | 77 | ||||
| -rw-r--r-- | systems/qi/config.nix | 7 | ||||
| -rw-r--r-- | systems/qi/firmware.nix | 36 | ||||
| -rw-r--r-- | systems/qi/spec.nix | 3 |
4 files changed, 123 insertions, 0 deletions
diff --git a/systems/qi/base.nix b/systems/qi/base.nix new file mode 100644 index 00000000..e124a9d4 --- /dev/null +++ b/systems/qi/base.nix @@ -0,0 +1,77 @@ +{ config, inputs, lib, modulesPath, pkgs, ... }: { + imports = [ + # Minimize the build to produce a smaller closure + (modulesPath + "/profiles/minimal.nix") + (import (inputs.mobile-nixos + "/lib/configuration.nix") { device = "oneplus-enchilada"; }) + + ./firmware.nix + ]; + + krebs.build.host = config.krebs.hosts.qi; + + networking.networkmanager.enable = false; + networking.wireless = { + userControlled.enable = true; + # userControlled.group defaults to wheel + enable = true; + }; + + zramSwap.enable = true; + + environment.systemPackages = [ + pkgs.git + pkgs.rsync + pkgs.btrfs-progs + ]; + + nixpkgs.config.allowUnfree = false; + services.openssh.enable = true; + + users.mutableUsers = false; + users.users = { + default = { + isNormalUser = true; + extraGroups = [ + "wheel" + ]; + }; + }; + + nix = { + settings = { + trusted-users = [ "@wheel" "root" ]; + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + builders-use-substitutes = true; + flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}''; + trust-tarballs-from-git-forges = true; + }; + package = pkgs.nixVersions.latest; + nixPath = [ "/var/src" ]; + }; + + # at least required for rebuild switch (not for creating the image) + # otherwise nixos-rebuild switch will fail with: + # Failed to install bootloader + # warning: error(s) occurred while switching to the new configuration + boot.loader.grub.enable = false; + system.build.installBootLoader = pkgs.writers.writeDash "install-bootloader" '' + echo DERP >&2 + ''; + + services.journald.extraConfig = '' + Storage=volatile + ''; + + boot.growPartition = false; + + boot.initrd.luks.devices.main = { + device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888889"; + allowDiscards = true; + bypassWorkqueues = true; + }; + fileSystems."/" = { + device = "/dev/mapper/main"; + fsType = "btrfs"; + }; +} diff --git a/systems/qi/config.nix b/systems/qi/config.nix new file mode 100644 index 00000000..27973e55 --- /dev/null +++ b/systems/qi/config.nix @@ -0,0 +1,7 @@ +{ config, inputs, lib, pkgs, ... }: { + imports = [ + ./base.nix + ]; + + system.stateVersion = "24.11"; +} diff --git a/systems/qi/firmware.nix b/systems/qi/firmware.nix new file mode 100644 index 00000000..f8a8b524 --- /dev/null +++ b/systems/qi/firmware.nix @@ -0,0 +1,36 @@ +# Based on +# https://git.pavluk.org/chayleaf/dotfiles +# ff839c3153ba2ed6547b2c8cf5ef1f8247f6fbcd +# system/hardware/oneplus-enchilada/pkgs.nix and +# system/hardware/oneplus-enchilada/default.nix + +{ lib, pkgs, ... }: { + nixpkgs.overlays = [(self: super: { + oneplus-enchilada.firmware = + self.stdenvNoCC.mkDerivation { + name = "firmware-oneplus-sdm845"; + src = self.fetchFromGitLab { + owner = "sdm845-mainline"; + repo = "firmware-oneplus-sdm845"; + rev = "176ca713448c5237a983fb1f158cf3a5c251d775"; + hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4="; + }; + installPhase = '' + cp -a . "$out" + cd "$out/lib/firmware/postmarketos" + find . -type f,l | xargs -i bash -c 'mkdir -p "$(dirname "../$1")" && mv "$1" "../$1"' -- {} + cd "$out/usr" + find . -type f,l | xargs -i bash -c 'mkdir -p "$(dirname "../$1")" && mv "$1" "../$1"' -- {} + cd .. + find "$out/lib/firmware/postmarketos" "$out/usr" | tac | xargs rmdir + ''; + dontStrip = true; + # not actually redistributable, but who cares + meta.license = lib.licenses.unfreeRedistributableFirmware; + }; + })]; + + mobile.device.firmware = + # Override ${inputs.mobile-nixos}/devices/oneplus-enchilada/default.nix + lib.mkForce pkgs.oneplus-enchilada.firmware; +} diff --git a/systems/qi/spec.nix b/systems/qi/spec.nix new file mode 100644 index 00000000..38187ab7 --- /dev/null +++ b/systems/qi/spec.nix @@ -0,0 +1,3 @@ +{ + system = "aarch64-linux"; +} |
