about summary refs log tree commit diff
path: root/flake.nix
blob: 5c3ed37a57e07dbcd3fc35140cd382c2e960c910 (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
{
  inputs = {
    flake-utils = {
      type = "github";
      owner = "numtide";
      repo = "flake-utils";
      ref = "master";
    };
    naersk = {
      type = "github";
      owner = "nmattia";
      repo = "naersk";
      ref = "master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  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;
  } // forAllSystems (system: let
    pkgs = nixpkgs.legacyPackages.${system};
  in {
    packages = {
      kittybox = pkgs.callPackage ./kittybox.nix {
        naersk = naersk.lib.${system};
      };
      default = self.packages.${system}.kittybox;
    };

    checks = {
      kittybox = self.packages.${system}.kittybox;
      distributed-test = pkgs.nixosTest (import ./distributed-test.nix self);
      nixos-test = pkgs.nixosTest (import ./smoke-test.nix self);
      dockerContainer = pkgs.callPackage ./docker.nix {
        inherit (self.packages.${system}) kittybox;
        rev = self.rev or "development";
        inherit (self) lastModifiedDate;
      };
    };

    devShells.default = pkgs.callPackage ./shell.nix {};
  });
}