Created
June 30, 2023 02:38
-
-
Save Pablo1107/31354826b3e1267d98c355c95d233840 to your computer and use it in GitHub Desktop.
Example Nix Develop with Flake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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