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 = [
inputs.sops-nix.homeManagerModules.sops
../../modules/lib.nix
../../modules/ai-tools.nix
../../modules/cloud
../../modules/comms

View File

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

View File

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

View File

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

View File

@@ -1,12 +1,13 @@
{ pkgs, config, lib, dotsPath, ... }:
{
pkgs,
config,
dotsPath,
...
}:
{
config = {
home.packages = [
(if config.lib ? nixGL
then config.lib.nixGL.wrap pkgs.kitty
else pkgs.kitty)
];
home.packages = [ (config.nixgl.wrap pkgs.kitty) ];
programs.bash.shellAliases = {
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; [
ncspot
# (if config.lib ? nixGL then config.lib.nixGL.wrap spotify else spotify)
spotifyWithWayland
];
home.file = {