From 56f5c5d5a0f44384cee965604f7cfe820466c410 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 9 Mar 2022 23:51:17 +0100 Subject: [PATCH 01/11] arion-compose.cabal: Loosen base constraint --- arion-compose.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arion-compose.cabal b/arion-compose.cabal index 2437373..3aa58b0 100644 --- a/arion-compose.cabal +++ b/arion-compose.cabal @@ -29,7 +29,7 @@ source-repository head location: https://github.com/hercules-ci/arion common common - build-depends: base >=4.12.0.0 && <4.15 + build-depends: base >=4.12.0.0 && <4.17 , aeson , aeson-pretty , async From 72efe2145d4c3eb767b97a355d8939693f8071ff Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 7 Apr 2022 22:20:31 +0200 Subject: [PATCH 02/11] Update nixos-unstable --- nix/sources.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index 116fd19..f900cdd 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -41,10 +41,10 @@ "homepage": "https://github.com/NixOS/nixpkgs", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f8232491252438cd70b93554e31fe8238a573636", - "sha256": "019bz8dxp9d30ghmi9v0inn0p7mj3mia69lkh5cyivhhp1i0cs5i", + "rev": "55e580b86dd4402fbc2a6793bba6dcf40c56652c", + "sha256": "0jnn3ilwxycmqpgjc50g9qcl4z52jnjs70zirxl8cgk3yip3skmw", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/f8232491252438cd70b93554e31fe8238a573636.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/55e580b86dd4402fbc2a6793bba6dcf40c56652c.tar.gz", "url_template": "https://github.com///archive/.tar.gz", "version": "" }, From baa515d88ee41e60fd041afe58871e8c5581121b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 7 Apr 2022 22:55:22 +0200 Subject: [PATCH 03/11] Fix warnings --- src/nix/eval-composition.nix | 2 +- tests/arion-test/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nix/eval-composition.nix b/src/nix/eval-composition.nix index e76d7e5..db8b55c 100644 --- a/src/nix/eval-composition.nix +++ b/src/nix/eval-composition.nix @@ -12,7 +12,6 @@ let inherit (pkgs) lib; composition = lib.evalModules { - check = true; modules = builtinModules ++ modules; }; @@ -24,6 +23,7 @@ let _file = ./eval-composition.nix; key = ./eval-composition.nix; config._module.args.pkgs = lib.mkIf (pkgs != null) (lib.mkForce pkgs); + config._module.args.check = true; config.host.nixStorePrefix = hostNixStorePrefix; config.host.uid = lib.toInt uid; }; diff --git a/tests/arion-test/default.nix b/tests/arion-test/default.nix index fa87ed2..9c7a14a 100644 --- a/tests/arion-test/default.nix +++ b/tests/arion-test/default.nix @@ -20,7 +20,7 @@ let in { name = "arion-test"; - machine = { pkgs, lib, ... }: { + nodes.machine = { pkgs, lib, ... }: { environment.systemPackages = [ pkgs.arion ] ++ lib.optional usePodman pkgs.docker; From ad9e5643086a767618b18d0df7ced07985b7d0dc Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:01:25 +0200 Subject: [PATCH 04/11] optionsAsciiDoc is a file now --- docs/options.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/options.nix b/docs/options.nix index b4c2a8f..d78b4c1 100644 --- a/docs/options.nix +++ b/docs/options.nix @@ -8,10 +8,12 @@ let options = eval.options; }; -in (pkgs.writeText "agent-options" '' +in (pkgs.runCommand "agent-options.adoc" { } '' + cat >$out <>$out '').overrideAttrs (o: { # Work around https://github.com/hercules-ci/hercules-ci-agent/issues/168 allowSubstitutes = true; From cb0d5ed7fd5ee92f2911697730dc02459af883b3 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:02:09 +0200 Subject: [PATCH 05/11] antora in nixpkgs is currently broken --- nix/ci.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/ci.nix b/nix/ci.nix index 58e62e4..d545ef6 100644 --- a/nix/ci.nix +++ b/nix/ci.nix @@ -41,7 +41,10 @@ dimension "Nixpkgs version" { } // lib.optionalAttrs enableNixOSTests { inherit (pkgs) tests; } // lib.optionalAttrs enableDoc { - inherit (pkgs) doc doc-options doc-options-check; + inherit (pkgs) + # FIXME: nixpkgs antora packaging is broken + # doc + doc-options doc-options-check; } // lib.optionalAttrs isReferenceTarget { inherit (pkgs.arion-project.haskellPkgs) arion-compose-checked; } From 161ee3aaf9f902e41cbbce3e779fc4a130281269 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:02:37 +0200 Subject: [PATCH 06/11] Avoid rebuilds with sourceByRegex Awful function, but it works. --- nix/haskell-arion-compose.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix/haskell-arion-compose.nix b/nix/haskell-arion-compose.nix index 239d476..3b95767 100644 --- a/nix/haskell-arion-compose.nix +++ b/nix/haskell-arion-compose.nix @@ -6,6 +6,12 @@ let inherit (pkgs.haskell.lib) overrideCabal addBuildTools; in overrideCabal (addBuildTools (haskellPackages.callCabal2nix "arion-compose" ./.. {}) [pkgs.nix]) (o: o // { + src = pkgs.lib.sourceByRegex ../. [ + ".*[.]cabal" + "LICENSE" + "src/?.*" + "README.asciidoc" + ]; preCheck = '' export NIX_LOG_DIR=$TMPDIR export NIX_STATE_DIR=$TMPDIR From 2c10b297ad0144f1500e6914408e15b38a8ccaed Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:03:13 +0200 Subject: [PATCH 07/11] Disable _module.args docs --- nix/sources.json | 10 +++++----- src/nix/modules/composition/composition.nix | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index f900cdd..d73c3d0 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -36,15 +36,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixos-unstable": { - "branch": "master", + "branch": "lib-modules-allow-disable-_modules.args-docs-internal", "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", "homepage": "https://github.com/NixOS/nixpkgs", - "owner": "NixOS", + "owner": "hercules-ci", "repo": "nixpkgs", - "rev": "55e580b86dd4402fbc2a6793bba6dcf40c56652c", - "sha256": "0jnn3ilwxycmqpgjc50g9qcl4z52jnjs70zirxl8cgk3yip3skmw", + "rev": "35f40b20607428901e8edace7d4643d4ac11e876", + "sha256": "0w1ivhzszggq2j4fxbhdppvzj07zkginfnqdpkl6mdzvpwhy8f0d", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/55e580b86dd4402fbc2a6793bba6dcf40c56652c.tar.gz", + "url": "https://github.com/hercules-ci/nixpkgs/archive/35f40b20607428901e8edace7d4643d4ac11e876.tar.gz", "url_template": "https://github.com///archive/.tar.gz", "version": "" }, diff --git a/src/nix/modules/composition/composition.nix b/src/nix/modules/composition/composition.nix index fa46617..37d2854 100644 --- a/src/nix/modules/composition/composition.nix +++ b/src/nix/modules/composition/composition.nix @@ -8,6 +8,9 @@ let in { options = { + _module.args = mkOption { + internal = true; + }; project.name = mkOption { description = '' Name of the project. From 83bc14fba8fe85db476954da697499c132e3d5c9 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:03:31 +0200 Subject: [PATCH 08/11] nixosTest invocation got stricter --- tests/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/default.nix b/tests/default.nix index 978585e..70012ac 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -30,7 +30,7 @@ recurseIntoAttrs { testWithPodman = if arionTestingFlags.nixosHasPodmanDockerSocket - then nixosTest (pkgs.callPackage ./arion-test { usePodman = true; }) + then nixosTest (import ./arion-test { usePodman = true; inherit pkgs lib; }) else {}; testBuild = arion.build { From fbb56568e932ecfbcc9f8bc6a241a3d9c8c858d2 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:03:45 +0200 Subject: [PATCH 09/11] podman now expects localhost/ in name --- tests/nixos-virtualization-arion-test/arion-compose.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/nixos-virtualization-arion-test/arion-compose.nix b/tests/nixos-virtualization-arion-test/arion-compose.nix index 1965fa6..bf18d0e 100644 --- a/tests/nixos-virtualization-arion-test/arion-compose.nix +++ b/tests/nixos-virtualization-arion-test/arion-compose.nix @@ -18,6 +18,7 @@ # ]; service.ports = [ "9092:9092" ]; service.depends_on = [ "zookeeper" ]; + image.name = "localhost/kafka"; image.contents = [ (pkgs.runCommand "root" { } '' mkdir -p $out/bin @@ -41,6 +42,7 @@ # # volume.nocopy = true; # } # ]; + image.name = "localhost/zookeeper"; image.contents = [ (pkgs.buildEnv { name = "root"; From 40fd74e71f50ecace5af88cc35a3165ca1aba742 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 8 Apr 2022 00:04:13 +0200 Subject: [PATCH 10/11] zookeeper ships with an appropriate java now --- tests/nixos-virtualization-arion-test/arion-compose.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/nixos-virtualization-arion-test/arion-compose.nix b/tests/nixos-virtualization-arion-test/arion-compose.nix index bf18d0e..4597f81 100644 --- a/tests/nixos-virtualization-arion-test/arion-compose.nix +++ b/tests/nixos-virtualization-arion-test/arion-compose.nix @@ -53,7 +53,7 @@ }) ]; image.command = [ - "${pkgs.zookeeper.override { jre = pkgs.jdk8_headless; }}/bin/zkServer.sh" + "${pkgs.zookeeper}/bin/zkServer.sh" "--config" "${./zookeeper}" "start-foreground" From 0ee76740d0985989a49603894059c8131ada74ef Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 23 Apr 2022 23:09:54 +0200 Subject: [PATCH 11/11] image.name: Default to localhost/$name --- docs/modules/ROOT/partials/NixOSOptions.adoc | 2 +- src/haskell/lib/Arion/Images.hs | 3 ++- src/haskell/testdata/Arion/NixSpec/arion-compose.json | 4 ++-- src/nix/modules/service/image.nix | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/modules/ROOT/partials/NixOSOptions.adoc b/docs/modules/ROOT/partials/NixOSOptions.adoc index 14efd31..3ba49a3 100644 --- a/docs/modules/ROOT/partials/NixOSOptions.adoc +++ b/docs/modules/ROOT/partials/NixOSOptions.adoc @@ -233,7 +233,7 @@ Type:: string Default:: + ---- -{"_type":"literalExpression","text":"config.service.name"} +{"_type":"literalExpression","text":"\"localhost/\" + config.service.name"} ---- diff --git a/src/haskell/lib/Arion/Images.hs b/src/haskell/lib/Arion/Images.hs index da2ad3c..9869d33 100644 --- a/src/haskell/lib/Arion/Images.hs +++ b/src/haskell/lib/Arion/Images.hs @@ -25,7 +25,8 @@ loadImages requestedImages = do isNew i = -- On docker, the image name is unmodified (imageName i <> ":" <> imageTag i) `notElem` loaded - -- -- On podman, you automatically get a localhost prefix + -- On podman, you used to automatically get a localhost prefix + -- however, since NixOS 22.05, this expected to be part of the name instead && ("localhost/" <> imageName i <> ":" <> imageTag i) `notElem` loaded traverse_ loadImage . filter isNew $ requestedImages diff --git a/src/haskell/testdata/Arion/NixSpec/arion-compose.json b/src/haskell/testdata/Arion/NixSpec/arion-compose.json index 83d62fc..972db6f 100644 --- a/src/haskell/testdata/Arion/NixSpec/arion-compose.json +++ b/src/haskell/testdata/Arion/NixSpec/arion-compose.json @@ -9,7 +9,7 @@ "PATH": "/usr/bin:/run/current-system/sw/bin/", "container": "docker" }, - "image": "webserver:", + "image": "localhost/webserver:", "ports": [ "8000:80" ], @@ -32,7 +32,7 @@ "images": [ { "imageExe": "", - "imageName": "webserver", + "imageName": "localhost/webserver", "imageTag": "" } ], diff --git a/src/nix/modules/service/image.nix b/src/nix/modules/service/image.nix index 1f1e755..8700396 100644 --- a/src/nix/modules/service/image.nix +++ b/src/nix/modules/service/image.nix @@ -104,8 +104,8 @@ in }; image.name = mkOption { type = str; - default = config.service.name; - defaultText = lib.literalExpression or lib.literalExample "config.service.name"; + default = "localhost/" + config.service.name; + defaultText = lib.literalExpression or lib.literalExample ''"localhost/" + config.service.name''; description = '' A human readable name for the docker image.