Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Last active July 7, 2026 11:28
Show Gist options
  • Select an option

  • Save sortofsleepy/16d35365b3148f1f1e03181ecc5584e7 to your computer and use it in GitHub Desktop.

Select an option

Save sortofsleepy/16d35365b3148f1f1e03181ecc5584e7 to your computer and use it in GitHub Desktop.
Example of packaging a non-existant package
# Fetches the specified version of Odin
odin-fetch = pkgs.stdenv.mkDerivation {
pname = "odin-source";
version = odin-version;
src = pkgs.fetchurl {
url="https://github.com/odin-lang/Odin/releases/download/dev-2026-05/odin-linux-amd64-${odin-version}.tar.gz";
# When you change versions, you should get an error pointing to the correct SHA
# TODO not sure if there's a better way to get the right hash without needing to get Nix to tell you.
hash = "sha256-zX7CzRqyhAoLfrwY5ctBxnG86HsS8Fb92+8/CAtN3n0=";
};
buildInputs = [
pkgs.llvm
pkgs.clang
pkgs.libiconv
];
installPhase = ''
mkdir -p $out/bin $out/share/odin
cp odin $out/bin
cp -r base core vendor $out/share/odin/
'';
};
@sortofsleepy

Copy link
Copy Markdown
Author

A small snippet from a flake of mine that demonstrates a basic way of pulling in a package that doesn't already exist on nix packages. Likely not the only way.

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