all repos — honk @ a45d05c6b519c07e8c410dc3f75045e2ee3b72a3

my fork of honk

flake.nix (view raw)

  1{
  2  inputs.nixpkgs.url = "github:nixos/nixpkgs";
  3
  4  outputs =
  5    { self
  6    , nixpkgs
  7    ,
  8    }:
  9    let
 10      supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
 11      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
 12      nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
 13    in
 14    {
 15      packages = forAllSystems (system:
 16        let
 17          pkgs = nixpkgsFor.${system};
 18          honk = self.packages.${system}.honk;
 19          files = pkgs.lib.fileset.toSource {
 20            root = ./.;
 21            fileset = pkgs.lib.fileset.unions [
 22              ./.
 23            ];
 24          };
 25        in
 26        {
 27          honk = pkgs.buildGoModule {
 28            name = "honk";
 29            rev = "master";
 30            src = pkgs.lib.fileset.toSource
 31              {
 32                root = ./.;
 33                fileset = pkgs.lib.fileset.unions [
 34                  ./go.mod
 35                  ./go.sum
 36                  ./views
 37                  ./memes
 38                  ./schema.sql
 39                  ./activity.go
 40                  ./admin.go
 41                  ./avatar.go
 42                  ./backend.go
 43                  ./backupdb.go
 44                  ./bloat.go
 45                  ./cli.go
 46                  ./database.go
 47                  ./deliverator.go
 48                  ./encrypt.go
 49                  ./fun.go
 50                  ./hfcs.go
 51                  ./honk.go
 52                  ./import.go
 53                  ./main.go
 54                  ./masto.go
 55                  ./masto_util.go
 56                  ./sensors.go
 57                  ./skulduggery.go
 58                  ./syndicate.go
 59                  ./unveil.go
 60                  ./upgradedb.go
 61                  ./util.go
 62                  ./web.go
 63                ];
 64              };
 65            CGO_ENABLED = 1;
 66            nativeBuildInputs = [ pkgs.gcc pkgs.mercurial ];
 67            buildInputs = [ pkgs.sqlite ];
 68
 69            vendorHash = "sha256-shn9d+w9+nE60zaLtEmwwHAL54JLebgmiolom2zFBxA=";
 70          };
 71          docker = pkgs.dockerTools.buildLayeredImage {
 72            name = "sini:5000/honk";
 73            tag = "latest";
 74            contents = [ files honk pkgs.cacert pkgs.bashInteractive pkgs.coreutils pkgs.sqlite ];
 75            config = {
 76              Entrypoint = [ "${honk}/bin/honk" ];
 77              ExposedPorts = { "5555/tcp" = { }; };
 78            };
 79          };
 80        });
 81
 82      defaultPackage = forAllSystems (system: self.packages.${system}.honk);
 83      devShells = forAllSystems (system:
 84        let
 85          pkgs = nixpkgsFor.${system};
 86        in
 87        {
 88          default = pkgs.mkShell {
 89            buildInputs = [ pkgs.sqlite ];
 90            nativeBuildInputs = with pkgs; [
 91              go
 92              gcc
 93            ];
 94            CGO_ENABLED = 1;
 95            CC = "${pkgs.gcc}/bin/gcc";
 96          };
 97        });
 98    };
 99}
100