flake: refactor packages to fit expectations

This commit is contained in:
Cassie Cheung 2025-02-07 11:48:15 +08:00
parent a71dc85e76
commit 81f28602aa
No known key found for this signature in database
4 changed files with 52 additions and 31 deletions

View file

@ -23,14 +23,14 @@ jobs:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@master
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
remove-large-packages: 'true'
remove-cached-tools: 'true'
remove-swapfile: 'true'
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
remove-large-packages: 'true'
remove-cached-tools: 'true'
remove-swapfile: 'true'
- name: Checkout
uses: actions/checkout@v4
- name: "Install Nix"
@ -47,8 +47,8 @@ jobs:
env:
GC_DONT_GC: 1
run: |
for output in $(nix flake show --json | nix run nixpkgs#jq -- -r 'keys[]'); do
nix build .#$output --accept-flake-config
for output in $(nix flake show --json | nix run nixpkgs#jq -- -r '.packages."x86_64-linux" | keys[]'); do
nix build .#packages.x86_64-linux.${output} --accept-flake-config
if [ $(du -B1M result/iso/*.iso | cut -f1) -gt 2000 ]; then
split -d result/iso/*.iso -b 2000M nixos-$output.iso.part-
else

View file

@ -12,22 +12,29 @@
extra-trusted-public-keys = [ "cache.soopy.moe-1:0RZVsQeR+GOh0VQI9rvnHz55nVXkFardDqfm4+afjPo=" ];
};
outputs = { self, nixpkgs, nixos-hardware }:
let
system = "x86_64-linux";
inherit (nixpkgs) lib;
outputs =
{
self,
nixpkgs,
nixos-hardware,
}:
let
inherit (nixpkgs) lib;
mergeMap = fn: list: lib.lists.foldr (a: b: a // b) {} (map fn list);
in
mergeMap (config: {
${lib.strings.removeSuffix ".nix" (builtins.baseNameOf config)} = (lib.nixosSystem {
inherit system;
modules = [ config ];
specialArgs = {
inherit nixos-hardware;
};
}).config.system.build.isoImage;
}) (builtins.filter (x: x != null) (lib.attrsets.mapAttrsToList (key: value: if value == "regular" && lib.strings.hasInfix "iso" key then ./nix/${key} else null) (builtins.readDir ./nix)));
system = "x86_64-linux";
isos = [
"gnome"
"minimal"
];
in
{
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
packages.${system} = lib.genAttrs isos (
iso:
(lib.nixosSystem {
modules = [ (self + "/nix/t2-iso-${iso}.nix") ];
specialArgs = { inherit nixos-hardware; };
}).config.system.build.isoImage
);
};
}

View file

@ -1,4 +1,9 @@
{ pkgs, modulesPath, nixos-hardware, ... }:
{
pkgs,
modulesPath,
nixos-hardware,
...
}:
{
imports = [
@ -14,16 +19,20 @@
"t2linux.cachix.org-1:P733c5Gt1qTcxsm+Bae0renWnT8OLs0u9+yfaK2Bejw="
];
experimental-features = [ "nix-command" "flakes" ];
experimental-features = [
"nix-command"
"flakes"
];
};
environment.systemPackages = with pkgs; [
git
python3
dmg2img
(pkgs.callPackage ./pkgs/firmware-script.nix {})
(pkgs.callPackage ./pkgs/firmware-script.nix { })
];
# ZFS is (sometimes) broken and prevents building without this
nixpkgs.config.allowBroken = true;
nixpkgs.hostPlatform = "x86_64-linux"; # t2 is x86_64-linux only
}

View file

@ -1,4 +1,9 @@
{ stdenvNoCC, fetchurl, lib }: stdenvNoCC.mkDerivation (final: {
{
stdenvNoCC,
fetchurl,
lib,
}:
stdenvNoCC.mkDerivation (final: {
pname = "get-apple-firmware";
version = "fe8c338e6cf1238a390984ba06544833ab8792d3";
src = fetchurl {