make nix-ld more modular

This commit is contained in:
Daylin Morgan 2024-07-07 14:32:46 -05:00
parent 05b1c15ec1
commit 922fe7de73
Signed by: daylin
GPG key ID: 950D13E9719334AD
4 changed files with 130 additions and 94 deletions

View file

@ -1,17 +1,16 @@
{ enableAttrs, ... }: { enabled, ... }:
{ {
oizys = oizys = {
(enableAttrs [ vpn = enabled;
"vpn" desktop = enabled;
"desktop" hyprland = enabled;
"hyprland" chrome = enabled;
"chrome" docker = enabled;
"docker" nix-ld = enabled // {
"nix-ld" overkill = enabled;
"vbox" };
"backups" vbox = enabled;
]) backups = enabled;
// {
languages = [ languages = [
"misc" "misc"
"nim" "nim"

View file

@ -34,7 +34,8 @@ let
inputs inputs
lib lib
self self
enabled; enabled
;
}; };
}; };
mkSystem = mkSystem =

View file

@ -5,18 +5,35 @@
... ...
}: }:
let let
inherit (lib) mkEnableOption mkIf; inherit (lib)
mkEnableOption
mkIf
mkOption
literalExpression
types
;
cfg = config.oizys.nix-ld; 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: # https://github.com/NixOS/nixpkgs/blob/a4f437f0f5db62e6bcd7979c10eab177dd0fa188/nixos/modules/programs/nix-ld.nix#L44-L59
# Geneious Prime defaultLibraries = with pkgs; [
# list from https://github.com/Mic92/dotfiles/blob/cb180bdd3805b373e556a93ccb275b7f0f902a3b/nixos/modules/nix-ld.nix#L9C3-L60C5 zlib
programs.nix-ld.libraries = with pkgs; [ zstd
stdenv.cc.cc
curl
openssl
attr
libssh
bzip2
libxml2
acl
libsodium
util-linux
xz
systemd
];
# https://github.com/Mic92/dotfiles/blob/340152bdf4bd193269474426ca5d90c479aae0b7/nixos/modules/nix-ld.nix#L7-L58
overkillLibraries = with pkgs; [
alsa-lib alsa-lib
at-spi2-atk at-spi2-atk
at-spi2-core at-spi2-core
@ -48,7 +65,7 @@ in
nss nss
openssl openssl
pango pango
# pipewire pipewire
stdenv.cc.cc stdenv.cc.cc
systemd systemd
vulkan-loader vulkan-loader
@ -68,5 +85,29 @@ in
xorg.libxshmfence xorg.libxshmfence
zlib zlib
]; ];
in
{
options.oizys.nix-ld = {
enable = mkEnableOption "enable nix-ld support";
extra-libraries = mkOption {
type = types.listOf types.package;
description = "Libraries that automatically become available to all programs.";
default = [ ];
defaultText = literalExpression "baseLibraries derived from systemd and nix dependencies.";
}; };
overkill.enable = mkEnableOption "enable overkill list of libraries";
};
config =
mkIf cfg.enable
{
programs.nix-ld.enable = true;
programs.nix-ld.libraries =
defaultLibraries ++ cfg.extra-libraries ++ (if cfg.overkill.enable then overkillLibraries else [ ]);
};
} }

View file

@ -2,11 +2,6 @@
## oizys ## oizys
- [ ] make interoperable with a single command so first installation can be ran by root as:
```sh
nix --extra-experimental-features 'flakes nix-command' run "github:daylinmorgan/oiyzs" switch --host <host>
```
## software ## software
- [ ] lid closed does not engage hyprlock? - [ ] lid closed does not engage hyprlock?