2020-10-05 17:22:15 +03:00
|
|
|
{
|
|
|
|
description = "Arion - use Docker Compose via Nix";
|
|
|
|
|
2022-12-02 02:21:38 +03:00
|
|
|
inputs = {
|
2023-01-13 20:06:55 +03:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2023-02-17 01:28:30 +03:00
|
|
|
haskell-flake.url = "github:srid/haskell-flake/0.1.0";
|
2023-01-04 19:08:00 +03:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
2022-12-02 02:21:38 +03:00
|
|
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
|
|
|
};
|
2020-10-05 17:22:15 +03:00
|
|
|
|
2022-12-02 02:21:38 +03:00
|
|
|
outputs = inputs@{ self, flake-parts, ... }:
|
2023-01-04 21:06:05 +03:00
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } ({ config, lib, extendModules, ... }: {
|
2022-12-02 02:21:38 +03:00
|
|
|
imports = [
|
|
|
|
inputs.haskell-flake.flakeModule
|
|
|
|
inputs.flake-parts.flakeModules.easyOverlay
|
|
|
|
./docs/flake-module.nix
|
|
|
|
./tests/flake-module.nix
|
|
|
|
];
|
2022-12-02 02:43:51 +03:00
|
|
|
systems = inputs.nixpkgs.lib.systems.flakeExposed;
|
2022-12-02 02:21:38 +03:00
|
|
|
perSystem = { config, self', inputs', pkgs, system, final, ... }:
|
|
|
|
let h = pkgs.haskell.lib.compose; in
|
|
|
|
{
|
|
|
|
overlayAttrs = {
|
|
|
|
inherit (config.packages) arion;
|
|
|
|
arionTestingFlags = {
|
|
|
|
dockerSupportsSystemd = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
packages.default = config.packages.arion;
|
|
|
|
packages.overlay-test = final.arion;
|
|
|
|
packages.arion = import ./nix/arion.nix { inherit pkgs; };
|
|
|
|
haskellProjects.haskell-package = {
|
|
|
|
# not autodetected: https://github.com/srid/haskell-flake/issues/49
|
|
|
|
packages.arion-compose.root = ./.;
|
2020-10-05 17:22:15 +03:00
|
|
|
|
2022-12-02 02:21:38 +03:00
|
|
|
overrides =
|
|
|
|
self: super: {
|
|
|
|
arion-compose =
|
|
|
|
lib.pipe super.arion-compose [
|
|
|
|
(h.addBuildTools [ pkgs.nix ])
|
|
|
|
(h.overrideCabal (o: {
|
|
|
|
src = pkgs.lib.sourceByRegex ./. [
|
|
|
|
".*[.]cabal"
|
|
|
|
"LICENSE"
|
|
|
|
"src/?.*"
|
|
|
|
"README.asciidoc"
|
|
|
|
"CHANGELOG.md"
|
|
|
|
];
|
|
|
|
preCheck = ''
|
|
|
|
export NIX_LOG_DIR=$TMPDIR
|
|
|
|
export NIX_STATE_DIR=$TMPDIR
|
|
|
|
export NIX_PATH=nixpkgs=${pkgs.path}
|
|
|
|
'';
|
|
|
|
}))
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
devShells.default = config.devShells.haskell-package.overrideAttrs (o: {
|
|
|
|
nativeBuildInputs = o.nativeBuildInputs or [ ] ++ [
|
|
|
|
pkgs.docker-compose
|
|
|
|
pkgs.nixpkgs-fmt
|
|
|
|
config.haskellProjects.haskell-package.haskellPackages.releaser
|
|
|
|
];
|
|
|
|
});
|
|
|
|
};
|
|
|
|
flake = {
|
|
|
|
debug = { inherit inputs config lib; };
|
2020-10-05 18:36:39 +03:00
|
|
|
|
2022-12-02 02:21:38 +03:00
|
|
|
defaultPackage =
|
|
|
|
lib.mapAttrs
|
|
|
|
(ps: lib.warn "arion.defaultPackage has been removed in favor of arion.packages.\${system}.default"
|
|
|
|
ps.default)
|
|
|
|
config.flake.packages;
|
2021-10-28 22:59:01 +03:00
|
|
|
|
2022-12-02 02:21:38 +03:00
|
|
|
lib = {
|
|
|
|
eval = import ./src/nix/eval-composition.nix;
|
|
|
|
build = args@{ ... }:
|
|
|
|
let composition = self.lib.eval args;
|
|
|
|
in composition.config.out.dockerComposeYaml;
|
|
|
|
};
|
|
|
|
nixosModules.arion = ./nixos-module.nix;
|
|
|
|
herculesCI.ciSystems = [
|
|
|
|
# "aarch64-darwin"
|
|
|
|
# "aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
2020-10-05 17:22:15 +03:00
|
|
|
}
|