整理 docker 和 waydroid

This commit is contained in:
2023-07-22 15:05:18 +08:00
parent 9faeb54ebd
commit 04e19884fe
4 changed files with 31 additions and 13 deletions

View File

@@ -147,6 +147,7 @@
./modules/packages
./modules/boot
./modules/system
./modules/virtualization
(inputs: { config.nixos =
{
fileSystems =
@@ -217,6 +218,11 @@
hostname = "chn-PC";
march = "alderlake";
};
virtualization =
{
waydroid.enable = true;
docker.enable = true;
};
};}
)
@@ -240,10 +246,8 @@
./modules/packages/hpc.nix
[ ./modules/users/root.nix {} ]
[ ./modules/users/chn.nix {} ]
./modules/virtualisation/docker.nix
./modules/virtualisation/kvm_guest.nix
./modules/virtualisation/kvm_host.nix
./modules/virtualisation/waydroid.nix
./modules/home/root.nix
./modules/home/chn.nix
]

View File

@@ -1,9 +0,0 @@
{
config.virtualisation.docker =
{
enable = true;
rootless = { enable = true; setSocketVariable = true; };
enableNvidia = true;
storageDriver = "overlay2";
};
}

View File

@@ -1,2 +0,0 @@
# sudo waydroid shell wm set-fix-to-user-rotation enabled
{ config.virtualisation = { waydroid.enable = true; }; }

View File

@@ -0,0 +1,25 @@
inputs:
{
options.nixos.virtualization = let inherit (inputs.lib) mkOption types; in
{
waydroid.enable = mkOption { default = false; type = types.bool; };
docker.enable = mkOption { default = false; type = types.bool; };
};
config = let inherit (inputs.lib) mkMerge mkIf; in mkMerge
[
# waydroid
(mkIf inputs.config.nixos.virtualization.waydroid.enable { virtualisation = { waydroid.enable = true; }; })
# docker
(
mkIf inputs.config.nixos.virtualization.docker.enable { virtualisation.docker =
{
enable = true;
rootless = { enable = true; setSocketVariable = true; };
enableNvidia = true;
storageDriver = "overlay2";
}; }
)
];
}
# sudo waydroid shell wm set-fix-to-user-rotation enabled