Compare commits

..

5 commits

Author SHA1 Message Date
b3b0098eb5 several nixgl things 2024-04-22 17:50:39 +02:00
8346071197 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/4cec20dbf5c0a716115745ae32531e34816ecbbe?narHash=sha256-2RSqVmQMFmn6OjQ21SXnWC%2BHuSeqDLWLftRv/ZhEDZE%3D' (2024-04-21)
  → 'github:nix-community/home-manager/670d9ecc3e46a6e3265c203c2d136031a3d3548e?narHash=sha256-AYCofb8Zu4Mbc1lHDtju/uxeARawRijmOueAqEMEfMU%3D' (2024-04-21)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5c24cf2f0a12ad855f444c30b2421d044120c66f?narHash=sha256-XtTSSIB2DA6tOv%2Bl0FhvfDMiyCmhoRbNB%2B0SeInZkbk%3D' (2024-04-19)
  → 'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932?narHash=sha256-%2Bz/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y%3D' (2024-04-21)
2024-04-22 13:17:24 +02:00
27468ae036 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/057117a401a34259c9615ce62218aea7afdee4d3?narHash=sha256-7Y91t8pheIzjJveUMAPyeh5NOq5F49Nq4Hl2532QpJs%3D' (2024-04-19)
  → 'github:nix-community/home-manager/4cec20dbf5c0a716115745ae32531e34816ecbbe?narHash=sha256-2RSqVmQMFmn6OjQ21SXnWC%2BHuSeqDLWLftRv/ZhEDZE%3D' (2024-04-21)
2024-04-21 14:40:32 +02:00
0889840483 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/938357cb234e85da37109df2cdd9cc59ab9c1cc0?narHash=sha256-zju60y4pyYQoRmqhbgkw%2BjwmKZReVsCNvb8mZxID2Do%3D' (2024-04-19)
  → 'github:nix-community/home-manager/057117a401a34259c9615ce62218aea7afdee4d3?narHash=sha256-7Y91t8pheIzjJveUMAPyeh5NOq5F49Nq4Hl2532QpJs%3D' (2024-04-19)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/66adc1e47f8784803f2deb6cacd5e07264ec2d5c?narHash=sha256-hOkzkhLT59wR8VaMbh1ESjtZLbGi%2BXNaBN6h49SPqEc%3D' (2024-04-16)
  → 'github:NixOS/nixpkgs/5c24cf2f0a12ad855f444c30b2421d044120c66f?narHash=sha256-XtTSSIB2DA6tOv%2Bl0FhvfDMiyCmhoRbNB%2B0SeInZkbk%3D' (2024-04-19)
2024-04-20 15:11:17 +02:00
da5bed9c80 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/178e26895b3aef028a00a32fb7e7ed0fc660645c?narHash=sha256-vbXq52VRlL1defMHrwhsoeHm95O3mFefsSSJyNEghbA%3D' (2024-04-18)
  → 'github:nix-community/home-manager/938357cb234e85da37109df2cdd9cc59ab9c1cc0?narHash=sha256-zju60y4pyYQoRmqhbgkw%2BjwmKZReVsCNvb8mZxID2Do%3D' (2024-04-19)
• Updated input 'nixgl':
    'github:guibou/nixGL/d709a8abcde5b01db76ca794280745a43c8662be?narHash=sha256-V1o2bCZdeYKP/0zgVp4EN0KUjMItAMk6J7SvCXUI5IU%3D' (2024-03-19)
  → 'github:guibou/nixGL/310f8e49a149e4c9ea52f1adf70cdc768ec53f8a?narHash=sha256-lnzZQYG0%2BEXl/6NkGpyIz%2BFEOc/DSEG57AP1VsdeNrM%3D' (2024-04-19)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5672bc9dbf9d88246ddab5ac454e82318d094bb8?narHash=sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U%2BISA%3D' (2024-04-16)
  → 'github:NixOS/nixpkgs/66adc1e47f8784803f2deb6cacd5e07264ec2d5c?narHash=sha256-hOkzkhLT59wR8VaMbh1ESjtZLbGi%2BXNaBN6h49SPqEc%3D' (2024-04-16)
2024-04-19 19:42:32 +02:00
4 changed files with 65 additions and 27 deletions

View file

@ -1,6 +1,8 @@
{ ... }: { pkgs, config, lib, inputs, ... }:
{ let
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
in {
imports = [ ./../../home-manager/modules/machine.nix ]; imports = [ ./../../home-manager/modules/machine.nix ];
machine = { machine = {
@ -14,4 +16,11 @@
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nixGLPrefix = lib.getExe pkgs.nixgl.nixGLIntel;
home.packages = with pkgs; [
(nixGL insomnia)
(nixGL inputs.muse-sounds-manager.packages.x86_64-linux.muse-sounds-manager)
];
} }

View file

@ -93,11 +93,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713453913, "lastModified": 1713732794,
"narHash": "sha256-vbXq52VRlL1defMHrwhsoeHm95O3mFefsSSJyNEghbA=", "narHash": "sha256-AYCofb8Zu4Mbc1lHDtju/uxeARawRijmOueAqEMEfMU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "178e26895b3aef028a00a32fb7e7ed0fc660645c", "rev": "670d9ecc3e46a6e3265c203c2d136031a3d3548e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -215,11 +215,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1710868679, "lastModified": 1713543440,
"narHash": "sha256-V1o2bCZdeYKP/0zgVp4EN0KUjMItAMk6J7SvCXUI5IU=", "narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=",
"owner": "guibou", "owner": "guibou",
"repo": "nixGL", "repo": "nixGL",
"rev": "d709a8abcde5b01db76ca794280745a43c8662be", "rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -281,11 +281,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1713248628, "lastModified": 1713714899,
"narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=", "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8", "rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -55,6 +55,15 @@ with lib; {
description = "Whether to enable noise suppression or not"; description = "Whether to enable noise suppression or not";
}; };
}; };
nixGLPrefix = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Will be prepended to commands which require working OpenGL.
This needs to be set to the right nixGL package on non-NixOS systems.
'';
};
}; };
config = { config = {

View file

@ -1,17 +1,37 @@
{ pkgs, lib, ... }: # Call once on import to load global context
{
pkgs,
config,
}:
# Wrap a single package
pkg:
if config.nixGLPrefix == ""
then pkg
else
# Wrap the package's binaries with nixGL, while preserving the rest of
# the outputs and derivation attributes.
(pkg.overrideAttrs (old: {
name = "nixGL-${pkg.name}";
buildCommand = ''
set -eo pipefail
let nixgl = import <nixgl> { }; ${
in pkg: # Heavily inspired by https://stackoverflow.com/a/68523368/6259505
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } '' pkgs.lib.concatStringsSep "\n" (map (outputName: ''
mkdir $out echo "Copying output ${outputName}"
ln -s ${pkg}/* $out set -x
rm $out/bin cp -rs --no-preserve=mode "${pkg.${outputName}}" "''$${outputName}"
mkdir $out/bin set +x
for bin in ${pkg}/bin/*; do '') (old.outputs or ["out"]))
wrapped_bin=$out/bin/$(basename $bin) }
echo -e "#!/bin/bash\nexec ${
lib.getExe nixgl.auto.nixGLDefault rm -rf $out/bin/*
} $bin \$@" > $wrapped_bin shopt -s nullglob # Prevent loop from running if no files
chmod +x $wrapped_bin for file in ${pkg.out}/bin/*; do
echo "#!${pkgs.bash}/bin/bash" > "$out/bin/$(basename $file)"
echo "exec -a \"\$0\" ${config.nixGLPrefix} $file \"\$@\"" >> "$out/bin/$(basename $file)"
chmod +x "$out/bin/$(basename $file)"
done done
'' shopt -u nullglob # Revert nullglob back to its normal default state
'';
}))