Files
slacker-bot/flake.nix
T
2026-11-01 14:55:33 -05:00

53 lines
1.6 KiB
Nix

{
description = "slackerbot: a Slack bot that runs goose agents in NixOS containers";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
agent = self.nixosConfigurations.agent.config.system.build.toplevel;
date = self.lastModifiedDate;
version = "${builtins.substring 0 4 date}.${builtins.substring 4 2 date}.${builtins.substring 6 2 date}-${self.shortRev or self.dirtyShortRev or "dirty"}";
in
{
packages.${system} = {
slackerbot = pkgs.buildGoModule {
pname = "slackerbot";
inherit version;
src = ./slackerbot;
ldflags = [ "-X main.version=${version}" ];
vendorHash = "sha256-DFNUnPMsfcUHDlIxcxsDvuqjoHcp9EDTXWVy5t/oxEk=";
# tests need network ports and ../config.example.toml
doCheck = false;
meta.mainProgram = "slackerbot";
};
default = self.packages.${system}.slackerbot;
inherit agent;
};
nixosConfigurations.agent = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs.slackerbot = self.packages.${system}.slackerbot;
modules = [ ./nix/container.nix ];
};
nixosModules.host = import ./nix/host.nix self;
devShells.${system}.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.slackerbot ];
packages = with pkgs; [
go
gopls
gotools
go-tools
delve
btrfs-progs
nixpkgs-fmt
];
};
};
}