CCE

Arroyo System Flake Generator

Contents

This file generates the flake.nix for the Arroyo system. Host definitions come from ARROYO_OUTPUT keywords — each host heading in morph.org (or any org file) produces a nixosSystem declaration via <<host-modules("role")>>. The flake concatenates all ARROYO_OUTPUT files via <<arroyo_outputs()>>.

flake.nix

nix:tangle ~/nix/flake.nix:noweb yes
{
  description = "Arroyo System Flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
    <<arroyo_inputs()>>
  };

  outputs = { self, nixpkgs, ... }@inputs:
    let
      mkHost = { name, roleModules, homeManager ? true, extraModules ? [], extraSpecialArgs ? {}, system ? "x86_64-linux" }:
        nixpkgs.lib.nixosSystem {
          inherit system;
          specialArgs = { inherit inputs; inherit system; inherit self; } // extraSpecialArgs;
          modules = roleModules ++ [
            {
              nixpkgs.config.allowUnfree = true;
              nixpkgs.config.permittedInsecurePackages = ["olm-3.2.16"];
              nixpkgs.config.problems.handlers = {
                # modus-themes.broken = "warn"; # or "ignore"
              };
              nixpkgs.overlays = [
                <<arroyo_system_overlays()>>
              ];
            }
          ] ++ (if homeManager then [ inputs.home-manager.nixosModules.home-manager ] else []) ++ extraModules ++ [
            ./hosts/${name}
          ];
        };
    in {
      <<arroyo_outputs()>>

      # homeConfigurations = let
      #   cfg = pkgs.callPackage ./home-manager.nix {};
      # in {
      #   rrix = inputs.home-manager.nixosConfigurations.rrix cfg;
      # };
    };
}

Flake Inputs

arroyo.inputs() queries the DB for ARROYO_INPUT entries and returns the file contents of each input file (paths resolved relative to ~/nix/). The contents are concatenated directly into the flake's inputs block.

lua#+name: arroyo_inputs:eval arroyo:results raw
local inputs = arroyo.inputs()
return table.concat(inputs, "\n        ")

Host Outputs

arroyo.outputs() queries the DB for ARROYO_OUTPUT entries and returns the file contents of each output file (paths resolved relative to ~/nix/). Each file is a nixosSystem declaration produced by a host heading. The contents are concatenated directly into nixosConfigurations.

lua#+name: arroyo_outputs:eval arroyo:results raw
local outputs = arroyo.outputs()
return table.concat(outputs, "\n    ")

System Overlays

arroyo.system_overlays() queries the DB for ARROYO_SYSTEM_OVERLAY entries and returns the file contents of each overlay (paths resolved relative to ~/nix/). The contents are concatenated directly into the flake's overlay list.

lua#+name: arroyo_system_overlays:eval arroyo:results raw
local overlays = arroyo.system_overlays()
return table.concat(overlays, "\n        ")