From 5c9443641d2b5eb07db82d643969ea540973b4bb Mon Sep 17 00:00:00 2001
From: Zynh Ludwig <Zynh0722@gmail.com>
Date: Sat, 1 Mar 2025 09:17:40 -0800
Subject: [PATCH] llynx: init

---
 flake.lock                             | 84 +++++++++++++++++++++++++-
 flake.nix                              |  4 ++
 hosts/llynx/configuration.nix          | 68 +++++++++++++++++++++
 hosts/llynx/hardware-configuration.nix | 53 ++++++++++++++++
 hosts/llynx/home.nix                   | 51 ++++++++++++++++
 5 files changed, 259 insertions(+), 1 deletion(-)
 create mode 100644 hosts/llynx/configuration.nix
 create mode 100644 hosts/llynx/hardware-configuration.nix
 create mode 100644 hosts/llynx/home.nix

diff --git a/flake.lock b/flake.lock
index d3ebe73..aa726b0 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,18 @@
 {
   "nodes": {
+    "asahi-firmware": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1740623884,
+        "narHash": "sha256-EC7otspAW72ODgn4Sl19w2UNMZE+RKk2aoJhyBhEoNA=",
+        "path": "/boot/asahi",
+        "type": "path"
+      },
+      "original": {
+        "path": "/boot/asahi",
+        "type": "path"
+      }
+    },
     "backgrounds": {
       "inputs": {
         "nixpkgs": [
@@ -167,6 +180,21 @@
         "type": "github"
       }
     },
+    "flake-compat_4": {
+      "locked": {
+        "lastModified": 1688025799,
+        "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
+        "owner": "nix-community",
+        "repo": "flake-compat",
+        "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
     "flake-parts": {
       "inputs": {
         "nixpkgs-lib": [
@@ -639,6 +667,26 @@
         "type": "github"
       }
     },
+    "nixos-apple-silicon": {
+      "inputs": {
+        "flake-compat": "flake-compat_4",
+        "nixpkgs": "nixpkgs_3",
+        "rust-overlay": "rust-overlay"
+      },
+      "locked": {
+        "lastModified": 1738646237,
+        "narHash": "sha256-++0dXoZO9l5oceiGQsJmtUI5WXlPMw6QKjpg7vGPl3w=",
+        "owner": "tpwrules",
+        "repo": "nixos-apple-silicon",
+        "rev": "3d1c6c27b14c4b8fcbdaec779e715f30cb72ed15",
+        "type": "github"
+      },
+      "original": {
+        "owner": "tpwrules",
+        "repo": "nixos-apple-silicon",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1740828860,
@@ -712,6 +760,22 @@
       }
     },
     "nixpkgs_3": {
+      "locked": {
+        "lastModified": 1738410390,
+        "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "3a228057f5b619feb3186e986dbe76278d707b6e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs_4": {
       "locked": {
         "lastModified": 1740828860,
         "narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=",
@@ -744,6 +808,7 @@
     },
     "root": {
       "inputs": {
+        "asahi-firmware": "asahi-firmware",
         "backgrounds": "backgrounds",
         "chaotic": "chaotic",
         "deploy-rs": "deploy-rs",
@@ -756,7 +821,8 @@
         "niri": "niri",
         "nix-darwin": "nix-darwin",
         "nix-gaming": "nix-gaming",
-        "nixpkgs": "nixpkgs_3",
+        "nixos-apple-silicon": "nixos-apple-silicon",
+        "nixpkgs": "nixpkgs_4",
         "repo-clone": "repo-clone",
         "sops-nix": "sops-nix",
         "umu": "umu",
@@ -781,6 +847,22 @@
         "type": "github"
       }
     },
+    "rust-overlay": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1686795910,
+        "narHash": "sha256-jDa40qRZ0GRQtP9EMZdf+uCbvzuLnJglTUI2JoHfWDc=",
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "rev": "5c2b97c0a9bc5217fc3dfb1555aae0fb756d99f9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "type": "github"
+      }
+    },
     "sops-nix": {
       "inputs": {
         "nixpkgs": [
diff --git a/flake.nix b/flake.nix
index 5726d16..0ca6c6b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -23,6 +23,9 @@
     backgrounds = { url = "git+https://git.zynh.me/Zynh0722/backgrounds"; inputs.nixpkgs.follows = "nixpkgs"; };
     umu = { url = "github:Open-Wine-Components/umu-launcher?dir=packaging/nix"; inputs.nixpkgs.follows = "nixpkgs"; };
 
+    nixos-apple-silicon = { url = "github:tpwrules/nixos-apple-silicon"; };
+    asahi-firmware = { url = "/boot/asahi"; flake = false; };
+
     deploy-rs = { url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; };
   };
 
@@ -34,6 +37,7 @@
     {
       nixosConfigurations = builders.compileNixosSystems [
         { hostname = "snowhawk"; }
+        { hostname = "llynx"; system = "aarch64-linux"; }
       ];
 
       darwinConfigurations = builders.compileDarwinSystems [
diff --git a/hosts/llynx/configuration.nix b/hosts/llynx/configuration.nix
new file mode 100644
index 0000000..fd882f2
--- /dev/null
+++ b/hosts/llynx/configuration.nix
@@ -0,0 +1,68 @@
+# Edit this configuration file to define what should be installed on
+# your system.  Help is available in the configuration.nix(5) man page
+# and in the NixOS manual (accessible by running `nixos-help`).
+
+{ pkgs, inputs, lib, config, ... }:
+
+{
+  imports = [
+    inputs.nixos-apple-silicon.nixosModules.default
+    inputs.home-manager.nixosModules.default
+    ../../modules
+  ];
+
+  snowhawk = {
+    filesystem.enable = true;
+    user.enable = true;
+    env.enable = true;
+    sops.enable = true;
+
+    audio.enable = false;
+    power-button.enable = false;
+  };
+
+  services.xserver.enable = true;
+  services.displayManager.sddm.enable = true;
+  services.desktopManager.plasma6.enable = true;
+
+  documentation = {
+    enable = true;
+    dev.enable = true;
+    man.enable = true;
+  };
+
+  home-manager = {
+    users = { "ravenshade" = import ./home.nix; };
+    backupFileExtension = "backup";
+    useGlobalPkgs = true;
+  };
+
+  environment.systemPackages = with pkgs; [
+    neovim
+    curl
+    git
+    killall
+
+    iwd
+
+    linux-manual
+
+    inputs.nh.packages.${pkgs.system}.default
+  ];
+
+  environment.variables.NH_FLAKE = "/home/ravenshade/.config/nixos";
+  environment.variables.NIXOS_OZONE_WL = 1;
+
+  fonts.packages = with pkgs; [
+    nerd-fonts.jetbrains-mono
+  ];
+
+  # Enable CUPS to print documents.
+  services.printing.enable = true;
+
+  # Set your time zone.
+  time.timeZone = "America/Los_Angeles";
+  # Before changing this value read the documentation for this option
+  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
+  system.stateVersion = "23.11"; # Did you read the comment?
+}
diff --git a/hosts/llynx/hardware-configuration.nix b/hosts/llynx/hardware-configuration.nix
new file mode 100644
index 0000000..eb113db
--- /dev/null
+++ b/hosts/llynx/hardware-configuration.nix
@@ -0,0 +1,53 @@
+# 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, inputs, ... }:
+
+{
+  imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
+
+  boot.initrd.availableKernelModules = [ "usb_storage" ];
+  boot.initrd.kernelModules = [ ];
+  boot.kernelModules = [ ];
+  boot.extraModulePackages = [ ];
+
+  hardware.asahi.peripheralFirmwareDirectory = inputs.asahi-firmware; # FIXME: flake input?
+  hardware.asahi.useExperimentalGPUDriver = true;
+
+  fileSystems."/" = {
+    device = "/dev/disk/by-uuid/9dba1955-a00b-4963-ac49-74e925ddd1b2";
+    fsType = "ext4";
+  };
+
+  fileSystems."/boot" = {
+    device = "/dev/disk/by-uuid/C215-0A0E";
+    fsType = "vfat";
+    options = [ "fmask=0022" "dmask=0022" ];
+  };
+
+  zramSwap.enable = true;
+  swapDevices = [{
+    device = "/swap";
+    size = 24 * 1000;
+  }];
+
+  # Use the systemd-boot EFI boot loader.
+  boot.loader.systemd-boot.enable = true;
+  boot.loader.efi.canTouchEfiVariables = false;
+
+  # 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.<interface>.useDHCP`.
+  networking.useDHCP = lib.mkDefault true;
+  # networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
+
+  networking.wireless.iwd = {
+    enable = true;
+    settings.General.EnableNetworkConfiguration = true;
+  };
+
+  networking.hostName = "llynx";
+
+  nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
+}
diff --git a/hosts/llynx/home.nix b/hosts/llynx/home.nix
new file mode 100644
index 0000000..4767fad
--- /dev/null
+++ b/hosts/llynx/home.nix
@@ -0,0 +1,51 @@
+{ pkgs, config, lib, inputs, ... }:
+
+{
+  imports = [
+    ../../home/modules
+  ];
+
+  snowhawk = {
+    # Desktop
+    firefox.enable = true;
+    kitty.enable = true;
+    sops.enable = true;
+
+    # Term Tools
+    neovim.enable = true;
+  };
+
+  snowhawk.ssh = {
+    enable = true;
+    homeNetwork = true;
+  };
+
+  home.packages = with pkgs; [
+    vesktop
+    ripgrep
+
+    lazygit
+    iwd
+
+    gcc
+
+    wl-clipboard
+
+    unzip
+    fzf
+    tree
+
+    pulsemixer
+
+    duf
+    pcmanfm
+    jq
+  ];
+
+  programs.nix-index.enable = true;
+
+  # Let Home Manager install and manage itself.
+  programs.home-manager.enable = true;
+  home.stateVersion = "23.11";
+}
+