summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/btrfs.nix19
-rw-r--r--modules/default.nix10
-rw-r--r--modules/desktop/common.nix66
-rw-r--r--modules/desktop/default.nix73
-rw-r--r--modules/desktop/steam.nix88
-rw-r--r--modules/desktop/wayland.nix14
-rw-r--r--modules/desktop/wms/default.nix3
-rw-r--r--modules/desktop/wms/hyprland.nix83
-rw-r--r--modules/desktop/wms/xfce.nix75
-rw-r--r--modules/desktop/x11.nix20
-rw-r--r--modules/gpg.nix19
-rw-r--r--modules/lan-certs.nix6
-rw-r--r--modules/remote-builder.nix100
-rw-r--r--modules/virt.nix39
-rw-r--r--modules/vpn.nix37
15 files changed, 365 insertions, 287 deletions
diff --git a/modules/btrfs.nix b/modules/btrfs.nix
index 70d35ac..7c4e964 100644
--- a/modules/btrfs.nix
+++ b/modules/btrfs.nix
@@ -1,16 +1,21 @@
-{pkgs, lib, config, ...}:
-let
- cfg = config.addons.btrfs;
-in
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+let
+ cfg = config.addons.btrfs;
+in
{
options.addons.btrfs = {
enable = lib.mkEnableOption "Enable btrfs-related apps and utils";
- };
+ };
config = lib.mkMerge [
(lib.mkIf cfg.enable {
- services.btrfs.autoScrub = {
- enable = true;
+ services.btrfs.autoScrub = {
+ enable = true;
interval = "weekly";
};
})
diff --git a/modules/default.nix b/modules/default.nix
index dc1d2f6..5bbfa3c 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -1,6 +1,12 @@
-{pkgs, lib, config ,...}: {
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+{
imports = [
- ./desktop
+ ./desktop
./virt.nix
./gpg.nix
./btrfs.nix
diff --git a/modules/desktop/common.nix b/modules/desktop/common.nix
index c04a6b0..86cb562 100644
--- a/modules/desktop/common.nix
+++ b/modules/desktop/common.nix
@@ -1,21 +1,27 @@
-{pkgs, config, lib, ...}: {
- options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop";
+{
+ pkgs,
+ config,
+ lib,
+ ...
+}:
+{
+ options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop";
- config = lib.mkIf config.addons.desktop.enable {
+ config = lib.mkIf config.addons.desktop.enable {
programs = {
- dconf.enable = true;
- thunar = {
- enable = true;
- plugins = with pkgs.xfce; [
- thunar-archive-plugin
- thunar-media-tags-plugin
- thunar-volman
+ dconf.enable = true;
+ thunar = {
+ enable = true;
+ plugins = with pkgs.xfce; [
+ thunar-archive-plugin
+ thunar-media-tags-plugin
+ thunar-volman
];
};
};
environment.systemPackages = with pkgs; [
- xdg-user-dirs
+ xdg-user-dirs
zathura
sioyek
vlc
@@ -28,48 +34,46 @@
# surf # A basic browser in case we don't want to import a larger browser
];
-
# Enable CUPS to print documents.
# services.printing.enable = true;
-
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
-
+
services = {
- blueman.enable = true;
- # Enable sound
- pipewire = {
- enable = true;
- pulse.enable = true;
- };
+ blueman.enable = true;
+ # Enable sound
+ pipewire = {
+ enable = true;
+ pulse.enable = true;
+ };
displayManager.sddm = {
- enable=true;
+ enable = true;
#theme = "catppuccin-mocha";
- };
+ };
};
# fcitx is broken for now
# i18n.inputMethod = {
# type = "fcitx5";
- # enable = true;
+ # enable = true;
# fcitx5.addons = with pkgs; [
# fcitx5-gtk
# fcitx5-lua
# fcitx5-mozc
- # catppuccin-fcitx5
+ # catppuccin-fcitx5
# fcitx5-table-other
# kdePackages.fcitx5-qt
- # ];
- # };
+ # ];
+ # };
fonts.packages = with pkgs; [
- noto-fonts
- font-awesome
- nerd-fonts.hurmit
- minecraftia
- ];
+ noto-fonts
+ font-awesome
+ nerd-fonts.hurmit
+ minecraftia
+ ];
};
}
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix
index 4719b5d..be082bc 100644
--- a/modules/desktop/default.nix
+++ b/modules/desktop/default.nix
@@ -1,50 +1,55 @@
-{pkgs, lib, config,...}:
-with lib;
- let
- wmMeta = config.addons.desktop.wmMeta;
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+with lib;
+let
+ wmMeta = config.addons.desktop.wmMeta;
- # Gets all the vm's that are enabled and checks which protocols are used
+ # Gets all the vm's that are enabled and checks which protocols are used
enabledWMs = (filter (wm: wm.enable) (attrValues wmMeta));
- protos = (unique (map (wm: wm.protocol) enabledWMs));
- desktopEnabled = protos != [];
- x11Enabled = elem "x11" protos;
- waylandEnabled = elem "wayland" protos;
+ protos = (unique (map (wm: wm.protocol) enabledWMs));
+ desktopEnabled = protos != [ ];
+ x11Enabled = elem "x11" protos;
+ waylandEnabled = elem "wayland" protos;
-
-in {
+in
+{
imports = [
./common.nix
./x11.nix
./wayland.nix
./wms
./steam.nix
- ];
+ ];
options.addons.desktop = with types; {
- wmMeta = mkOption {
- type = attrsOf (submodule {
- options = {
- enable = mkOption {
- type = bool;
- default = false;
- };
- protocol = mkOption {
- type = str;
- description = "Used display protocol (x11 or wayland)";
- };
+ wmMeta = mkOption {
+ type = attrsOf (submodule {
+ options = {
+ enable = mkOption {
+ type = bool;
+ default = false;
+ };
+ protocol = mkOption {
+ type = str;
+ description = "Used display protocol (x11 or wayland)";
};
- });
- default = {};
- description = "Window manager metadata used for determining which protocol to enable.";
- };
+ };
+ });
+ default = { };
+ description = "Window manager metadata used for determining which protocol to enable.";
+ };
- # enable = lib.mkEnableOption "Whenever any desktop environment is enabled.";
- # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled.";
- # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled.";
+ # enable = lib.mkEnableOption "Whenever any desktop environment is enabled.";
+ # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled.";
+ # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled.";
};
- config.addons.desktop = {
- enable = desktopEnabled;
- x11.enable = x11Enabled;
- wayland.enable = waylandEnabled;
+ config.addons.desktop = {
+ enable = desktopEnabled;
+ x11.enable = x11Enabled;
+ wayland.enable = waylandEnabled;
};
}
diff --git a/modules/desktop/steam.nix b/modules/desktop/steam.nix
index f21a5a3..a78c7c4 100644
--- a/modules/desktop/steam.nix
+++ b/modules/desktop/steam.nix
@@ -1,50 +1,58 @@
-{config, pkgs,lib, ...}: {
+{
+ config,
+ pkgs,
+ lib,
+ ...
+}:
+{
options.addons = {
- steam.enable = lib.mkEnableOption "Enable steam on this machine";
+ steam.enable = lib.mkEnableOption "Enable steam on this machine";
};
- config = lib.mkIf config.addons.steam.enable (lib.mkMerge [
- ({
- assertions = [
- {
- assertion = config.addons.desktop.enable;
- message = "You need a desktop environment to enable Steam!";
- }
- ];
- programs.gamescope = {
- enable = true;
- capSysNice = false; # This needs to be false as to make nested steam stuff work in it.
- };
- programs.steam = {
- enable = true;
- # Done according to the wiki, talks about some unexpected values in a lambda?
- # Doesn't seem to be how overrides work
- # TODO: Figure out how overrides work
- # package = pkgs.steam.override {
- # # withPrimus = true;
- # extraPackages = with pkgs; [bumblebee glxinfo];
- # };
-
- # Gamescope
- gamescopeSession.enable = true;
+ config = lib.mkIf config.addons.steam.enable (
+ lib.mkMerge [
+ ({
+ assertions = [
+ {
+ assertion = config.addons.desktop.enable;
+ message = "You need a desktop environment to enable Steam!";
+ }
+ ];
+ programs.gamescope = {
+ enable = true;
+ capSysNice = false; # This needs to be false as to make nested steam stuff work in it.
+ };
+ programs.steam = {
+ enable = true;
+ # Done according to the wiki, talks about some unexpected values in a lambda?
+ # Doesn't seem to be how overrides work
+ # TODO: Figure out how overrides work
+ # package = pkgs.steam.override {
+ # # withPrimus = true;
+ # extraPackages = with pkgs; [bumblebee glxinfo];
+ # };
- # Open firewall
- remotePlay.openFirewall = true;
- dedicatedServer.openFirewall = true;
- localNetworkGameTransfers.openFirewall = true;
- };
+ # Gamescope
+ gamescopeSession.enable = true;
- # Enable Appimage for some steam games
- programs.appimage.enable = true;
- programs.appimage.binfmt = true;
- })
+ # Open firewall
+ remotePlay.openFirewall = true;
+ dedicatedServer.openFirewall = true;
+ localNetworkGameTransfers.openFirewall = true;
+ };
- (lib.mkIf config.addons.dssktop.x11.enable {
+ # Enable Appimage for some steam games
+ programs.appimage.enable = true;
+ programs.appimage.binfmt = true;
+ })
- })
- (lib.mkIf config.addons.dssktop.wayland.enable {
+ (lib.mkIf config.addons.dssktop.x11.enable {
- })
+ })
+ (lib.mkIf config.addons.dssktop.wayland.enable {
- ]);
+ })
+
+ ]
+ );
}
diff --git a/modules/desktop/wayland.nix b/modules/desktop/wayland.nix
index d7b9651..9197a4e 100644
--- a/modules/desktop/wayland.nix
+++ b/modules/desktop/wayland.nix
@@ -1,12 +1,18 @@
-{pkgs, lib, config, ...}: {
- options.addons.desktop.wayland.enable = lib.mkEnableOption "Enable wayland" ;
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+{
+ options.addons.desktop.wayland.enable = lib.mkEnableOption "Enable wayland";
config = lib.mkIf config.addons.desktop.wayland.enable {
services.displayManager.sddm.wayland.enable = true;
- xdg.portal = {
+ xdg.portal = {
enable = true;
extraPortals = [
- pkgs.xdg-desktop-portal-gtk
+ pkgs.xdg-desktop-portal-gtk
];
};
};
diff --git a/modules/desktop/wms/default.nix b/modules/desktop/wms/default.nix
index 94d0e05..9f7a18d 100644
--- a/modules/desktop/wms/default.nix
+++ b/modules/desktop/wms/default.nix
@@ -1,4 +1,5 @@
-{...}: {
+{ ... }:
+{
imports = [
./hyprland.nix
./xfce.nix
diff --git a/modules/desktop/wms/hyprland.nix b/modules/desktop/wms/hyprland.nix
index 8243b3d..dfc7116 100644
--- a/modules/desktop/wms/hyprland.nix
+++ b/modules/desktop/wms/hyprland.nix
@@ -1,43 +1,52 @@
-{pkgs, lib, config, ...}:
- let cfg = config.addons.desktop.hyprland;
-in {
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+let
+ cfg = config.addons.desktop.hyprland;
+in
+{
options.addons.desktop.hyprland = {
- enable = lib.mkEnableOption "Enable Hyprland";
+ enable = lib.mkEnableOption "Enable Hyprland";
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- (import ../../../utils/makeWm.nix "hyprland" "wayland" )
- {
- programs.hyprland.enable = true;
- programs.hyprland.withUWSM = true;
- programs.uwsm = {
- enable = true;
- waylandCompositors ={
- hyprland = {
- prettyName = "Hyprland";
- comment = "Hyprland compositor managed by UWSM";
- binPath = "/run/current-system/sw/bin/Hyprland";
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ (import ../../../utils/makeWm.nix "hyprland" "wayland")
+ {
+ programs.hyprland.enable = true;
+ programs.hyprland.withUWSM = true;
+ programs.uwsm = {
+ enable = true;
+ waylandCompositors = {
+ hyprland = {
+ prettyName = "Hyprland";
+ comment = "Hyprland compositor managed by UWSM";
+ binPath = "/run/current-system/sw/bin/Hyprland";
+ };
};
};
- };
- environment.systemPackages = with pkgs; [
- hyprland
- hyprshot
- hypridle
- hyprpaper
- hyprpicker
- hyprnotify
- hyprcursor
- hyprpolkitagent
- wofi
- waybar
- waybar-mpris
- mako
- xdg-desktop-portal-gnome
- xdg-desktop-portal-hyprland
- wl-clipboard
- ];
- }
- ]);
-}
+ environment.systemPackages = with pkgs; [
+ hyprland
+ hyprshot
+ hypridle
+ hyprpaper
+ hyprpicker
+ hyprnotify
+ hyprcursor
+ hyprpolkitagent
+ wofi
+ waybar
+ waybar-mpris
+ mako
+ xdg-desktop-portal-gnome
+ xdg-desktop-portal-hyprland
+ wl-clipboard
+ ];
+ }
+ ]
+ );
+}
diff --git a/modules/desktop/wms/xfce.nix b/modules/desktop/wms/xfce.nix
index 0c62ee0..8d29e8a 100644
--- a/modules/desktop/wms/xfce.nix
+++ b/modules/desktop/wms/xfce.nix
@@ -1,37 +1,46 @@
-{pkgs, config, lib, ...}:
-let
- cfg = config.addons.desktop.xfce;
-in {
-
+{
+ pkgs,
+ config,
+ lib,
+ ...
+}:
+let
+ cfg = config.addons.desktop.xfce;
+in
+{
+
options.addons.desktop.xfce = {
enable = lib.mkEnableOption "Enable xfce";
};
-
- config = lib.mkIf cfg.enable (lib.mkMerge [
- (import ../../../utils/makeWm.nix "xfce" "x11" )
- {
- environment.systemPackages = with pkgs; [
- # XFCE stuff
- xfce.catfish
- xfce.xfce4-appfinder
- xfce.xfce4-clipman-plugin
- xfce.xfce4-cpugraph-plugin
- xfce.xfce4-dict
- xfce.xfce4-fsguard-plugin
- xfce.xfce4-genmon-plugin
- xfce.xfce4-netload-plugin
- xfce.xfce4-panel
- xfce.xfce4-pulseaudio-plugin
- xfce.xfce4-systemload-plugin
- xfce.xfce4-weather-plugin
- xfce.xfce4-whiskermenu-plugin
- xfce.xfce4-xkb-plugin
- xfce.xfdashboard
-
- # GNOME stuff
- file-roller
- gnome-disk-utility
- ];
- services.xserver.desktopManager.xfce.enable = true;
- }]);
+
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ (import ../../../utils/makeWm.nix "xfce" "x11")
+ {
+ environment.systemPackages = with pkgs; [
+ # XFCE stuff
+ xfce.catfish
+ xfce.xfce4-appfinder
+ xfce.xfce4-clipman-plugin
+ xfce.xfce4-cpugraph-plugin
+ xfce.xfce4-dict
+ xfce.xfce4-fsguard-plugin
+ xfce.xfce4-genmon-plugin
+ xfce.xfce4-netload-plugin
+ xfce.xfce4-panel
+ xfce.xfce4-pulseaudio-plugin
+ xfce.xfce4-systemload-plugin
+ xfce.xfce4-weather-plugin
+ xfce.xfce4-whiskermenu-plugin
+ xfce.xfce4-xkb-plugin
+ xfce.xfdashboard
+
+ # GNOME stuff
+ file-roller
+ gnome-disk-utility
+ ];
+ services.xserver.desktopManager.xfce.enable = true;
+ }
+ ]
+ );
}
diff --git a/modules/desktop/x11.nix b/modules/desktop/x11.nix
index cdbf3a3..d0f5480 100644
--- a/modules/desktop/x11.nix
+++ b/modules/desktop/x11.nix
@@ -1,11 +1,17 @@
-{pkgs, lib, config, ...}: {
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+{
options.addons.desktop.x11.enable = lib.mkEnableOption "Enabled if X11 is needed for this machine";
config = lib.mkIf config.addons.desktop.x11.enable {
services.xserver = {
- enable = true;
- excludePackages = with pkgs; [
- xterm
- ];
- };
- };
+ enable = true;
+ excludePackages = with pkgs; [
+ xterm
+ ];
+ };
+ };
}
diff --git a/modules/gpg.nix b/modules/gpg.nix
index e7b6984..0fa48e6 100644
--- a/modules/gpg.nix
+++ b/modules/gpg.nix
@@ -1,9 +1,16 @@
-{pkgs, config, lib, ... }:
-let cfg = config.addons.gpg; in
+{
+ pkgs,
+ config,
+ lib,
+ ...
+}:
+let
+ cfg = config.addons.gpg;
+in
{
options.addons.gpg = {
- enable = lib.mkEnableOption "Allow gpg for all users";
- };
+ enable = lib.mkEnableOption "Allow gpg for all users";
+ };
config = lib.mkMerge ([
(lib.mkIf cfg.enable {
@@ -11,8 +18,8 @@ let cfg = config.addons.gpg; in
agent = {
enable = true;
};
- };
+ };
})
]);
-}
+}
diff --git a/modules/lan-certs.nix b/modules/lan-certs.nix
index d2da09d..60d1c20 100644
--- a/modules/lan-certs.nix
+++ b/modules/lan-certs.nix
@@ -1,7 +1,7 @@
-{config, lib, ...}:
+{ config, lib, ... }:
{
options.addons.lan-certs.enable = lib.mkDefault true;
- config = lib.mkIf config.addons.lan-certs.enable {
- security.pki.certificateFiles = [../certs/wilkuu_ca.crt ];
+ config = lib.mkIf config.addons.lan-certs.enable {
+ security.pki.certificateFiles = [ ../certs/wilkuu_ca.crt ];
};
}
diff --git a/modules/remote-builder.nix b/modules/remote-builder.nix
index ddd9a99..ca9b0a1 100644
--- a/modules/remote-builder.nix
+++ b/modules/remote-builder.nix
@@ -1,70 +1,70 @@
-{config, lib,...}:
+{ config, lib, ... }:
let
-cfg = config.addons.remote_builder;
-in
+ cfg = config.addons.remote_builder;
+in
{
options.addons.remote_builder = {
- enable = lib.mkEnableOption "Enable remote builder support";
+ enable = lib.mkEnableOption "Enable remote builder support";
allowedKeyFiles = lib.mkOption {
- default = [];
- example = [../secrets/example.pub];
- description = "Public key files that are allowed on the remote builder";
+ default = [ ];
+ example = [ ../secrets/example.pub ];
+ description = "Public key files that are allowed on the remote builder";
};
allowedKeys = lib.mkOption {
- default = [];
- example = ["ssh-ed25519 ... user@example.com"];
- description = "Public keys that are allowed on the remote builder";
+ default = [ ];
+ example = [ "ssh-ed25519 ... user@example.com" ];
+ description = "Public keys that are allowed on the remote builder";
};
emulatedSystems = lib.mkOption {
- default = [];
- example = ["aarch64-linux"]; # TODO: This probably has a nice type that could be used
- description = "Allow the remote builder to emultate builds for certain architectures";
- };
- openFirewall = lib.mkEnableOption "Forces the ssh port open for the remote builder";
+ default = [ ];
+ example = [ "aarch64-linux" ]; # TODO: This probably has a nice type that could be used
+ description = "Allow the remote builder to emultate builds for certain architectures";
+ };
+ openFirewall = lib.mkEnableOption "Forces the ssh port open for the remote builder";
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- users.users.remotebuild = {
- isSystemUser = true;
- group = "remotebuild";
- useDefaultShell = true;
- # Add keys to remotebuild user.
- openssh.authorizedKeys = {
- keyFiles = cfg.allowedKeyFiles;
- keys = cfg.allowedKeys;
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ users.users.remotebuild = {
+ isSystemUser = true;
+ group = "remotebuild";
+ useDefaultShell = true;
+ # Add keys to remotebuild user.
+ openssh.authorizedKeys = {
+ keyFiles = cfg.allowedKeyFiles;
+ keys = cfg.allowedKeys;
+ };
};
- };
- users.groups.remotebuild = {};
- nix = {
- nrBuildUsers = 64;
- settings = {
- trusted-users = [ "remotebuild" ];
+ users.groups.remotebuild = { };
+ nix = {
+ nrBuildUsers = 64;
+ settings = {
+ trusted-users = [ "remotebuild" ];
- min-free = 10 * 1024 * 1024;
- max-free = 200 * 1024 * 1024;
+ min-free = 10 * 1024 * 1024;
+ max-free = 200 * 1024 * 1024;
- max-jobs = "auto";
- cores = 8;
+ max-jobs = "auto";
+ cores = 8;
+ };
};
- };
-
- boot.binfmt.emulatedSystems = cfg.emulatedSystems;
+ boot.binfmt.emulatedSystems = cfg.emulatedSystems;
- # TODO: Make a good default module for ssh.
- services.openssh = {
- enable = true;
- settings.AllowUsers = ["remotebuild"];
- };
- }
-
- # Open firewall for ssh if not open already, not really recommended unless the server is meant to be public.
- (lib.mkIf cfg.openFirewall {
- services.openssh.openFirewall = lib.mkForce true;
- })
- ]);
+ # TODO: Make a good default module for ssh.
+ services.openssh = {
+ enable = true;
+ settings.AllowUsers = [ "remotebuild" ];
+ };
+ }
+ # Open firewall for ssh if not open already, not really recommended unless the server is meant to be public.
+ (lib.mkIf cfg.openFirewall {
+ services.openssh.openFirewall = lib.mkForce true;
+ })
+ ]
+ );
}
diff --git a/modules/virt.nix b/modules/virt.nix
index 597b957..53bd70a 100644
--- a/modules/virt.nix
+++ b/modules/virt.nix
@@ -1,34 +1,39 @@
-{pkgs, config, lib, ...}:
-let
- cfg = config.addons.virtualisation;
-in
+{
+ pkgs,
+ config,
+ lib,
+ ...
+}:
+let
+ cfg = config.addons.virtualisation;
+in
{
options.addons.virtualisation = {
- host = lib.mkEnableOption "Allow to host vm's and containers";
- guest = lib.mkEnableOption "Enable guest agents";
- };
+ host = lib.mkEnableOption "Allow to host vm's and containers";
+ guest = lib.mkEnableOption "Enable guest agents";
+ };
- config = lib.mkMerge([
+ config = lib.mkMerge ([
(lib.mkIf cfg.host {
- environment.systemPackages = with pkgs; [
- qemu
- ];
+ environment.systemPackages = with pkgs; [
+ qemu
+ ];
programs.virt-manager.enable = true;
virtualisation = {
- spiceUSBRedirection.enable = true;
+ spiceUSBRedirection.enable = true;
docker.enable = true;
libvirtd = {
enable = true;
qemu = {
- swtpm.enable = true;
+ swtpm.enable = true;
vhostUserPackages = with pkgs; [ virtiofsd ];
};
};
- };
-
+ };
+
})
(lib.mkIf cfg.guest {
- services.spice-vdagentd.enable = true;
+ services.spice-vdagentd.enable = true;
})
]);
-}
+}
diff --git a/modules/vpn.nix b/modules/vpn.nix
index 1aaaa6e..b1b7463 100644
--- a/modules/vpn.nix
+++ b/modules/vpn.nix
@@ -1,10 +1,15 @@
-{config, pkgs, lib, ...}:
+{
+ config,
+ pkgs,
+ lib,
+ ...
+}:
let
desktop = config.addons.desktop;
- cfg = config.addons.vpn;
- opt-mullvad = config.addons.vpn.mullvad;
-in
-{
+ cfg = config.addons.vpn;
+ opt-mullvad = config.addons.vpn.mullvad;
+in
+{
options.addons.vpn = {
eduvpn.enable = lib.mkEnableOption "Enable eduvpn";
mullvad.enable = lib.mkEnableOption "Enable mullvad vpn";
@@ -15,15 +20,17 @@ in
(lib.mkIf cfg.eduvpn.enable {
networking.networkmanager.plugins = [ pkgs.networkmanager-openvpn ];
})
- (lib.mkIf desktop.enable (lib.mkMerge [
- (lib.mkIf opt-mullvad.enable {
- services.mullvad-vpn.package = pkgs.mullvad-vpn;
- })
- (lib.mkIf cfg.eduvpn.enable {
- environment.systemPackages = with pkgs; [
- eduvpn-client
- ];
- })
- ]))
+ (lib.mkIf desktop.enable (
+ lib.mkMerge [
+ (lib.mkIf opt-mullvad.enable {
+ services.mullvad-vpn.package = pkgs.mullvad-vpn;
+ })
+ (lib.mkIf cfg.eduvpn.enable {
+ environment.systemPackages = with pkgs; [
+ eduvpn-client
+ ];
+ })
+ ]
+ ))
];
}