laptop: add IDEA wrappers

This commit is contained in:
Lgmrszd 2025-01-19 16:25:40 +04:00
parent e24934ae66
commit 012afecf57
No known key found for this signature in database
GPG key ID: 9396B8BA6FBB14DE
3 changed files with 47 additions and 10 deletions

View file

@ -49,6 +49,7 @@
}: }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
mylib = import ./lib;
overlay-stable = final: prev: { overlay-stable = final: prev: {
stable = import nixpkgs-stable { stable = import nixpkgs-stable {
inherit system; inherit system;
@ -75,7 +76,7 @@
in in
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit data; }; specialArgs = { inherit data; inherit mylib; };
modules = [ modules = [
{ nixpkgs.overlays = my-overlays; } { nixpkgs.overlays = my-overlays; }
./hosts/${host}/configuration.nix ./hosts/${host}/configuration.nix
@ -94,6 +95,7 @@
./hosts/${host}/home ./hosts/${host}/home
] ++ extra-home-modules; ] ++ extra-home-modules;
}; };
home-manager.extraSpecialArgs = { inherit mylib; };
} }
]) ])
; ;

View file

@ -1,4 +1,4 @@
{ config, osConfig, pkgs, ... }: { config, osConfig, pkgs, mylib, ... }:
{ {
home.username = "lgm"; home.username = "lgm";
@ -93,14 +93,20 @@
minetest minetest
# dev # dev
# Wrap idea-community to add libraries required for Minecraft Moddev # Wrap idea-community to add libraries required for Minecraft Moddev
(symlinkJoin { stable.jetbrains.idea-community
name = "idea-community"; (mylib.appwrapper {
paths = [ jetbrains.idea-community ]; inherit pkgs;
buildInputs = [ makeWrapper ]; inputpkg = stable.jetbrains.idea-community;
postBuild = '' pkgsuffix = "mcdev-jbr17";
wrapProgram $out/bin/idea-community \ libraries = with pkgs; [libpulseaudio libGL glfw openal stdenv.cc.cc.lib];
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [libpulseaudio libGL glfw openal stdenv.cc.cc.lib]}" extrapathpkgs = with pkgs; [jetbrains.jdk-no-jcef-17];
''; })
(mylib.appwrapper {
inherit pkgs;
inputpkg = stable.jetbrains.idea-community;
pkgsuffix = "mcdev-jbr21";
libraries = with pkgs; [libpulseaudio libGL glfw openal stdenv.cc.cc.lib];
extrapathpkgs = with pkgs; [jetbrains.jdk-no-jcef];
}) })
packwiz packwiz
# vscodium # see programs.vscode # vscodium # see programs.vscode

29
lib/default.nix Normal file
View file

@ -0,0 +1,29 @@
{
appwrapper =
{
pkgs,
inputpkg,
pkgsuffix,
libraries,
extrapathpkgs
}: with pkgs; let
name = "${inputpkg.pname}-${pkgsuffix}";
in stdenv.mkDerivation {
inherit name;
inherit (inputpkg) version;
nativeBuildInputs = [ makeWrapper gnused ];
buildCommand = ''
mkdir -p $out/bin
mkdir -p $out/share/applications
cp ${inputpkg}/share/applications/${inputpkg.pname}.desktop $out/share/applications/${name}.desktop
makeWrapper ${inputpkg}/bin/${inputpkg.pname} $out/bin/${name} \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libraries}" \
--prefix PATH : "${lib.makeBinPath extrapathpkgs}"
substituteInPlace $out/share/applications/${name}.desktop \
--replace-fail "=${inputpkg.pname}" "=${name}"
sed -i -E "s/^Name=(.*)/Name=\1 (${pkgsuffix})/g" "$out/share/applications/${name}.desktop"
echo $out/bin/${name}
'';
dontBuild = true;
};
}