2018-07-20 21:56:59 +01:00
|
|
|
{ lib, ... }:
|
2014-12-11 21:58:17 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
2015-04-19 20:38:22 +01:00
|
|
|
../profiles/docker-container.nix # FIXME, shouldn't include something from profiles/
|
2014-12-11 21:58:17 +00:00
|
|
|
];
|
|
|
|
|
2021-04-28 03:29:09 +01:00
|
|
|
config = {
|
|
|
|
system.build.tarball = mkForce (pkgs.callPackage ../../lib/make-system-tarball.nix {
|
|
|
|
extraArgs = "--owner=0";
|
|
|
|
|
|
|
|
storeContents = [
|
|
|
|
config.system.build.toplevel
|
|
|
|
];
|
|
|
|
|
|
|
|
contents = [
|
|
|
|
{
|
|
|
|
source = pkgs.writeText "metadata.yaml" ''
|
|
|
|
architecture: ${builtins.elemAt (builtins.match "^([a-z0-9_]+).+" (toString pkgs.system)) 0}
|
|
|
|
creation_date: 0
|
|
|
|
properties:
|
|
|
|
description: NixOS ${config.system.nixos.codeName} ${config.system.nixos.label} ${pkgs.system}
|
|
|
|
os: nixos
|
|
|
|
release: ${config.system.nixos.codeName}
|
|
|
|
'';
|
|
|
|
target = "/metadata.yaml";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
source = config.system.build.toplevel + "/init";
|
|
|
|
target = "/sbin/init";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
extraCommands = "mkdir -p proc sys dev";
|
|
|
|
});
|
|
|
|
|
|
|
|
# Allow the user to login as root without password.
|
|
|
|
users.users.root.initialHashedPassword = mkOverride 150 "";
|
|
|
|
|
|
|
|
# Some more help text.
|
|
|
|
services.getty.helpLine =
|
|
|
|
''
|
|
|
|
|
|
|
|
Log in as "root" with an empty password.
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Containers should be light-weight, so start sshd on demand.
|
|
|
|
services.openssh.enable = mkDefault true;
|
|
|
|
services.openssh.startWhenNeeded = mkDefault true;
|
|
|
|
|
|
|
|
# Allow ssh connections
|
|
|
|
networking.firewall.allowedTCPPorts = [ 22 ];
|
|
|
|
};
|
2014-12-11 21:58:17 +00:00
|
|
|
}
|