Skip to content

Commit

Permalink
refactor(workstation): Simplify (mkOption -> mkEnableOption) (NixOS#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
qjcg authored Mar 6, 2021
1 parent 31b14c4 commit 22ee039
Showing 1 changed file with 9 additions and 33 deletions.
42 changes: 9 additions & 33 deletions modules/roles/workstation/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }:
let
inherit (pkgs.stdenv) isDarwin isLinux;
inherit (lib) mkIf mkMerge mkOption types;
inherit (lib) mkEnableOption mkIf mkMerge;

cfg = config.roles.workstation;
in
Expand All @@ -22,36 +21,13 @@ in
# See https://en.wikipedia.org/wiki/Facade_pattern
roles.workstation = {

enable = mkOption {
type = types.bool;
default = false;
description = "Enable the workstation role.";
};

desktop = mkOption {
type = types.bool;
default = false;
description = "Install desktop packages.";
};

games = mkOption {
type = types.bool;
default = false;
description = "Install games.";
};

gnome = mkOption {
type = types.bool;
default = false;
description =
"Install the GNOME desktop environment and related packages.";
};

sway = mkOption {
type = types.bool;
default = false;
description = "Install Sway and related packages.";
};
enable = mkEnableOption "Enable the workstation role.";
desktop = mkEnableOption "Install desktop packages.";
games = mkEnableOption "Install games.";
gnome = mkEnableOption "Install the GNOME desktop environment and related packages.";
sway = mkEnableOption "Install sway and related packages";
isDarwin = mkEnableOption "Target is a Darwin system.";
isLinux = mkEnableOption "Target is a Linux system.";

};
};
Expand Down Expand Up @@ -88,7 +64,7 @@ in
programs.tmux.extraConfig = builtins.readFile ../../../files/tmux.conf;
}

(mkIf isLinux {
(mkIf cfg.isLinux {

networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ ];
Expand Down

0 comments on commit 22ee039

Please sign in to comment.