Skip to content

Instantly share code, notes, and snippets.

@haskie-lambda
Created February 4, 2021 19:37
Show Gist options
  • Save haskie-lambda/ee93f211ada145a16172a9756e274614 to your computer and use it in GitHub Desktop.
Save haskie-lambda/ee93f211ada145a16172a9756e274614 to your computer and use it in GitHub Desktop.
install procedure for wonderdraft map creation tool on NixOS using nix-ld

Installing a binary on NixOS - Wonderdraft

Install nix-ld

$ sudo nix-channel --add https://github.com/Mic92/nix-ld/archive/main.tar.gz nix-ld
$ sudo nix-channel --update

/etc/nixos/configuration.nix

{
  imports = [
    <nix-ld/modules/nix-ld.nix>
  ];
}

Install dependencies

install nix-index the way you want:

  packages=[
    //...
    nix-index
  ];

sudo nixos-rebuild switch

Setup nix-index

nix-index

get shell that can execute wonderdraft

ldd Wonderdraft_bin to find out the missing libraries; then add the library packages to the path:

/path/to/wonderdraft/shell.nix

with import <nixpkgs>{};
mkShell {
  NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
    stdenv.cc.cc
    xorg.libX11
    xorg.libXcursor
    xorg.libXinerama
    xorg.libXrandr
    xorg.libXi
    libpulseaudio
    alsaLib
    libGL
    glibc
  ];
  NIX_LD = builtins.readFile "${stdenv.cc}/nix-support/dynamic-linker";
  shellHook = ''
    ./Wonderdraft.x86_64
  '';
}

Setup for program launcher (drun in my case)

~/.local/share/applications/Wonderdraft.desktop

[Desktop Entry]
Version=1.1.4.2
Name=Wonderdraft
Comment=Wonderdraft is a powerful yet intuitive fantasy map creation tool.
Exec=nix-shell /path/to/wonderdraft/shell.nix --run ""
Path=/path/to/wonderdraft/Wonderdraft
Icon=/path/to/wonderdraft/Wonderdraft.png
Terminal=false
Type=Application
Categories=Graphics

reload drun (on i3: mod+shift+r)

run wonderdraft :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment