refactor(nixGL): extract 'nixGL' wrapper

This commit is contained in:
2026-02-13 11:02:42 +01:00
parent 833d999027
commit 385fcb3ee1
7 changed files with 35 additions and 18 deletions

View File

@@ -11,6 +11,7 @@ in
{ {
imports = [ imports = [
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
../../modules/lib.nix
../../modules/ai-tools.nix ../../modules/ai-tools.nix
../../modules/cloud ../../modules/cloud
../../modules/comms ../../modules/comms

View File

@@ -1,9 +1,9 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
useNixGL = config.lib ? nixGL; needsNixGL = config.lib ? nixGL;
brunoBase = bruno =
if useNixGL then if needsNixGL then
pkgs.bruno.overrideAttrs (old: { pkgs.bruno.overrideAttrs (old: {
postInstall = (old.postInstall or "") + '' postInstall = (old.postInstall or "") + ''
wrapProgram $out/bin/bruno --add-flags "--no-sandbox" wrapProgram $out/bin/bruno --add-flags "--no-sandbox"
@@ -11,10 +11,9 @@ let
}) })
else else
pkgs.bruno; pkgs.bruno;
brunoFinal = if useNixGL then config.lib.nixGL.wrap brunoBase else brunoBase;
in in
{ {
config = { config = {
home.packages = [ brunoFinal ]; home.packages = [ (config.nixgl.wrap bruno) ];
}; };
} }

View File

@@ -6,8 +6,6 @@
}: }:
{ {
config = lib.mkIf config.comms.signal.enable { config = lib.mkIf config.comms.signal.enable {
home.packages = with pkgs; [ home.packages = [ (config.nixgl.wrap pkgs.signal-desktop) ];
(if config.lib ? nixGL then config.lib.nixGL.wrap signal-desktop else signal-desktop)
];
}; };
} }

View File

@@ -7,8 +7,6 @@
{ {
config = lib.mkIf config.comms.teams.enable { config = lib.mkIf config.comms.teams.enable {
home.packages = with pkgs; [ home.packages = [ (config.nixgl.wrap pkgs.teams-for-linux) ];
(if config.lib ? nixGL then config.lib.nixGL.wrap teams-for-linux else teams-for-linux)
];
}; };
} }

View File

@@ -1,12 +1,13 @@
{ pkgs, config, lib, dotsPath, ... }: {
pkgs,
config,
dotsPath,
...
}:
{ {
config = { config = {
home.packages = [ home.packages = [ (config.nixgl.wrap pkgs.kitty) ];
(if config.lib ? nixGL
then config.lib.nixGL.wrap pkgs.kitty
else pkgs.kitty)
];
programs.bash.shellAliases = { programs.bash.shellAliases = {
icat = "kitty +kitten icat"; icat = "kitty +kitten icat";
}; };

9
home/modules/lib.nix Normal file
View File

@@ -0,0 +1,9 @@
{ config, lib, ... }:
{
options.nixgl.wrap = lib.mkOption {
type = lib.types.functionTo lib.types.package;
default = if config.lib ? nixGL then config.lib.nixGL.wrap else lib.id;
readOnly = true;
};
}

View File

@@ -4,10 +4,21 @@
... ...
}: }:
let
spotifyWithWayland = pkgs.symlinkJoin {
name = "spotify";
paths = [ pkgs.spotify ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/spotify \
--add-flags "--enable-features=UseOzonePlatform --ozone-platform=wayland"
'';
};
in
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
ncspot ncspot
# (if config.lib ? nixGL then config.lib.nixGL.wrap spotify else spotify) spotifyWithWayland
]; ];
home.file = { home.file = {