bangs/flake.nix

69 lines
1.7 KiB
Nix

{
description = "A web service to evaluate DuckDuckGo-style bangs in search queries";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, flake-utils, nixpkgs }: {
overlay = final: prev: {
bang-evaluator = prev.buildGoModule {
name = "bang-evaluator";
src = self;
subPackages = [ "." ];
vendorHash = "sha256-w3mFra7Je+8qIDQMSyUYucoLZ6GtrZmr56O6xmihIYc=";
preBuild = ''go generate ./...'';
doCheck = false; # no tests (yet?)
meta = with prev.lib; {
license = licenses.mit;
maintainer = with mainatiners; [ sbruder ];
};
};
};
nixosModules.bang-evaluator = {
imports = [ ./module.nix ];
nixpkgs.overlays = [
self.overlay
];
};
} // flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; };
in
rec {
packages = {
inherit (pkgs) bang-evaluator;
};
defaultPackage = packages.bang-evaluator;
defaultApp = {
type = "app";
program = "${packages.bang-evaluator}/bin/evaluator";
};
checks = {
integration-test = import ./test.nix {
inherit nixpkgs system;
inherit (self) nixosModules;
};
};
# My hydra only has x86_64-linux builders
hydraJobs = if pkgs.lib.elem system [ "x86_64-linux" ]
then {
build = defaultPackage;
integration-test = checks.integration-test;
}
else { };
});
}