Skip to content

Instantly share code, notes, and snippets.

@zefhemel
Created May 24, 2013 14:55
Show Gist options
  • Save zefhemel/5644106 to your computer and use it in GitHub Desktop.
Save zefhemel/5644106 to your computer and use it in GitHub Desktop.
NixOS Server config
{ config, pkgs, ... }:
{
# Bare basics
boot.loader.grub.enable = true;
boot.loader.grub.version = 1;
boot.loader.grub.extraPerEntryConfig = "root (hd0)";
boot.loader.grub.device = "nodev";
boot.initrd.kernelModules = [ "xen_blkfront" ];
fileSystems."/boot".fsType = "ext2";
fileSystems."/boot".device = "/dev/xvda";
fileSystems."/".label = "nixos";
fileSystems."/".fsType = "ext4";
swapDevices = [{ device = "/dev/xvdb"; }];
# Networking
networking.hostName = "zerver.zef.me";
# Main services
services.postfix.enable = true;
services.sshd.enable = true;
services.mysql.enable = true;
# Web server
services.httpd.enable = true;
services.httpd.adminAddr = "zef@zef.me";
services.httpd.extraModules = [
{ name = "php5";
path = "${pkgs.php54}/modules/libphp5.so"; }
];
services.httpd.virtualHosts = [
{ hostName = "zef.me";
documentRoot = "/home/zef/www/zef.me"; }
{ hostName = "stateofcode.com";
serverAliases = ["www.stateofcode.com"];
documentRoot = "/home/zef/www/stateofcode.com"; }
];
// Packages available to everybody
environment.systemPackages = [ pkgs.htop ];
users.extraUsers = {
zef = {
createHome = true;
extraGroups = [ "wheel" ];
group = "users";
home = "/home/zef";
shell = "/bin/sh";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment