2016-04-11 13:14:12 -04:00
|
|
|
# A NixOS container to protect against accidental fork bombs
|
|
|
|
#
|
|
|
|
# Put this in /var/lib/containers/test/etc/nixos/configuration.nix
|
|
|
|
# See https://nixos.org/wiki/NixOS:Containers
|
2016-04-11 13:22:06 -04:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{ boot.isContainer = true;
|
|
|
|
networking.hostName = mkDefault "urchin";
|
|
|
|
networking.useDHCP = false;
|
2016-04-11 13:14:12 -04:00
|
|
|
|
2016-04-11 13:22:06 -04:00
|
|
|
environment.systemPackages = with pkgs; [
|
2016-04-11 13:28:05 -04:00
|
|
|
# Urchin
|
2016-04-11 13:22:06 -04:00
|
|
|
bash dash mksh zsh
|
2016-04-11 13:44:14 -04:00
|
|
|
busybox
|
2016-04-11 13:28:05 -04:00
|
|
|
|
|
|
|
# Other
|
2016-04-11 13:44:14 -04:00
|
|
|
vim git rsync tmux
|
2016-04-11 13:22:06 -04:00
|
|
|
];
|
2016-04-11 13:53:31 -04:00
|
|
|
security.pam.loginLimits = [
|
|
|
|
# Prevent accidental fork bombs.
|
2016-04-11 14:42:39 -04:00
|
|
|
{ domain = "*"; item = "nproc"; type = "hard"; value = "200"; }
|
2016-04-11 13:53:31 -04:00
|
|
|
];
|
2016-04-11 13:28:05 -04:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
passwordAuthentication = false;
|
|
|
|
};
|
2016-04-11 13:22:06 -04:00
|
|
|
users.extraUsers.user = {
|
|
|
|
name = "tlevine";
|
|
|
|
uid = 1000;
|
2016-04-11 14:42:39 -04:00
|
|
|
isNormalUser = true;
|
2016-04-11 13:22:06 -04:00
|
|
|
home = "/home/tlevine";
|
|
|
|
extraGroups = [ "users" "wheel" ];
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGvQyzr42/96acUTUedaeM2ee+DMt9bkxeurdeXji9sNE10MjjAUFtxPmSI8/BUZW2/a9ByblfaJEI+H+kFVPjVr+QGKXZluxcFMj2BLbH53fi9xLgoQRjb2aAXutb2Bp74/E8R1K+CuFfRRGQ5Spdnv44SLt04D6JbBLcLIcWTpQ4v5RaYr2U27jfiF9z0m+/opxvowEy2gnqlEXFxFk8jZHT4K0uLWm2ENjT6OpyOx8hWcKeAN2vRVRex3pJfSzswn0LpuCrM1rUZ4DRE+FABi8N21Q3MBaMRkwnZPwaZwKzv06q8bu23jYTqK5BrUPtOXeeVuroQXMc12H/6/Nh laptop"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|