refactor(modules): clean up folder structure
This commit is contained in:
parent
d8aa7f62b4
commit
03fca8b28b
12 changed files with 32 additions and 38 deletions
|
@ -1,7 +1,38 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.default =
|
||||
{ modulesPath, ... }:
|
||||
{ config, modulesPath, ... }:
|
||||
let
|
||||
cfg = config.machine;
|
||||
in
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
options.machine.bluetooth.enable = mkEnableOption "";
|
||||
options.machine.usb.automount = mkEnableOption "";
|
||||
config = mkMerge [
|
||||
(mkIf cfg.usb.automount {
|
||||
services.udisks2.enable = true;
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
services.udiskie = {
|
||||
enable = true;
|
||||
automount = true;
|
||||
notify = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
(mkIf cfg.bluetooth.enable {
|
||||
persistDirs = [ "/var/lib/bluetooth" ];
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
settings.General.Experimental = true;
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
36
nix/modules/machine/virtualisation.nix
Normal file
36
nix/modules/machine/virtualisation.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (config.flake.lib.modules) forAllUsers;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.default =
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
cfg = config.machine.virtualisation;
|
||||
in
|
||||
{
|
||||
options.machine.virtualisation = {
|
||||
podman.enable = mkEnableOption "";
|
||||
podman.distrobox.enable = mkEnableOption "";
|
||||
};
|
||||
config = mkIf cfg.podman.enable {
|
||||
virtualisation.containers.enable = true;
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
users.users = forAllUsers {
|
||||
extraGroups = [ "podman" ];
|
||||
autoSubUidGidRange = cfg.podman.distrobox.enable;
|
||||
};
|
||||
home-manager.sharedModules = optional cfg.podman.distrobox.enable {
|
||||
home.packages = [ pkgs.distrobox ];
|
||||
persistDirs = [ ".local/share/containers" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue