namespace options under oizys

This commit is contained in:
Daylin Morgan 2024-02-27 10:11:44 -06:00
parent 1da7e1ff0b
commit 6e3aa008df
Signed by: daylin
GPG Key ID: 3CD66E04B8072F3E
17 changed files with 94 additions and 74 deletions

View File

@ -12,7 +12,6 @@
nim = true; nim = true;
python = true; python = true;
}; };
cli.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
rclone rclone

View File

@ -3,7 +3,7 @@
nix-ld nix-ld
]; ];
desktop.enable = true; oizys.desktop.enable = true;
cli.enable = true; cli.enable = true;
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver = { services.xserver = {

View File

@ -10,17 +10,20 @@
docker docker
]; ];
cli.enable = true; oizys = {
desktop.enable = true; desktop.enable = true;
vpn.enable = true;
languages = [
"misc"
"python"
"nim"
"tex"
"node"
];
};
vivaldi.enable = true; vivaldi.enable = true;
languages = {
misc = true;
python = true;
nim = true;
tex = true;
node = true;
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
zk zk
@ -30,8 +33,6 @@
programs.hyprland.enable = true; programs.hyprland.enable = true;
services.vpn.enable = true;
services.restic.backups.gdrive = { services.restic.backups.gdrive = {
user = "daylin"; user = "daylin";
repository = "rclone:g:archives/othalan"; repository = "rclone:g:archives/othalan";

View File

@ -21,17 +21,12 @@
gui gui
# langs languages
python
misc
node
tex
nim
# programs # programs
vivaldi vivaldi
vscode vscode
]; ];
options.desktop.enable = lib.mkEnableOption "is desktop"; options.oizys.desktop.enable = lib.mkEnableOption "is desktop";
} }

View File

@ -5,7 +5,7 @@
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.desktop; cfg = config.oizys.desktop;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;

View File

@ -5,7 +5,7 @@
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.desktop; cfg = config.oizys.desktop;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@ -4,10 +4,15 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkOption mkIf types;
cfg = config.cli; cfg = config.oizys.cli;
in { in {
options.cli.enable = mkEnableOption "cli"; options.oizys.cli.enable = mkOption {
default = true;
description = "Whether to enable cli.";
type = types.bool;
};
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.direnv.enable = true; programs.direnv.enable = true;
environment.sessionVariables = { environment.sessionVariables = {

View File

@ -5,7 +5,7 @@
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.desktop; cfg = config.oizys.desktop;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@ -1,17 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.languages;
in {
options.languages.misc = mkEnableOption "go + rustup";
config = mkIf cfg.misc {
environment.systemPackages = with pkgs; [
go
rustup
];
};
}

View File

@ -1,16 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.languages;
in {
options.languages.tex = mkEnableOption "tex";
config = mkIf cfg.tex {
environment.systemPackages = with pkgs; [
texlive.combined.scheme-full
];
};
}

View File

@ -0,0 +1,24 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkOption types literalExpression mdDoc;
cfg = config.oizys.languages;
in {
imports = [./nim.nix ./tex.nix ./misc.nix ./node.nix ./python.nix];
options.oizys.languages = mkOption {
type = with types; nullOr (listOf str);
description = lib.mdDoc ''
List of programming languages to enable.
'';
default = null;
example = literalExpression ''
[
"python"
"nim"
]
'';
};
}

View File

@ -0,0 +1,16 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
cfg = config.oizys.languages;
in {
config = mkIf (builtins.elem "misc" cfg) {
environment.systemPackages = with pkgs; [
go
rustup
];
};
}

View File

@ -4,11 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkIf;
cfg = config.languages; cfg = config.oizys.languages;
in { in {
options.languages.nim = mkEnableOption "nim"; config = mkIf (builtins.elem "nim" cfg) {
config = mkIf cfg.nim {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nim nim

View File

@ -4,11 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkIf;
cfg = config.languages; cfg = config.oizys.languages;
in { in {
options.languages.node = mkEnableOption "node"; config = mkIf (builtins.elem "node" cfg) {
config = mkIf cfg.node {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nodejs nodejs
nodePackages.pnpm nodePackages.pnpm

View File

@ -4,11 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkIf;
cfg = config.languages; cfg = config.oizys.languages;
in { in {
options.languages.python = mkEnableOption "python"; config = mkIf (builtins.elem "python" cfg) {
config = mkIf cfg.python {
environment.systemPackages = let environment.systemPackages = let
python = pkgs.python3.withPackages (ps: with ps; [pip]); python = pkgs.python3.withPackages (ps: with ps; [pip]);
in in

16
modules/languages/tex.nix Normal file
View File

@ -0,0 +1,16 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
# cfg = config.oizys.languages;
langEnabled = name: builtins.elem name config.oizys.languages;
in {
config = mkIf (langEnabled "tex") {
environment.systemPackages = with pkgs; [
texlive.combined.scheme-full
];
};
}

View File

@ -5,10 +5,10 @@
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
cfg = config.services.vpn; cfg = config.oizys.vpn;
in { in {
options.services.vpn.enable = mkEnableOption '' options.oizys.vpn.enable = mkEnableOption ''
use openconnect vpn Whether to enable openconnect for vpn connection.
''; '';
config = mkIf cfg.enable { config = mkIf cfg.enable {