Closed aleeusgr closed 11 months ago
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
[ ({ pkgs, ... }: {
boot.isContainer = true;
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
# Network configuration.
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [ 80 ];
# Enable a web server.
services.httpd = {
enable = true;
adminAddr = "morty@example.org";
};
})
];
};
nixos-container create <name> --flake .
nixos-container start <name>
nixos-container run <name> -- uname -a
nixos-container show-ip <name>
error: syntax error, unexpected '=', expecting ';'
at /nix/store/2yfdc4izlb4820w3l8sdyzjaimkssvmj-source/flake.nix:9:33:
8| outputs = { self, nixpkgs, utils, naersk }:
9| nixosConfigurations.container = nixpkgs.lib.nixosSystem {
| ^
10| system = "x86_64-linux";
fixed in #17
We typically wrap our applications in a Docker image and deploy to some service that natively runs containers.
... can accept public traffic ... we have root access to via SSH
https://nixos.wiki/wiki/NixOS_Containers https://nix.dev/tutorials/nixos/building-and-running-docker-images.html