From 5e49f286e602f86fb61d9c62e47cca2951ac4308 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 19 Mar 2024 07:24:30 -0500 Subject: [PATCH] add enable function --- hosts/othalan/default.nix | 15 +++-- lib/extended.nix | 2 + modules/common.nix | 2 + modules/nix-ld.nix | 125 +++++++++++++++++++++----------------- 4 files changed, 81 insertions(+), 63 deletions(-) diff --git a/hosts/othalan/default.nix b/hosts/othalan/default.nix index 73f9041..107275c 100644 --- a/hosts/othalan/default.nix +++ b/hosts/othalan/default.nix @@ -1,18 +1,17 @@ { pkgs, self, + lib, ... -}: { +}: let + inherit (lib) enabled; +in { imports = with self.nixosModules; [ - nix-ld restic docker ]; oizys = { - vbox.enable = true; - desktop.enable = true; - vpn.enable = true; languages = [ "misc" "python" @@ -20,7 +19,11 @@ "tex" "node" ]; - chrome.enable = true; + nix-ld = enabled; + vbox = enabled; + desktop = enabled; + vpn = enabled; + chrome = enabled; }; environment.systemPackages = with pkgs; [ diff --git a/lib/extended.nix b/lib/extended.nix index 7d7a17c..9598079 100644 --- a/lib/extended.nix +++ b/lib/extended.nix @@ -2,6 +2,8 @@ final: prev: let inherit (final) hasSuffix; runes = import ../modules/runes; in { + enabled = {enable = true;}; + disabled = {enable = false;}; isNixFile = path: hasSuffix ".nix" path; mkIfIn = name: list: prev.mkIf (builtins.elem name list); mkRune = { diff --git a/modules/common.nix b/modules/common.nix index 21e7127..38b0736 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -28,6 +28,8 @@ # programs chrome vscode + + nix-ld ]; options.oizys.desktop.enable = lib.mkEnableOption "is desktop"; diff --git a/modules/nix-ld.nix b/modules/nix-ld.nix index be6fe3e..e642fdb 100644 --- a/modules/nix-ld.nix +++ b/modules/nix-ld.nix @@ -1,59 +1,70 @@ -{pkgs, ...}: { - programs.nix-ld.enable = true; +{ + pkgs, + lib, + config, + ... +}: let + inherit (lib) mkEnableOption mkIf; + cfg = config.oizys.nix-ld; +in { + options.oizys.nix-ld.enable = mkEnableOption "enable nix-ld support"; + config = mkIf cfg.enable { + programs.nix-ld.enable = true; - # Packages that need at least something in this list: - # Geneious Prime - # https://github.com/Mic92/dotfiles/blob/cb180bdd3805b373e556a93ccb275b7f0f902a3b/nixos/modules/nix-ld.nix#L9C3-L60C5 - programs.nix-ld.libraries = with pkgs; [ - alsa-lib - at-spi2-atk - at-spi2-core - atk - cairo - cups - curl - dbus - expat - fontconfig - freetype - fuse3 - gdk-pixbuf - glib - gtk3 - icu - libGL - libappindicator-gtk3 - libdrm - libglvnd - libnotify - libpulseaudio - libunwind - libusb1 - libuuid - libxkbcommon - mesa - nspr - nss - openssl - pango - pipewire - stdenv.cc.cc - systemd - vulkan-loader - xorg.libX11 - xorg.libXScrnSaver - xorg.libXcomposite - xorg.libXcursor - xorg.libXdamage - xorg.libXext - xorg.libXfixes - xorg.libXi - xorg.libXrandr - xorg.libXrender - xorg.libXtst - xorg.libxcb - xorg.libxkbfile - xorg.libxshmfence - zlib - ]; + # Packages that need at least something in this list: + # Geneious Prime + # https://github.com/Mic92/dotfiles/blob/cb180bdd3805b373e556a93ccb275b7f0f902a3b/nixos/modules/nix-ld.nix#L9C3-L60C5 + programs.nix-ld.libraries = with pkgs; [ + alsa-lib + at-spi2-atk + at-spi2-core + atk + cairo + cups + curl + dbus + expat + fontconfig + freetype + fuse3 + gdk-pixbuf + glib + gtk3 + icu + libGL + libappindicator-gtk3 + libdrm + libglvnd + libnotify + libpulseaudio + libunwind + libusb1 + libuuid + libxkbcommon + mesa + nspr + nss + openssl + pango + pipewire + stdenv.cc.cc + systemd + vulkan-loader + xorg.libX11 + xorg.libXScrnSaver + xorg.libXcomposite + xorg.libXcursor + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXi + xorg.libXrandr + xorg.libXrender + xorg.libXtst + xorg.libxcb + xorg.libxkbfile + xorg.libxshmfence + zlib + ]; + }; }