arion/flake.nix

99 lines
3.2 KiB
Nix
Raw Permalink Normal View History

2020-10-05 16:22:15 +02:00
{
description = "Arion - use Docker Compose via Nix";
2022-12-02 00:21:38 +01:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2023-02-16 23:28:30 +01:00
haskell-flake.url = "github:srid/haskell-flake/0.1.0";
flake-parts.url = "github:hercules-ci/flake-parts";
2022-12-02 00:21:38 +01:00
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
2023-08-23 11:25:28 +02:00
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
hercules-ci-effects.inputs.nixpkgs.follows = "nixpkgs";
2022-12-02 00:21:38 +01:00
};
2020-10-05 16:22:15 +02:00
2022-12-02 00:21:38 +01:00
outputs = inputs@{ self, flake-parts, ... }:
2023-01-04 19:06:05 +01:00
flake-parts.lib.mkFlake { inherit inputs; } ({ config, lib, extendModules, ... }: {
2022-12-02 00:21:38 +01:00
imports = [
inputs.haskell-flake.flakeModule
2023-08-23 11:25:28 +02:00
inputs.hercules-ci-effects.flakeModule
2022-12-02 00:21:38 +01:00
inputs.flake-parts.flakeModules.easyOverlay
./docs/flake-module.nix
./tests/flake-module.nix
];
2022-12-02 00:43:51 +01:00
systems = inputs.nixpkgs.lib.systems.flakeExposed;
2022-12-02 00:21:38 +01: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 16:22:15 +02:00
2022-12-02 00:21:38 +01: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
];
});
};
2023-08-23 11:25:28 +02:00
hercules-ci.flake-update = {
enable = true;
autoMergeMethod = "merge";
when = {
hour = [ 2 ];
dayOfMonth = [ 5 ];
};
};
herculesCI.ciSystems = [
# "aarch64-darwin"
# "aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
2022-12-02 00:21:38 +01:00
flake = {
debug = { inherit inputs config lib; };
2020-10-05 17:36:39 +02:00
2022-12-02 00:21:38 +01: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;
};
});
2020-10-05 16:22:15 +02:00
}