saerro-go/flake.nix
2024-11-13 19:58:54 -08:00

59 lines
No EOL
1.6 KiB
Nix

{
description = "saerro";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { config, self', pkgs, lib, system, ... }: rec {
devShells.default = import ./shell.nix { inherit pkgs; };
packages = let
vendorHash = "sha256-A5hZxo0zZ3w6qryV24PjYaKQatN2G2heyuee6QaU55M=";
isolateBinary = pkg: name: pkgs.stdenvNoCC.mkDerivation {
name = "saerro-${name}";
version = "1.0.0";
src = pkg;
installPhase = ''
mkdir -p $out/bin
cp $src/bin/${name} $out/bin/${name}
'';
};
in rec {
default = saerro;
saerro = pkgs.buildGoModule {
inherit vendorHash;
name = "saerro";
src = ./.;
subPackages = [
"cmd/ws"
"cmd/pruner"
];
};
ws = pkgs.dockerTools.buildImage {
name = "ps2.live/saerro/ws";
tag = "latest";
copyToRoot = [
pkgs.dockerTools.caCertificates
];
config = {
Cmd = [ "${isolateBinary saerro "ws"}/bin/ws" ];
};
};
pruner = pkgs.dockerTools.buildImage {
name = "ps2.live/saerro/pruner";
tag = "latest";
copyToRoot = [
pkgs.dockerTools.caCertificates
];
config = {
Cmd = [ "${isolateBinary saerro "pruner"}/bin/pruner" ];
};
};
};
};
};
}