nixpkgs/nixos/modules/virtualisation/docker-image.nix
aszlig 8e516de3e7
nixos: Fix priorities of initialHashedPassword.
Regression introduced in f496c3cbe4.

Previously when we used security.initialRootPassword, the default
priority for this option was 1001, because it was a default value set by
the option itself.

With the mentioned commit, it is no longer an option default but a
mkDefault, which is priority 1000.

I'm setting this to 150 now, as test-instrumentation.nix is using this
for overriding other options and because I think it still makes it
possible to simple-override it, because if no priority is given, we get
priority 100.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-11-04 05:19:07 +01:00

68 lines
1.7 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l;
in {
# Create the tarball
system.build.dockerImage = import ../../lib/make-system-tarball.nix {
inherit (pkgs) stdenv perl xz pathsFromGraph;
contents = [];
extraArgs = "--owner=0";
storeContents = [
{ object = config.system.build.toplevel + "/init";
symlink = "/bin/init";
}
] ++ (pkgs2storeContents [ pkgs.stdenv ]);
};
boot.postBootCommands =
''
# After booting, register the contents of the Nix store in the Nix
# database.
if [ -f /nix-path-registration ]; then
${config.nix.package}/bin/nix-store --load-db < /nix-path-registration &&
rm /nix-path-registration
fi
# nixos-rebuild also requires a "system" profile and an
# /etc/NIXOS tag.
touch /etc/NIXOS
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
# Set virtualisation to docker
echo "docker" > /run/systemd/container
'';
# Docker image config.
imports = [
../installer/cd-dvd/channel.nix
../profiles/minimal.nix
../profiles/clone-config.nix
];
boot.isContainer = true;
# Iptables do not work in Docker.
networking.firewall.enable = false;
services.openssh.enable = true;
# Socket activated ssh presents problem in Docker.
services.openssh.startWhenNeeded = false;
# Allow the user to login as root without password.
users.extraUsers.root.initialHashedPassword = mkOverride 150 "";
# Some more help text.
services.mingetty.helpLine =
''
Log in as "root" with an empty password.
'';
}