From 8d5371229d6e6abbdf5b314ea579128216d0f647 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 25 May 2021 11:41:03 +0200 Subject: [PATCH] WIP podman-compose --- flake.lock | 12 +++++++----- flake.nix | 2 ++ nix/overlay.nix | 13 ++++++++++--- nix/upstreamable/default.nix | 2 +- .../testdata/Arion/NixSpec/arion-compose.json | 3 ++- src/nix/modules/composition/deployment.nix | 15 +++++++++++++++ src/nix/modules/composition/deployment/docker.nix | 12 ++++++++++++ src/nix/modules/composition/deployment/podman.nix | 11 +++++++++++ 8 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 src/nix/modules/composition/deployment.nix create mode 100644 src/nix/modules/composition/deployment/docker.nix create mode 100644 src/nix/modules/composition/deployment/podman.nix diff --git a/flake.lock b/flake.lock index 4e92b89..f534b01 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,18 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1601906239, - "narHash": "sha256-P1jBYbYeFswig/0FKbgh+BpVhh9iurD3m0T2ae4gdx8=", + "lastModified": 1621356929, + "narHash": "sha256-lD43MQ+bDFioz6eTxMmc5/tZ2nGUQ2e26CFRKp8JlF4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c2bb4af48d26ed091e5674394bacbf8d488c7939", + "rev": "6be706bbe5d892de78ce2c3b757508701ac592a6", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index d711a13..7a55dac 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,8 @@ { description = "Arion - use Docker Compose via Nix"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/master"; + outputs = { self, nixpkgs }: let lib = import (nixpkgs + "/lib"); diff --git a/nix/overlay.nix b/nix/overlay.nix index 8067c56..27f4bff 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -47,15 +47,22 @@ in haskellPkgs.cabal-install haskellPkgs.ghcid haskellPkgs.haskell-language-server - super.docker-compose - super.podman - super.podman-compose + self.docker-compose + self.podman + self.podman-compose self.niv self.releaser ]; }; }; + podman-compose = super.podman-compose.overrideAttrs(o: { + src = ~/h/podman-compose; + # patches = (o.patches or []) ++ [ + # ./podman-compose-stop_signal.patch + # ]; + }); + inherit (import (sources.niv) {}) niv; releaser = self.haskellPackages.callCabal2nix "releaser" sources.releaser {}; } diff --git a/nix/upstreamable/default.nix b/nix/upstreamable/default.nix index a06b42d..2a40905 100644 --- a/nix/upstreamable/default.nix +++ b/nix/upstreamable/default.nix @@ -57,7 +57,7 @@ let mv $out/bin/arion $out/libexec makeWrapper $out/libexec/arion $out/bin/arion \ --unset PYTHONPATH \ - --prefix PATH : ${lib.makeBinPath [ pkgs.docker-compose ]} \ + --prefix PATH : ${lib.makeBinPath [ pkgs.docker-compose pkgs.podman pkgs.podman-compose ]} \ ; ''; }; diff --git a/src/haskell/testdata/Arion/NixSpec/arion-compose.json b/src/haskell/testdata/Arion/NixSpec/arion-compose.json index 83d62fc..4d232ca 100644 --- a/src/haskell/testdata/Arion/NixSpec/arion-compose.json +++ b/src/haskell/testdata/Arion/NixSpec/arion-compose.json @@ -46,6 +46,7 @@ "-l" ] } - } + }, + "technology": "docker" } } diff --git a/src/nix/modules/composition/deployment.nix b/src/nix/modules/composition/deployment.nix new file mode 100644 index 0000000..2e484e1 --- /dev/null +++ b/src/nix/modules/composition/deployment.nix @@ -0,0 +1,15 @@ +{ config, lib, ... }: +let + inherit (lib) mkOption types; +in +{ + options = { + deployment.technology = mkOption { + description = "Which container technology to use."; + type = types.enum []; + }; + }; + config = { + docker-compose.raw.x-arion.technology = config.deployment.technology; + }; +} diff --git a/src/nix/modules/composition/deployment/docker.nix b/src/nix/modules/composition/deployment/docker.nix new file mode 100644 index 0000000..78e1ff5 --- /dev/null +++ b/src/nix/modules/composition/deployment/docker.nix @@ -0,0 +1,12 @@ +{ lib, ... }: +let + inherit (lib) mkOption types; +in +{ + options = { + deployment.technology = mkOption { + type = types.enum ["docker"]; + default = "docker"; + }; + }; +} diff --git a/src/nix/modules/composition/deployment/podman.nix b/src/nix/modules/composition/deployment/podman.nix new file mode 100644 index 0000000..4fb77f7 --- /dev/null +++ b/src/nix/modules/composition/deployment/podman.nix @@ -0,0 +1,11 @@ +{ lib, ... }: +let + inherit (lib) mkOption types; +in +{ + options = { + deployment.technology = mkOption { + type = types.enum ["podman"]; + }; + }; +}