this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 137 lines 6.3 kB view raw
1{ 2 description = "Darling - macOS compatibility layer for Linux"; 3 4 inputs = { 5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 flakelight = { 7 url = "github:nix-community/flakelight"; 8 inputs.nixpkgs.follows = "nixpkgs"; 9 }; 10 }; 11 12 outputs = 13 { flakelight, ... }@inputs: 14 flakelight ./. { 15 inherit inputs; 16 17 systems = [ "x86_64-linux" ]; 18 19 pname = "darling"; 20 21 # Disable builtin formatters — the repo has 100+ submodules with 22 # broken symlinks when not checked out, which causes the formatting 23 # check to fail on `diff` of missing files. 24 flakelight.builtinFormatters = false; 25 26 # Default package is autoloaded from ./nix/package.nix 27 # Default devShell is autoloaded from ./nix/devShell.nix 28 # NixOS module is autoloaded from ./nix/nixosModule.nix 29 30 packages.darling-sdk = pkgs: pkgs.darling.sdk; 31 32 # ── Flake Templates ────────────────────────────────────────────── 33 # 34 # Initialise a new project with: 35 # nix flake init -t github:nixie-dev/darling-nix#darling-builder 36 # 37 # See: docs/darwin-builder.md, plan/09-phase7-remote-builder.md (Task 7.7) 38 templates.darling-builder = { 39 path = ./templates/darling-builder; 40 description = "NixOS configuration with a Darling-based x86_64-darwin remote builder"; 41 }; 42 43 # ── NixOS Modules ──────────────────────────────────────────────── 44 # 45 # The base module (programs.darling) is autoloaded from 46 # ./nix/nixosModule.nix by flakelight. 47 # 48 # The darling-builder module (services.darling-builder) is exported 49 # separately so users can import it alongside the base module. 50 # 51 # Usage in a NixOS configuration: 52 # { 53 # imports = [ 54 # darling-nix.nixosModules.nixos # programs.darling 55 # darling-nix.nixosModules.darling-builder # services.darling-builder 56 # ]; 57 # services.darling-builder.enable = true; 58 # } 59 nixosModules.darling-builder = import ./nix/darlingBuilderModule.nix; 60 61 # ── Checks (Phase 6.2) ─────────────────────────────────────────── 62 # 63 # NixOS VM integration tests and lightweight validation checks. 64 # Run with: 65 # nix flake check # all checks 66 # nix build .#checks.x86_64-linux.darling-smoke -L 67 # nix build .#checks.x86_64-linux.nix-in-darling -L 68 # nix build .#checks.x86_64-linux.darling-builder -L 69 # 70 # See: plan/08-phase6-ci.md (Tasks 6.1, 6.2) 71 # plan/09-phase7-remote-builder.md (Task 7.5) 72 checks = pkgs: 73 let 74 darling = pkgs.darling; 75 darlingBuilderModule = import ./nix/darlingBuilderModule.nix; 76 in 77 { 78 # ── Build check ───────────────────────────────────────────────── 79 # Ensure the package builds successfully. This is redundant with 80 # `packages.default` but makes `nix flake check` self-contained. 81 darling-build = darling; 82 83 # ── Darling smoke test (Phase 6.6) ────────────────────────────── 84 # Lightweight NixOS VM test: boots Darling, verifies shell, 85 # sandbox-exec, diskutil, and Directory Services stubs. 86 # No network access required — completes in a few minutes. 87 darling-smoke = import ./tests/darling-smoke.nix { 88 inherit pkgs darling; 89 }; 90 91 # ── Nix-in-Darling integration test (Phase 6.1) ──────────────── 92 # Full end-to-end test: installs Nix inside Darling, verifies 93 # core commands, evaluator, currentSystem, and trivial builds. 94 # Requires network access (downloads Nix installer + store paths). 95 nix-in-darling = import ./tests/nix-in-darling.nix { 96 inherit pkgs darling; 97 }; 98 99 # ── Darling builder test (Phase 7.5) ──────────────────────────── 100 # NixOS VM test for the remote builder module: verifies the 101 # systemd service starts, sshd inside the prefix is reachable, 102 # SSH key auth works, and Darling identity is correct via SSH. 103 darling-builder = import ./tests/darling-builder.nix { 104 inherit pkgs darling darlingBuilderModule; 105 }; 106 107 # ── Directory Services stubs unit test ────────────────────────── 108 # Runs the shell-based test suite for dseditgroup, sysadminctl, 109 # and dscl stubs on the host (no Darling needed — pure shell). 110 dirserv-stubs = pkgs.runCommandLocal "dirserv-stubs-test" { 111 nativeBuildInputs = with pkgs; [ 112 coreutils 113 gawk 114 gnugrep 115 gnused 116 findutils 117 ]; 118 } '' 119 # The test script uses sed to rewrite /etc/passwd and /etc/group 120 # paths to temp files, so it's safe to run outside Darling. 121 # We create a directory layout that matches what the test expects: 122 # <workdir>/tests/dirserv/test_dirserv.sh 123 # <workdir>/src/dirserv/{dseditgroup,sysadminctl,dscl} 124 workdir=$(mktemp -d) 125 mkdir -p "$workdir/tests/dirserv" "$workdir/src/dirserv" 126 cp ${./tests/dirserv/test_dirserv.sh} "$workdir/tests/dirserv/test_dirserv.sh" 127 cp ${./src/dirserv/dseditgroup} "$workdir/src/dirserv/dseditgroup" 128 cp ${./src/dirserv/sysadminctl} "$workdir/src/dirserv/sysadminctl" 129 cp ${./src/dirserv/dscl} "$workdir/src/dirserv/dscl" 130 chmod +x "$workdir/src/dirserv"/* 131 export HOME=$(mktemp -d) 132 sh "$workdir/tests/dirserv/test_dirserv.sh" 133 touch $out 134 ''; 135 }; 136 }; 137}