I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB

  1. # This file is controlled by /etc/dotfiles/README.org
  2. { config, options, lib, pkgs, ... }:
  3. with lib;
  4. with lib.types;
  5. let cfg = config.modules.docker;
  6. myDockerNuke = pkgs.writeShellScriptBin "docker-nuke" ''
  7. docker stop $(docker ps -aq)
  8. docker rm $(docker ps -aq)
  9. docker network prune -f
  10. docker rmi -f $(docker images --filter dangling=true -qa)
  11. docker volume rm $(docker volume ls --filter dangling=true -q)
  12. docker rmi -f $(docker images -qa)
  13. '';
  14. in {
  15. options.modules.docker = {
  16. enable = mkOption {
  17. type = bool;
  18. default = false;
  19. };
  20. };
  21. config = mkIf cfg.enable {
  22. # Enable the docker virutalization platform.
  23. virtualisation.docker = {
  24. enable = true;
  25. enableOnBoot = true;
  26. autoPrune.enable = true;
  27. };
  28. # Required for the `docker' command.
  29. users.users.chris.extraGroups = [ "docker" ];
  30. # Add docker extensions.
  31. environment.systemPackages = [
  32. myDockerNuke
  33. pkgs.docker-compose
  34. pkgs.docker-machine
  35. ];
  36. };
  37. }