about summary refs log tree commit diff
path: root/flake.nix
blob: e78b88c61595c5e4e912cd98b1bc4940ed7acc55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
  inputs = {
    flake-utils = {
      type = "github";
      owner = "numtide";
      repo = "flake-utils";
      ref = "main";
    };
    naersk = {
      type = "github";
      owner = "nix-community";
      repo = "naersk";
      ref = "master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs = {
      type = "github";
      owner = "nixos";
      repo = "nixpkgs";
      ref = "nixos-unstable";
    };
  };
  outputs = { self, nixpkgs, flake-utils, naersk }: let
    supportedSystems = ["aarch64-linux" "x86_64-linux"];
    forAllSystems = f: flake-utils.lib.eachSystem supportedSystems f;
  in {
    nixosModules.default = import ./configuration.nix self;
    overlays.default = final: prev: let
      naersk' = final.pkgsBuildHost.callPackage naersk {};
    in {
      kittybox = final.callPackage ./kittybox.nix {
        naersk = naersk';
        inherit (final.pkgsBuildHost.nodePackages) typescript;
      };
    };
  } // forAllSystems (system: let
    pkgs = import nixpkgs {
      localSystem.system = system;
      overlays = [ self.overlays.default ];
    };
  in {
    packages = {
      kittybox = pkgs.kittybox;
      default = self.packages.${system}.kittybox;
    };

    checks = {
      kittybox = self.packages.${system}.kittybox;
      distributed-test = self.packages.${system}.kittybox.tests.distributed;
      nixos-test = self.packages.${system}.kittybox.tests.smokeTest;
      nixos-test-postgres = self.packages.${system}.kittybox.tests.postgresSmokeTest;
      webmention-test = self.packages.${system}.kittybox.tests.webmention;
      dockerContainer = pkgs.callPackage ./docker.nix {
        inherit (self.packages.${system}) kittybox;
        rev = self.rev or "development";
        inherit (self) lastModifiedDate;
      };
    };

    devShells.default = pkgs.callPackage ./shell.nix {
      inherit (pkgs.nodePackages) typescript typescript-language-server;
    };
  });
}