php-fpm-exporter/flake.nix

48 lines
1.5 KiB
Nix
Raw Normal View History

2024-11-04 14:50:01 +00:00
{
description = "Libre.sh";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, gomod2nix }:
(flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now.
# This has no effect on other platforms.
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
in
rec {
packages.default = callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
devShells.default = callPackage ./shell.nix {
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
};
packages.container = pkgs.dockerTools.buildLayeredImage {
#inherit name;
name = "php-fpm-exporter";
tag = packages.default.version;
created = "now";
# contents = packages.${name};
config = {
Cmd = [ "${packages.default}/bin/main" ];
ExposedPorts = {
"9253/tcp" = {};
};
};
};
})
);
}