tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/docker-image: add example usage
Jörg Thalheim
7 years ago
50daffc4
ceececbd
+38
1 changed file
expand all
collapse all
unified
split
nixos
modules
virtualisation
docker-image.nix
+38
nixos/modules/virtualisation/docker-image.nix
···
17
17
# Socket activated ssh presents problem in Docker.
18
18
services.openssh.startWhenNeeded = false;
19
19
}
20
20
+
21
21
+
# Example usage:
22
22
+
#
23
23
+
## default.nix
24
24
+
# let
25
25
+
# nixos = import <nixpkgs/nixos> {
26
26
+
# configuration = ./configuration.nix;
27
27
+
# system = "x86_64-linux";
28
28
+
# };
29
29
+
# in
30
30
+
# nixos.config.system.build.tarball
31
31
+
#
32
32
+
## configuration.nix
33
33
+
# { pkgs, config, lib, ... }:
34
34
+
# {
35
35
+
# imports = [
36
36
+
# <nixpkgs/nixos/modules/virtualisation/docker-image.nix>
37
37
+
# <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
38
38
+
# ];
39
39
+
#
40
40
+
# documentation.doc.enable = false;
41
41
+
#
42
42
+
# environment.systemPackages = with pkgs; [
43
43
+
# bashInteractive
44
44
+
# cacert
45
45
+
# nix
46
46
+
# ];
47
47
+
# }
48
48
+
#
49
49
+
## Run
50
50
+
# Build the tarball:
51
51
+
# $ nix-build default.nix
52
52
+
# Load into docker:
53
53
+
# $ docker import result/tarball/nixos-system-*.tar.xz nixos-docker
54
54
+
# Boots into systemd
55
55
+
# $ docker run --privileged -it nixos-docker /init
56
56
+
# Log into the container
57
57
+
# $ docker exec -it <container-name> /run/current-system/sw/bin/bash