Skip to content

Instantly share code, notes, and snippets.

@fud
Created March 8, 2022 02:07
Show Gist options
  • Save fud/ee75141e35ff788564e22c66fed2495a to your computer and use it in GitHub Desktop.
Save fud/ee75141e35ff788564e22c66fed2495a to your computer and use it in GitHub Desktop.
Simple Flake
{
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
mg = (with pkgs; stdenv.mkDerivation {
pname = "mg";
version = "20220212";
src = fetchFromGitHub {
owner = "hboetes";
repo = "mg";
rev = "20220212";
sha256 = "sha256-JeFNB+HdoQdIy5yz3jhta9VPdTdSIzXKkT7YQIrKWmA=";
};
makeFlags = [ "PKG_CONFIG=${buildPackages.pkg-config}/bin/${buildPackages.pkg-config.targetPrefix}pkg-config" ];
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.ncurses6 ];
buildPhase = "make -j $NIX_BUILD_CORES";
installPhase = ''
mkdir -p $out/bin
mv $TMP/mg/mg $out/bin
'';
}
);
in rec {
defaultApp = flake-utils.lib.mkApp {
drv = defaultPackage;
};
defaultPackage = mg;
devShell = pkgs.mkShell {
buildInputs = [
mg
];
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment