nixos-config/modules/profiles.nix

35 lines
847 B
Nix
Raw Normal View History

2021-03-10 03:50:54 +00:00
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.sconfig.profile;
in
{
options.sconfig.profile = mkOption {
2021-03-10 03:54:12 +00:00
type = types.enum [ "server" "desktop-gnome" "desktop-sway" "desktop-plasma" ];
2021-03-10 03:50:54 +00:00
};
config = mkMerge [
2021-03-30 00:21:02 +00:00
(mkIf (cfg == "server") {
services.openssh.enable = true;
system.autoUpgrade = {
enable = true;
allowReboot = true;
};
nix.gc = {
automatic = true;
options = "--delete-older-than 30d";
};
})
2021-03-10 03:50:54 +00:00
(mkIf (cfg == "desktop-sway") (import ./sway.nix { inherit pkgs; }))
(mkIf (cfg == "desktop-gnome") (import ./gnome.nix { inherit pkgs; }))
2021-03-10 03:54:12 +00:00
(mkIf (cfg == "desktop-plasma") (import ./plasma.nix { inherit pkgs; }))
2021-03-10 03:50:54 +00:00
(mkIf ("desktop-" == builtins.substring 0 8 cfg) (mkMerge [
(import ./graphical.nix { inherit pkgs; })
]))
];
}