lol

nixos/lxd: Add service

+67
+2
nixos/modules/misc/ids.nix
··· 231 231 gateone = 207; 232 232 namecoin = 208; 233 233 dnschain = 209; 234 + #lxd = 210; # unused 234 235 235 236 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! 236 237 ··· 440 441 gateone = 207; 441 442 namecoin = 208; 442 443 #dnschain = 209; #unused 444 + lxd = 210; # unused 443 445 444 446 # When adding a gid, make sure it doesn't match an existing 445 447 # uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
··· 487 487 ./virtualisation/docker.nix 488 488 ./virtualisation/libvirtd.nix 489 489 ./virtualisation/lxc.nix 490 + ./virtualisation/lxd.nix 490 491 ./virtualisation/amazon-options.nix 491 492 ./virtualisation/openvswitch.nix 492 493 ./virtualisation/parallels-guest.nix
+64
nixos/modules/virtualisation/lxd.nix
··· 1 + # Systemd services for lxd. 2 + 3 + { config, lib, pkgs, ... }: 4 + 5 + with lib; 6 + 7 + let 8 + 9 + cfg = config.virtualisation.lxd; 10 + 11 + in 12 + 13 + { 14 + ###### interface 15 + 16 + options = { 17 + 18 + virtualisation.lxd.enable = 19 + mkOption { 20 + type = types.bool; 21 + default = false; 22 + description = 23 + '' 24 + This option enables lxd, a daemon that manages 25 + containers. Users in the "lxd" group can interact with 26 + the daemon (e.g. to start or stop containers) using the 27 + <command>lxc</command> command line tool, among others. 28 + ''; 29 + }; 30 + 31 + }; 32 + 33 + 34 + ###### implementation 35 + 36 + config = mkIf cfg.enable { 37 + 38 + environment.systemPackages = 39 + [ pkgs.lxd ]; 40 + 41 + systemd.services.lxd = 42 + { description = "LXD Container Management Daemon"; 43 + 44 + wantedBy = [ "multi-user.target" ]; 45 + after = [ "systemd-udev-settle.service" ]; 46 + 47 + # TODO(wkennington): Add lvm2 and thin-provisioning-tools 48 + path = with pkgs; [ acl rsync gnutar xz btrfsProgs ]; 49 + 50 + serviceConfig.ExecStart = "@${pkgs.lxd}/bin/lxd lxd --syslog --group lxd"; 51 + serviceConfig.Type = "simple"; 52 + serviceConfig.KillMode = "process"; # when stopping, leave the containers alone 53 + }; 54 + 55 + users.extraGroups.lxd.gid = config.ids.gids.lxd; 56 + 57 + users.extraUsers.root = { 58 + subUidRanges = [ { startUid = 1000000; count = 65536; } ]; 59 + subGidRanges = [ { startGid = 1000000; count = 65536; } ]; 60 + }; 61 + 62 + }; 63 + 64 + }