Commit fcc04b7b8167

Vincent Demeester <vincent@sbr.pm>
2018-11-01 16:44:48
profiles: add containers
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 505db48
modules/profiles/containers.nix
@@ -0,0 +1,35 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.containers;
+in
+{
+  options = {
+    profiles.containers = {
+      enable = mkOption {
+        default = false;
+        description = "Enable containers profile";
+        type = types.bool;
+      };
+      podman = mkOption {
+        default = podman;
+        description = "Enable podman tools";
+        type = types.bool;
+      };
+      docker = mkOption {
+        default = false;
+        description = "Enable docker tools";
+        type = types.bool;
+      };
+    };
+    config = mkIf cfg.enable {
+      profiles.docker.enable = cfg.docker;
+      profiles.podman.enalbe = cfg.podman || !cfg.docker;
+      home.packages = with pkgs; [
+        go-containerregistry
+        skopeo
+      ];
+    };
+  };
+}
modules/module-list.nix
@@ -3,6 +3,7 @@
 {
   imports = [
     ./profiles/bash.nix
+    ./profiles/containers.nix
     ./profiles/desktop.nix
     ./profiles/dev.nix
     ./profiles/dev.go.nix
containers.nix
@@ -1,8 +0,0 @@
-{ pkgs, prefix, ... }:
-
-{
-  home.packages = with pkgs; [
-    go-containerregistry
-    skopeo
-  ];
-}
devops.nix
@@ -1,7 +1,7 @@
 { pkgs, prefix, ... }:
 
 {
-  imports = [ ./containers.nix ./kubernetes.nix ./minikube.nix ];
+  imports = [ ./kubernetes.nix ./minikube.nix ];
   home.packages = with pkgs; [
     google-cloud-sdk
     packer
hokkaido.nix
@@ -4,7 +4,6 @@
   imports = [
     ./desktop.nix
     # k8s
-    ./containers.nix
     ./kubernetes.nix
   ];
   profiles.laptop.enable = true;
@@ -15,8 +14,8 @@
     python.enable = true;
     rust.enable = true;
   };
+  profiles.containers.enable = true;
   programs.vscode.enable = true;
-  programs.podman.enable = true;
   home.packages = with pkgs; [
     google-chrome
   ];
shikoku.nix
@@ -16,12 +16,11 @@
     python.enable = true;
     rust.enable = true;
   };
-  profiles.docker.enable = true;
+  profiles.containers = {
+    enable = true;
+    docker = true;
+  };
   programs.vscode.enable = true;
-  programs.podman.enable = true;
-  xdg.configFile."fish/conf.d/docker.fish".text = ''
-    set -gx DOCKER_BUILDKIT 1
-  '';
   home.packages = with pkgs; [
     google-chrome
     obs-studio # screencast
wakasu.nix
@@ -15,9 +15,11 @@
     python.enable = true;
     rust.enable = true;
   };
-  profiles.docker.enable = true;
+  profiles.containers = {
+    enable = true;
+    docker = true;
+  };
   programs.vscode.enable = true;
-  programs.podman.enable = true;
   home.packages = with pkgs; [
     google-chrome
     obs-studio