Skip to content

Instantly share code, notes, and snippets.

@kotatsuyaki
Created April 25, 2022 02:16
Show Gist options
  • Save kotatsuyaki/baaa4b8f65f89ab6dc94376522439be2 to your computer and use it in GitHub Desktop.
Save kotatsuyaki/baaa4b8f65f89ab6dc94376522439be2 to your computer and use it in GitHub Desktop.
Package Ubuntu binary in Nix with autoPatchelfHook
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
defaultPackage = pkgs.stdenv.mkDerivation rec {
name = "proj";
version = "0.1";
src = ./.;
nativeBuildInputs = with pkgs; [
autoPatchelfHook
];
buildInputs = with pkgs; [
glfw3
stdenv.cc.cc
dbus
];
installPhase = ''
mkdir -p $out/bin
install -m755 proj $out/bin/proj
'';
};
devShell = with pkgs; mkShell {
buildInputs = with pkgs; [ rnix-lsp ];
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment