mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 18:30:43 -06:00
reduce boilerplate with mkOizysModule
This commit is contained in:
parent
ff7f8495f6
commit
55f2e625ec
10 changed files with 41 additions and 55 deletions
|
@ -1,5 +1,5 @@
|
||||||
final: prev: let
|
final: prev: let
|
||||||
inherit (final) hasSuffix;
|
inherit (final) hasSuffix mkEnableOption mkIf;
|
||||||
runes = import ../modules/runes;
|
runes = import ../modules/runes;
|
||||||
in rec {
|
in rec {
|
||||||
enabled = {enable = true;};
|
enabled = {enable = true;};
|
||||||
|
@ -28,4 +28,9 @@ in rec {
|
||||||
runeKind ? "braille",
|
runeKind ? "braille",
|
||||||
}:
|
}:
|
||||||
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n[0m";
|
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n[0m";
|
||||||
|
|
||||||
|
mkOizysModule = config: attr: content: {
|
||||||
|
options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support";
|
||||||
|
config = mkIf config.oizys.${attr}.enable content;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
cfg = config.oizys.desktop;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf config.oizys.desktop.enable {
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
fonts.packages = with pkgs; [
|
fonts.packages = with pkgs; [
|
||||||
(nerdfonts.override {fonts = ["FiraCode"];})
|
(nerdfonts.override {fonts = ["FiraCode"];})
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
cfg = config.oizys.desktop;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf config.oizys.desktop.enable {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
wezterm
|
wezterm
|
||||||
alacritty
|
alacritty
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkOizysModule;
|
||||||
cfg = config.programs.hyprland;
|
|
||||||
|
|
||||||
lock = pkgs.writeShellApplication {
|
lock = pkgs.writeShellApplication {
|
||||||
name = "lock";
|
name = "lock";
|
||||||
runtimeInputs = with pkgs; [swaylock];
|
runtimeInputs = with pkgs; [swaylock];
|
||||||
|
@ -15,10 +13,8 @@
|
||||||
swaylock -c 1e1e2e
|
swaylock -c 1e1e2e
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in mkOizysModule config "hyprland" {
|
||||||
config = mkIf cfg.enable {
|
|
||||||
security.pam.services.swaylock = {};
|
security.pam.services.swaylock = {};
|
||||||
# programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.default;
|
|
||||||
# Optional, hint electron apps to use wayland:
|
# Optional, hint electron apps to use wayland:
|
||||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||||
|
|
||||||
|
@ -52,5 +48,4 @@ in {
|
||||||
inputs.nixpkgs-wayland.overlay
|
inputs.nixpkgs-wayland.overlay
|
||||||
inputs.hyprland.overlays.default
|
inputs.hyprland.overlays.default
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
cfg = config.oizys.desktop;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf config.oizys.desktop.enable {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# vscode
|
# vscode
|
||||||
vscode-fhs
|
vscode-fhs
|
||||||
|
|
|
@ -4,14 +4,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkIf;
|
inherit (lib) mkOizysModule;
|
||||||
cfg = config.oizys.vpn;
|
in mkOizysModule config "vpn" {
|
||||||
in {
|
|
||||||
options.oizys.vpn.enable = mkEnableOption ''
|
|
||||||
Whether to enable openconnect for vpn connection.
|
|
||||||
'';
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
environment.systemPackages = [pkgs.openconnect];
|
environment.systemPackages = [pkgs.openconnect];
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -4,11 +4,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf mkEnableOption;
|
inherit (lib) mkOizysModule;
|
||||||
cfg = config.oizys.chrome;
|
in mkOizysModule config "chrome" {
|
||||||
in {
|
|
||||||
options.oizys.chrome.enable = mkEnableOption "enable chrome + extensions";
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
programs.chromium = {
|
programs.chromium = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
@ -29,5 +26,4 @@ in {
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkIf;
|
inherit (lib) mkOizysModule;
|
||||||
cfg = config.oizys.backups;
|
in
|
||||||
in {
|
mkOizysModule config "backups" {
|
||||||
options.oizys.backups.enable = mkEnableOption "enable restic/rclone backups";
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
environment.systemPackages = with pkgs; [rclone];
|
environment.systemPackages = with pkgs; [rclone];
|
||||||
|
|
||||||
services.restic.backups.gdrive = {
|
services.restic.backups.gdrive = {
|
||||||
|
@ -36,5 +34,4 @@ in {
|
||||||
RandomizedDelaySec = "5h";
|
RandomizedDelaySec = "5h";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -4,15 +4,22 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkIf;
|
inherit (lib) mkOizysModule;
|
||||||
cfg = config.oizys.docker;
|
in
|
||||||
in {
|
mkOizysModule config "docker" {
|
||||||
options.oizys.docker.enable = mkEnableOption "enable docker support";
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
lazydocker
|
lazydocker
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
}
|
# in {
|
||||||
|
# options.oizys.docker.enable = mkEnableOption "enable docker support";
|
||||||
|
#
|
||||||
|
# config = mkIf cfg.enable {
|
||||||
|
# virtualisation.docker.enable = true;
|
||||||
|
# environment.systemPackages = with pkgs; [
|
||||||
|
# lazydocker
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,11 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkIf;
|
inherit (lib) mkOizysModule;
|
||||||
cfg = config.oizys.vbox;
|
in
|
||||||
in {
|
mkOizysModule config "vbox" {
|
||||||
options.oizys.vbox.enable = mkEnableOption "enable virtualbox host";
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
virtualisation.virtualbox = {
|
virtualisation.virtualbox = {
|
||||||
host.enable = true;
|
host.enable = true;
|
||||||
};
|
};
|
||||||
users.extraGroups.vboxusers.members = ["daylin"];
|
users.extraGroups.vboxusers.members = ["daylin"];
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue