DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

5290a0f1e825371418f8b049951c0cf9c23d55ac — Jonni Liljamo 3 months ago bbbfef9
feat(roles/docker, roles/base): docker role
4 files changed, 32 insertions(+), 3 deletions(-)

M hosts/arwen/default.nix
M roles/base.nix
M roles/default.nix
A roles/docker.nix
M hosts/arwen/default.nix => hosts/arwen/default.nix +2 -0
@@ 37,6 37,8 @@
  roles.zellij.enable = true;
  roles.kitty.enable = true;

  roles.docker.enable = true;

  roles.graphics = {
    enable = true;
    amd.enable = true;

M roles/base.nix => roles/base.nix +6 -2
@@ 21,7 21,11 @@ in {
          username = lib.mkOption {
            type = lib.types.str;
          };
          isWheel = lib.mkEnableOption "wheter to enable admin permissions";
          isWheel = lib.mkEnableOption "admin permissions";
          extraGroups = lib.mkOption {
            type = lib.types.listOf lib.types.str;
            default = [];
          };
          hashedPasswordFile = lib.mkOption {
            type = lib.types.path;
          };


@@ 44,7 48,7 @@ in {
    users.users.root.hashedPasswordFile = cfg.root.hashedPasswordFile;
    users.users.${cfg.primaryUser.username} = {
      isNormalUser = true;
      extraGroups = lib.optional cfg.primaryUser.isWheel "wheel";
      extraGroups = cfg.primaryUser.extraGroups ++ lib.optional cfg.primaryUser.isWheel "wheel";
      home = homeDirectory;
      hashedPasswordFile = cfg.primaryUser.hashedPasswordFile;
    };

M roles/default.nix => roles/default.nix +2 -1
@@ 5,8 5,9 @@
    ./shell

    ./audio.nix
    ./bluetooth.nix
    ./base.nix
    ./bluetooth.nix
    ./docker.nix
    ./git.nix
    ./hyprland.nix
    ./kitty.nix

A roles/docker.nix => roles/docker.nix +22 -0
@@ 0,0 1,22 @@
{
  config,
  lib,
  ...
}: let
  cfg = config.roles.docker;
in {
  options.roles.docker = {
    enable = lib.mkEnableOption "Docker";
    enableNvidia = lib.mkEnableOption "Docker NVIDIA GPU support";
  };

  config = lib.mkIf cfg.enable {
    virtualisation.docker = {
      enable = true;
      enableNvidia = cfg.enableNvidia;
    };

    # FIXME: make configurable
    roles.base.primaryUser.extraGroups = ["docker"];
  };
}