WIP refactor
This commit is contained in:
parent
c10446db21
commit
2087ee1015
16 changed files with 342 additions and 144 deletions
38
common/programs/docker.nix
Normal file
38
common/programs/docker.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
ccfg = import ../config.nix;
|
||||
cfg_path = [
|
||||
ccfg.custom_config_key
|
||||
"programs"
|
||||
"docker"
|
||||
];
|
||||
cfg = lib.attrsets.getAttrFromPath cfg_path config;
|
||||
|
||||
users_cfg = config.${ccfg.custom_config_key}.users;
|
||||
in
|
||||
{
|
||||
options =
|
||||
{ }
|
||||
// lib.attrsets.setAttrByPath cfg_path {
|
||||
enable = lib.mkEnableOption "docker";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
# TODO add admins?
|
||||
users.extraGroups.docker.members = lib.mkIf (users_cfg.primary != null) [ users_cfg.primary ];
|
||||
environment.shellAliases = {
|
||||
dockerv = "docker volume";
|
||||
dockeri = "docker image";
|
||||
dockerc = "docker container";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue