Compare commits

..

7 commits

Author SHA1 Message Date
ec4f2a836d
Add profiles 2024-10-01 16:23:38 +02:00
hercules-ci[bot]
90bc855327
Merge pull request from hercules-ci/flake-update
`flake.lock`: Update
2024-08-05 02:44:33 +00:00
Hercules CI Effects
16c4d4d8b8 flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03)
  → 'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d' (2024-08-01)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6' (2024-07-03)
  → 'github:NixOS/nixpkgs/d04953086551086b44b6f3c6b7eeb26294f207da' (2024-08-02)
2024-08-05 02:38:38 +00:00
hercules-ci[bot]
236f9dd82d
Merge pull request from hercules-ci/flake-update
`flake.lock`: Update
2024-07-05 02:50:08 +00:00
Hercules CI Effects
ab9bdaf08f flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01)
  → 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03)
• Updated input 'hercules-ci-effects':
    'github:hercules-ci/hercules-ci-effects/c0302ec12d569532a6b6bd218f698bc402e93adc' (2024-04-23)
  → 'github:hercules-ci/hercules-ci-effects/11e4b8dc112e2f485d7c97e1cee77f9958f498f5' (2024-06-24)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/57610d2f8f0937f39dbd72251e9614b1561942d8' (2024-05-31)
  → 'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6' (2024-07-03)
2024-07-05 02:38:52 +00:00
Robert Hensing
555e7ba634
Merge pull request from tomeon/remove-defaultPackage
chore(flake): remove `defaultPackage` output
2024-06-26 13:17:50 +02:00
Matt Schreiber
7e7aa3dfc6
chore(flake): remove defaultPackage output
Follow-up to .
2024-04-28 20:35:20 -04:00
7 changed files with 29 additions and 96 deletions

18
flake.lock generated
View file

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
@ -64,11 +64,11 @@
]
},
"locked": {
"lastModified": 1713898448,
"narHash": "sha256-6q6ojsp/Z9P2goqnxyfCSzFOD92T3Uobmj8oVAicUOs=",
"lastModified": 1719226092,
"narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=",
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"rev": "c0302ec12d569532a6b6bd218f698bc402e93adc",
"rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5",
"type": "github"
},
"original": {
@ -79,11 +79,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1717196966,
"narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=",
"lastModified": 1722630782,
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "57610d2f8f0937f39dbd72251e9614b1561942d8",
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
"type": "github"
},
"original": {

View file

@ -86,12 +86,6 @@
flake = {
debug = { inherit inputs config lib; };
defaultPackage =
lib.mapAttrs
(_system: ps: lib.warn "arion.defaultPackage has been removed in favor of arion.packages.\${system}.default"
ps.default)
config.flake.packages;
lib = {
eval = import ./src/nix/eval-composition.nix;
build = args@{ ... }:

View file

@ -42,22 +42,10 @@ let
cfg.docker.client.package
];
environment.ARION_PREBUILT = config.settings.out.dockerComposeYaml;
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
serviceConfig.ExecStart = [
(lib.getExe (pkgs.writeScriptBin "nixos-arion-start" ''
#!${pkgs.runtimeShell}
echo 1>&2 "starting arion project: $ARION_PREBUILT"
arion --prebuilt-file "$ARION_PREBUILT" up --detach
''))
];
serviceConfig.ExecStop = [
(lib.getExe (pkgs.writeScriptBin "nixos-arion-stop" ''
#!${pkgs.runtimeShell}
echo 1>&2 "stopping arion project: $ARION_PREBUILT"
arion --prebuilt-file "$ARION_PREBUILT" down
''))
];
script = ''
echo 1>&2 "docker compose file: $ARION_PREBUILT"
arion --prebuilt-file "$ARION_PREBUILT" up
'';
};
};
};

View file

