Skip to content

Commit b438004

Browse files
committed
refactor: derive install ISOs from discovered hosts; drop nix/pkgs
Emit one <host>-install-iso per host via an adios-flake perSystem block that discovers hosts from self.nixosConfigurations, skipping non-native systems. Drop the overlay aggregator and nix/pkgs tree; local packages are now red-tape packages/ convention files.
1 parent 7422505 commit b438004

14 files changed

Lines changed: 305 additions & 308 deletions

File tree

flake.nix

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,31 @@
3535
};
3636

3737
outputs = inputs@{ self, red-tape, ... }:
38-
let
39-
mkInstallerForSystem = { hostname, targetConfiguration }:
40-
(inputs.nixpkgs.lib.nixosSystem {
41-
specialArgs = {
42-
flake = self;
43-
inherit inputs targetConfiguration;
44-
hostName = hostname;
45-
};
46-
modules = [ ./nix/installer/configuration.nix ];
47-
}).config.system.build.isoImage;
48-
49-
installerPackages = builtins.foldl'
50-
(packages: hostname:
51-
let
52-
targetConfiguration = self.nixosConfigurations.${hostname};
53-
inherit (targetConfiguration.config.nixpkgs.hostPlatform) system;
54-
in
55-
packages // {
56-
${system} = (packages.${system} or { }) // {
57-
"${hostname}-install-iso" = mkInstallerForSystem { inherit hostname targetConfiguration; };
58-
};
59-
})
60-
{ }
61-
(builtins.attrNames self.nixosConfigurations);
62-
in
6338
red-tape.mkFlake {
6439
inherit inputs self;
6540
src = ./.;
6641
prefix = "nix";
6742
systems = [ "x86_64-linux" "aarch64-linux" ];
6843

44+
perSystem = { system, ... }: {
45+
packages = builtins.listToAttrs (
46+
builtins.concatMap
47+
(hostName:
48+
let host = self.nixosConfigurations.${hostName};
49+
in
50+
if host.config.nixpkgs.hostPlatform.system == system then [{
51+
name = "${hostName}-install-iso";
52+
value = import ./nix/installer/iso.nix {
53+
inherit inputs hostName;
54+
flake = self;
55+
};
56+
}] else [ ])
57+
(builtins.attrNames self.nixosConfigurations)
58+
);
59+
};
60+
6961
flake = {
7062
overlays = import ./nix/overlays { inherit inputs; outputs = self; };
71-
packages = installerPackages;
7263
};
7364
};
7465
}

nix/hosts/features/required/default.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, inputs, hostName, ... }:
1+
{ pkgs, inputs, hostName, flake, ... }:
22

33
{
44
imports = [
@@ -29,9 +29,9 @@
2929
../../../users/rodrigo
3030
];
3131

32-
environment.systemPackages = with pkgs; [
33-
host-scripts
34-
ossystems-tools
32+
environment.systemPackages = [
33+
flake.packages.${pkgs.system}.host-scripts
34+
flake.packages.${pkgs.system}.ossystems-tools
3535
];
3636

3737
networking.hostName = hostName;

nix/hosts/hyper/configuration.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
{ inputs, pkgs, ... }:
1+
{ inputs, pkgs, flake, ... }:
22

3+
let
4+
inherit (flake.packages.${pkgs.system}) bitbake_2_8_0 bitbake_2_10_0;
5+
in
36
{
47
imports = with inputs.nixos-hardware.nixosModules; [
58
common-cpu-intel
@@ -55,12 +58,12 @@
5558
enable = true;
5659
versions = {
5760
"scarthgap" = {
58-
package = pkgs.bitbakePackages.bitbake_2_8_0;
61+
package = bitbake_2_8_0;
5962
hashServPort = 8686;
6063
prServPort = 8685;
6164
};
6265
"styhead" = {
63-
package = pkgs.bitbakePackages.bitbake_2_10_0;
66+
package = bitbake_2_10_0;
6467
hashServPort = 8786;
6568
prServPort = 8785;
6669
};

nix/installer/iso.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{ inputs, flake, hostName }:
2+
3+
let
4+
inherit (inputs.nixpkgs) lib;
5+
6+
targetConfiguration = flake.nixosConfigurations.${hostName};
7+
inherit (targetConfiguration.config.nixpkgs.hostPlatform) system;
8+
9+
iso = (lib.nixosSystem {
10+
specialArgs = {
11+
inherit flake inputs targetConfiguration hostName;
12+
};
13+
modules = [ ./configuration.nix ];
14+
}).config.system.build.isoImage;
15+
in
16+
lib.addMetaAttrs { platforms = [ system ]; } iso

nix/overlays/default.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
_:
22

33
{
4-
additions = final: _: import ../pkgs { pkgs = final; };
5-
64
modifications = _: prev: {
75
fzf = prev.fzf.overrideAttrs (oa: {
86
# https://github.com/NixOS/nixpkgs/pull/226847

nix/packages/bitbake/builder.nix

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{ lib
2+
, nix-update-script
3+
, python3
4+
, fetchFromGitHub
5+
, version
6+
, hash
7+
}:
8+
9+
python3.pkgs.buildPythonApplication {
10+
pname = "bitbake";
11+
inherit version;
12+
pyproject = false;
13+
14+
src = fetchFromGitHub {
15+
owner = "openembedded";
16+
repo = "bitbake";
17+
rev = version;
18+
inherit hash;
19+
};
20+
21+
passthru.updateScript = nix-update-script { };
22+
23+
installPhase = ''
24+
mkdir -p $out/lib
25+
cp -r $src/lib $out
26+
cp -r $src/bin $out
27+
'';
28+
29+
meta = {
30+
description = "Bitbake";
31+
mainProgram = "bitbake";
32+
homepage = "https://github.com/openembedded/bitbake";
33+
license = lib.licenses.gpl2;
34+
maintainers = [ lib.maintainers.otavio ];
35+
};
36+
}

nix/packages/bitbake_2_10_0.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{ pkgs, ... }:
2+
3+
pkgs.callPackage ./bitbake/builder.nix {
4+
version = "2.10.0";
5+
hash = "sha256-FyC9tJTToY42526WUtjxY5DTLO19PkuJjtlwdhIvNEA=";
6+
}

nix/packages/bitbake_2_8_0.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{ pkgs, ... }:
2+
3+
pkgs.callPackage ./bitbake/builder.nix {
4+
version = "2.8.0";
5+
hash = "sha256-wrI+SaS3g15i8EyR76CN8ZNKtVm9+TefUMP1/8Avx64=";
6+
}

nix/packages/host-scripts.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
{ pkgs, ... }:
22

3-
pkgs.callPackage ../pkgs/host-scripts { }
3+
pkgs.callPackage
4+
({ stdenv }:
5+
stdenv.mkDerivation {
6+
name = "host-scripts";
7+
src = ../../scripts;
8+
installPhase = ''
9+
mkdir -p $out/bin
10+
cp -r * $out/bin
11+
'';
12+
})
13+
{ }

0 commit comments

Comments
 (0)