2017-01-15 00:05:55 +00:00
|
|
|
{ nixpkgs ? <nixpkgs>
|
2024-11-08 05:38:31 +00:00
|
|
|
# Adapted from https://github.com/NixOS/nixpkgs/blob/e818264fe227ad8861e0598166cf1417297fdf54/pkgs/top-level/release.nix#L11
|
|
|
|
, nix-darwin ? { }
|
2024-10-21 00:16:49 +00:00
|
|
|
, system ? builtins.currentSystem
|
|
|
|
, supportedSystems ? [ "x86_64-darwin" "aarch64-darwin" ]
|
2017-01-15 00:05:55 +00:00
|
|
|
, scrubJobs ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2019-05-04 13:39:32 +00:00
|
|
|
buildFromConfig = configuration: sel: sel
|
|
|
|
(import ./. { inherit nixpkgs configuration system; }).config;
|
|
|
|
|
2024-11-04 02:38:11 +00:00
|
|
|
makeSystem = configuration: buildFromConfig configuration (config: config.system.build.toplevel);
|
2017-01-15 00:05:55 +00:00
|
|
|
|
2017-03-11 09:03:37 +00:00
|
|
|
makeTest = test:
|
2017-11-05 21:55:16 +00:00
|
|
|
let
|
2023-08-03 08:47:40 +00:00
|
|
|
testName =
|
|
|
|
builtins.replaceStrings [ ".nix" ] [ "" ]
|
|
|
|
(builtins.baseNameOf test);
|
|
|
|
|
2017-11-05 21:55:16 +00:00
|
|
|
configuration =
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
2018-01-14 20:08:28 +00:00
|
|
|
{
|
|
|
|
imports = [ test ];
|
2017-03-11 09:03:37 +00:00
|
|
|
|
2017-11-05 21:55:16 +00:00
|
|
|
options = {
|
|
|
|
out = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
};
|
2017-03-11 09:03:37 +00:00
|
|
|
|
2017-11-05 21:55:16 +00:00
|
|
|
test = mkOption {
|
|
|
|
type = types.lines;
|
2017-03-11 09:03:37 +00:00
|
|
|
};
|
2017-11-05 21:55:16 +00:00
|
|
|
};
|
2017-03-11 09:03:37 +00:00
|
|
|
|
2017-11-05 21:55:16 +00:00
|
|
|
config = {
|
2024-09-12 16:21:48 +00:00
|
|
|
system.stateVersion = lib.mkDefault config.system.maxStateVersion;
|
|
|
|
|
2023-08-03 08:47:40 +00:00
|
|
|
system.build.run-test = pkgs.runCommand "darwin-test-${testName}"
|
2018-01-14 20:08:28 +00:00
|
|
|
{ allowSubstitutes = false; preferLocalBuild = true; }
|
2017-11-05 21:55:16 +00:00
|
|
|
''
|
|
|
|
#! ${pkgs.stdenv.shell}
|
|
|
|
set -e
|
2017-03-11 09:03:37 +00:00
|
|
|
|
2018-01-14 20:08:28 +00:00
|
|
|
echo >&2 "running tests for system ${config.out}"
|
|
|
|
echo >&2
|
2017-11-05 21:55:16 +00:00
|
|
|
${config.test}
|
2018-01-14 20:08:28 +00:00
|
|
|
echo >&2 ok
|
2017-11-05 21:55:16 +00:00
|
|
|
touch $out
|
|
|
|
'';
|
2017-03-11 09:03:37 +00:00
|
|
|
|
2017-11-05 21:55:16 +00:00
|
|
|
out = config.system.build.toplevel;
|
2017-03-11 09:03:37 +00:00
|
|
|
};
|
2017-11-05 21:55:16 +00:00
|
|
|
};
|
|
|
|
in
|
2019-05-04 13:39:32 +00:00
|
|
|
buildFromConfig configuration (config: config.system.build.run-test);
|
2017-03-11 09:03:37 +00:00
|
|
|
|
2024-09-12 16:21:48 +00:00
|
|
|
manual = buildFromConfig ({ lib, config, ... }: {
|
|
|
|
system.stateVersion = lib.mkDefault config.system.maxStateVersion;
|
2024-11-08 05:38:31 +00:00
|
|
|
|
|
|
|
system.darwinVersionSuffix = let
|
|
|
|
shortRev = nix-darwin.shortRev or nix-darwin.dirtyShortRev or null;
|
|
|
|
in
|
|
|
|
lib.mkIf (shortRev != null) ".${shortRev}";
|
|
|
|
system.darwinRevision = let
|
|
|
|
rev = nix-darwin.rev or nix-darwin.dirtyRev or null;
|
|
|
|
in
|
|
|
|
lib.mkIf (rev != null) rev;
|
2024-09-12 16:21:48 +00:00
|
|
|
}) (config: config.system.build.manual);
|
|
|
|
|
2024-11-03 21:32:31 +00:00
|
|
|
in {
|
2024-11-03 10:52:58 +00:00
|
|
|
docs = {
|
|
|
|
inherit (manual) manualHTML manpages optionsJSON;
|
|
|
|
};
|
2024-11-03 21:32:31 +00:00
|
|
|
|
|
|
|
examples.hydra = makeSystem ./modules/examples/hydra.nix;
|
|
|
|
examples.lnl = makeSystem ./modules/examples/lnl.nix;
|
|
|
|
examples.simple = makeSystem ./modules/examples/simple.nix;
|
|
|
|
|
|
|
|
tests.activation-scripts = makeTest ./tests/activation-scripts.nix;
|
|
|
|
tests.autossh = makeTest ./tests/autossh.nix;
|
|
|
|
tests.checks-nix-gc = makeTest ./tests/checks-nix-gc.nix;
|
|
|
|
tests.environment-path = makeTest ./tests/environment-path.nix;
|
|
|
|
tests.environment-terminfo = makeTest ./tests/environment-terminfo.nix;
|
|
|
|
tests.homebrew = makeTest ./tests/homebrew.nix;
|
|
|
|
tests.launchd-daemons = makeTest ./tests/launchd-daemons.nix;
|
|
|
|
tests.launchd-setenv = makeTest ./tests/launchd-setenv.nix;
|
|
|
|
tests.networking-hostname = makeTest ./tests/networking-hostname.nix;
|
|
|
|
tests.networking-networkservices = makeTest ./tests/networking-networkservices.nix;
|
|
|
|
tests.nixpkgs-overlays = makeTest ./tests/nixpkgs-overlays.nix;
|
|
|
|
tests.programs-ssh = makeTest ./tests/programs-ssh.nix;
|
|
|
|
tests.programs-tmux = makeTest ./tests/programs-tmux.nix;
|
|
|
|
tests.programs-zsh = makeTest ./tests/programs-zsh.nix;
|
|
|
|
tests.programs-ssh-empty-known-hosts = makeTest ./tests/programs-ssh-empty-known-hosts.nix;
|
|
|
|
tests.security-pki = makeTest ./tests/security-pki.nix;
|
|
|
|
tests.services-activate-system = makeTest ./tests/services-activate-system.nix;
|
|
|
|
tests.services-activate-system-changed-label-prefix = makeTest ./tests/services-activate-system-changed-label-prefix.nix;
|
|
|
|
tests.services-buildkite-agent = makeTest ./tests/services-buildkite-agent.nix;
|
|
|
|
tests.services-github-runners = makeTest ./tests/services-github-runners.nix;
|
|
|
|
tests.services-lorri = makeTest ./tests/services-lorri.nix;
|
|
|
|
tests.services-nix-daemon = makeTest ./tests/services-nix-daemon.nix;
|
|
|
|
tests.sockets-nix-daemon = makeTest ./tests/sockets-nix-daemon.nix;
|
|
|
|
tests.services-aerospace = makeTest ./tests/services-aerospace.nix;
|
|
|
|
tests.services-dnsmasq = makeTest ./tests/services-dnsmasq.nix;
|
|
|
|
tests.services-eternal-terminal = makeTest ./tests/services-eternal-terminal.nix;
|
|
|
|
tests.services-nix-gc = makeTest ./tests/services-nix-gc.nix;
|
|
|
|
tests.services-nix-optimise = makeTest ./tests/services-nix-optimise.nix;
|
|
|
|
tests.services-nextdns = makeTest ./tests/services-nextdns.nix;
|
|
|
|
tests.services-netdata = makeTest ./tests/services-netdata.nix;
|
|
|
|
tests.services-ofborg = makeTest ./tests/services-ofborg.nix;
|
|
|
|
tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix;
|
|
|
|
tests.services-privoxy = makeTest ./tests/services-privoxy.nix;
|
|
|
|
tests.services-redis = makeTest ./tests/services-redis.nix;
|
|
|
|
tests.services-skhd = makeTest ./tests/services-skhd.nix;
|
|
|
|
tests.services-spacebar = makeTest ./tests/services-spacebar.nix;
|
|
|
|
tests.services-spotifyd = makeTest ./tests/services-spotifyd.nix;
|
|
|
|
tests.services-synapse-bt = makeTest ./tests/services-synapse-bt.nix;
|
|
|
|
tests.services-synergy = makeTest ./tests/services-synergy.nix;
|
|
|
|
tests.services-yabai = makeTest ./tests/services-yabai.nix;
|
|
|
|
tests.services-jankyborders = makeTest ./tests/services-jankyborders.nix;
|
|
|
|
tests.system-defaults-write = makeTest ./tests/system-defaults-write.nix;
|
|
|
|
tests.system-environment = makeTest ./tests/system-environment.nix;
|
|
|
|
tests.system-keyboard-mapping = makeTest ./tests/system-keyboard-mapping.nix;
|
|
|
|
tests.system-packages = makeTest ./tests/system-packages.nix;
|
|
|
|
tests.system-path = makeTest ./tests/system-path.nix;
|
|
|
|
tests.system-shells = makeTest ./tests/system-shells.nix;
|
|
|
|
tests.users-groups = makeTest ./tests/users-groups.nix;
|
|
|
|
tests.users-packages = makeTest ./tests/users-packages.nix;
|
|
|
|
tests.fonts = makeTest ./tests/fonts.nix;
|
|
|
|
}
|