@ -210,6 +210,11 @@ in
default = [];
description = serviceRef "external_links";
};
service.profiles = mkOption {
type = listOf str;
default = [];
description = serviceRef "profiles";
};
service.extra_hosts = mkOption {
type = listOf str;
default = [];
@ -411,5 +416,7 @@ in
inherit (config.service) working_dir;
} // lib.optionalAttrs (config.service.user != null) {
inherit (config.service) user;
} // lib.optionalAttrs (config.service.profiles != []) {
inherit (config.service) profiles;
};
}

View file

@ -13,10 +13,10 @@
};
# Currently broken; kafka can't reach zookeeper
nixosModuleWithPodman =
import ./nixos-virtualization-arion-test/test.nix final {
virtualisation.arion.backend = "podman-socket";
};
# nixosModuleWithPodman =
# import ./nixos-virtualization-arion-test/test.nix final {
# virtualisation.arion.backend = "podman-socket";
# };
testWithPodman =
nixosTest (import ./arion-test { usePodman = true; pkgs = final; });

View file

@ -1,4 +1,4 @@
{ lib, pkgs, ... }: {
{ pkgs, ... }: {
project.name = "whale";
docker-compose.raw = {
@ -59,28 +59,4 @@
"start-foreground"
];
};
services.stop-probe = {
image.command = [
(lib.getExe (pkgs.writeScriptBin "stop-probe" ''
#!${pkgs.runtimeShell}
touch /diagnostics/stop-probe-started
onSIGTERM() {
echo "Handling SIGTERM"
touch /diagnostics/stop-probe-terminated-cleanly
echo "Bye!"
}
echo "Registering SIGTERM handler"
trap onSIGTERM SIGTERM
sleep 3600
''))
];
service.useHostStore = true;
service.volumes = [
"/tmp/shared:/diagnostics"
];
service.environment = {
"PATH" = lib.makeBinPath [ pkgs.busybox ];
};
};
}

View file

@ -1,6 +1,6 @@
pkgs: module:
pkgs.testers.runNixOSTest ({ lib, ... }:{
pkgs.nixosTest {
name = "test-basic-arion-kafka";
nodes = {
machine = { ... }: {
@ -16,13 +16,10 @@ pkgs.testers.runNixOSTest ({ lib, ... }:{
};
};
};
testScript = { nodes, ... }: ''
testScript = ''
machine.wait_for_unit("sockets.target")
machine.wait_for_unit("arion-whale.service")
${# TODO: make the kafka service work on podman-socket; some networking issue
lib.optionalString (nodes.machine.virtualisation.arion.backend != "podman-socket") ''
machine.succeed("""
(echo "hello"; echo "world") \
| ${pkgs.apacheKafka}/bin/kafka-console-producer.sh \
@ -38,35 +35,6 @@ pkgs.testers.runNixOSTest ({ lib, ... }:{
) | grep --line-buffered hello | { read; kill $(<pid); rm pid; }
) 2>/dev/console
""")
# make sure logs were captured
machine.succeed("""
# Check that messages were logged with field "CONTAINER_NAME" set to "whale-zookeeper-1"
journalctl --output json | ${pkgs.jq}/bin/jq 'select(.CONTAINER_NAME=="whale-zookeeper-1") | .MESSAGE' | grep -F 'org.apache.zookeeper'
""")
''}
machine.wait_until_succeeds("""
journalctl --grep 'Registering SIGTERM handler' >/dev/null
""")
# explore the shared mounts, as they're undocumented
machine.succeed("""
mount >&2
touch /tmp/xchg/this-is-xchg
touch /tmp/shared/this-is-shared
""")
machine.shutdown()
# show what's in machine.shared_dir by running `ls` on the host
dir = machine.shared_dir
import os
print(f'Contents of {dir}:')
os.system(f'ls -l {dir}')
# dir/stop-probe-terminated-cleanly must exist
assert os.path.exists(f'{dir}/stop-probe-terminated-cleanly'), f'{dir}/stop-probe-terminated-cleanly does not exist'
'';
})
}