Skip to content

Instantly share code, notes, and snippets.

@ymatsiuk
Created April 5, 2024 07:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymatsiuk/99a1d23423df7fec08f8cafbd4df40c6 to your computer and use it in GitHub Desktop.
Save ymatsiuk/99a1d23423df7fec08f8cafbd4df40c6 to your computer and use it in GitHub Desktop.
Nix develop example
# Run me:
# ❯ nix develop .#work -c mysql --version
# mysql Ver 15.1 Distrib 10.11.6-MariaDB, for Linux (x86_64) using readline 5.1
# ❯ nix develop .#fun -c vault --version
# Vault v1.15.6 (615cf6f1dce9aa91bc2035ce33b9f689952218f0), built 2024-02-28T17:07:34Z
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
makeOpinionatedNixpkgs = system: overlays:
import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = overlays;
};
in
{
overlays = {
wrk = final: prev: {
vault = prev.vault-bin;
};
};
} //
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = makeOpinionatedNixpkgs system [ self.overlays.wrk ];
in
{
devShells = {
work = pkgs.mkShell {
buildInputs = [ pkgs.mysql ];
};
fun = pkgs.mkShell {
buildInputs = [ pkgs.vault ];
};
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment