From 468f3999656cbb73cc0d35c05bee451472a32bcc Mon Sep 17 00:00:00 2001 From: _cry64 Date: Thu, 26 Mar 2026 16:28:53 +1000 Subject: [PATCH] add t2-firmware support --- flake.lock | 16 ++++++++++++++++ flake.nix | 2 ++ groups/all/default.nix | 4 ---- homes/lorkan/modules/cli/ssh.nix | 10 ++++++++-- hosts/MACBOOKI9/default.nix | 1 + hosts/modules/core/t2-firmware.nix | 17 +++++++++++++++++ overlays/default.nix | 2 ++ packages/get-apple-firmware.nix | 29 +++++++++++++++++++++++++++++ 8 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 hosts/modules/core/t2-firmware.nix create mode 100644 packages/get-apple-firmware.nix diff --git a/flake.lock b/flake.lock index 6e68646..063597d 100644 --- a/flake.lock +++ b/flake.lock @@ -978,6 +978,21 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1774465523, + "narHash": "sha256-4v7HPm63Q90nNn4fgkgKsjW1AH2Klw7XzPtHJr562nM=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "de895be946ad1d8aafa0bb6dfc7e7e0e9e466a29", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1767313136, @@ -1144,6 +1159,7 @@ "nix-flatpak": "nix-flatpak", "nixcats": "nixcats", "nixcord": "nixcord", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2", "nixpkgs-master": "nixpkgs-master", "nixpkgs-unstable": "nixpkgs-unstable", diff --git a/flake.nix b/flake.nix index 7043d8c..84b2a0c 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,8 @@ nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-master.url = "github:NixOS/nixpkgs/master"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + home-manager = { url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/groups/all/default.nix b/groups/all/default.nix index 1214fc8..f9036be 100644 --- a/groups/all/default.nix +++ b/groups/all/default.nix @@ -3,10 +3,6 @@ lib, ... }: { - imports = [ - ../../hosts/modules/core/garbage-collector.nix - ]; - networking = { networkmanager.enable = true; diff --git a/homes/lorkan/modules/cli/ssh.nix b/homes/lorkan/modules/cli/ssh.nix index 841bedc..e6c2482 100644 --- a/homes/lorkan/modules/cli/ssh.nix +++ b/homes/lorkan/modules/cli/ssh.nix @@ -4,7 +4,13 @@ # WARNING: for that you need to use `services.ssh-agent.enable` programs.ssh = { enable = true; - forwardAgent = false; - addKeysToAgent = "yes"; + + matchBlocks = { + # * block indicates defaults + "*" = { + forwardAgent = false; + addKeysToAgent = "yes"; + }; + }; }; } diff --git a/hosts/MACBOOKI9/default.nix b/hosts/MACBOOKI9/default.nix index cd9829b..4779b22 100755 --- a/hosts/MACBOOKI9/default.nix +++ b/hosts/MACBOOKI9/default.nix @@ -6,6 +6,7 @@ }: { imports = [ ./hardware.nix + ../modules/core/t2-firmware.nix ]; networking.hostName = "MACBOOKI9"; diff --git a/hosts/modules/core/t2-firmware.nix b/hosts/modules/core/t2-firmware.nix new file mode 100644 index 0000000..f22d238 --- /dev/null +++ b/hosts/modules/core/t2-firmware.nix @@ -0,0 +1,17 @@ +{ + inputs, + pkgs, + ... +}: { + imports = [ + inputs.nixos-hardware.nixosModules.apple-t2 + ]; + + environment.systemPackages = with pkgs; [ + # t2-firmware dependencies + # REF: https://github.com/t2linux/nixos-t2-iso + python3 + dmg2img + get-apple-firmware + ]; +} diff --git a/overlays/default.nix b/overlays/default.nix index db1ecef..f3f7967 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -24,6 +24,8 @@ ]; }; + get-apple-firmware = pkgs.callPackage ../packages/get-apple-firmware.nix {}; + sddm-theme-corners = import ../packages/sddm-theme/corners.nix { inherit pkgs; }; diff --git a/packages/get-apple-firmware.nix b/packages/get-apple-firmware.nix new file mode 100644 index 0000000..7b25cce --- /dev/null +++ b/packages/get-apple-firmware.nix @@ -0,0 +1,29 @@ +{ + stdenvNoCC, + fetchurl, + lib, +}: +stdenvNoCC.mkDerivation (final: { + pname = "get-apple-firmware"; + version = "360156db52c013dbdac0ef9d6e2cebbca46b955b"; + src = fetchurl { + url = "https://raw.github.com/t2linux/wiki/${final.version}/docs/tools/firmware.sh"; + hash = "sha256-IL7omNdXROG402N2K9JfweretTnQujY67wKKC8JgxBo="; + }; + + dontUnpack = true; + + buildPhase = '' + mkdir -p $out/bin + cp ${final.src} $out/bin/get-apple-firmware + chmod +x $out/bin/get-apple-firmware + ''; + + meta = { + description = "A script to get needed firmware for T2linux devices"; + homepage = "https://t2linux.org"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [soopyc]; + mainProgram = "get-apple-firmware"; + }; +})