Skip to content

Instantly share code, notes, and snippets.

@orzklv
Created January 28, 2024 09:35
Show Gist options
  • Save orzklv/53d77f43b2c0b4159cb3495ac29fd8f5 to your computer and use it in GitHub Desktop.
Save orzklv/53d77f43b2c0b4159cb3495ac29fd8f5 to your computer and use it in GitHub Desktop.
NIx Flake Example
{ lib
, llvmPackages
, cmake }:
llvmPackages.stdenv.mkDerivation rec {
pname = "rust";
version = "0.1.0";
src = ./.;
# nativeBuildInputs = [ cmake ];
# buildInputs = [ ];
# cmakeFlags = [
# "-DENABLE_TESTING=OFF"
# "-DENABLE_INSTALL=ON"
# ];
meta = with lib; {
homepage = "https://github.com/*/*";
description = ''
Just a package
'';
licencse = licenses.mit;
platforms = with platforms; linux ++ darwin;
maintainers = [
{
name = "Sokhibjon Orzikulov";
email = "[email protected]";
handle = "orzklv";
github = "orzklv";
githubId = 54666588;
keys = [{
fingerprint = "00D2 7BC6 8707 0683 FBB9 137C 3C35 D3AF 0DA1 D6A8";
}];
}
];
};
}
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, ... }@inputs: inputs.utils.lib.eachSystem [
"x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"
] (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [];
# config.allowUnfree = true;
};
in {
devShells.default = pkgs.mkShell rec {
name = "rust";
packages = with pkgs; [
rustc
cargo
rustfmt
rust-analyzer
];
shellHook = let
icon = "f121";
in ''
export PS1="$(echo -e '\u${icon}') {\[$(tput sgr0)\]\[\033[38;5;228m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]} (${name}) \\$ \[$(tput sgr0)\]"
'';
};
packages.default = pkgs.callPackage ./default.nix {};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment