Skip to content

Instantly share code, notes, and snippets.

@Pablo1107
Created June 30, 2023 02:38
Show Gist options
  • Save Pablo1107/31354826b3e1267d98c355c95d233840 to your computer and use it in GitHub Desktop.
Save Pablo1107/31354826b3e1267d98c355c95d233840 to your computer and use it in GitHub Desktop.
Example Nix Develop with Flake
{
description = "example-nix-develop";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a";
};
outputs = { self, nixpkgs }:
let
# System types to support.
supportedSystems = [ "x86_64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
devShell = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
pkgs.mkShell {
buildInputs = with pkgs; [
];
shellHook = ''
# zsh && exit
# Environment variables.
'';
}
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment