summaryrefslogtreecommitdiff
path: root/release.nix
blob: 4fd73d80ea835227bf1ec40a2e42e22979250521 (plain)
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
{ nixpkgs ? (import <nixpkgs> {}) }:
with nixpkgs.pkgs;
let
   pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l;

   makeSystemTarball =
    { module, maintainers ? ["viric"], system }:

    let
      versionModule = {
        system.nixosVersionSuffix = "orbekk";
        system.nixosRevision = "master";
      };

      config = (import <nixpkgs/nixos/lib/eval-config.nix> {
        inherit system;
        modules = [ module versionModule ];
      }).config;

      tarball = import <nixpkgs/nixos/lib/make-system-tarball.nix> {
        inherit (pkgs) stdenv perl xz pathsFromGraph;
        contents = [];
        extraArgs = "--owner=0";

        # Add init script to image
        storeContents = [
          { object = config.system.build.toplevel + "/init";
            symlink = "/init";
          }
        ] ++ (pkgs2storeContents [ pkgs.stdenv ]);

        # Some container managers like lxc need these
        extraCommands = writeScript "setup.sh" ''
          mkdir -p proc sys dev sbin
          ln -s init sbin/init
        '';
      };
    in
      tarball //
        { meta = {
            description = "NixOS system tarball for ${system} - ${stdenv.platform.name}";
            maintainers = map (x: lib.maintainers.${x}) maintainers;
          };
          inherit config;
        };
in
{
  containerTarball = (import <nixpkgs/nixos/release.nix> {})
    .containerTarball.x86_64-linux;

  orbekkContainerTarball = makeSystemTarball {
    module = ./machines/generic-container.nix;
    system = "x86_64-linux";
  };

  tests = {
    common = import tests/common.nix;
    desktop = import tests/desktop.nix;
    container-shape = import tests/container-shape.nix;
    # gitlab = import tests/gitlab.nix;
  };
}