Skip to content

Instantly share code, notes, and snippets.

@ericr3r
Last active September 7, 2024 00:49
Show Gist options
  • Save ericr3r/4df961031f158059a1efd8cbffed7daa to your computer and use it in GitHub Desktop.
Save ericr3r/4df961031f158059a1efd8cbffed7daa to your computer and use it in GitHub Desktop.
Flake for building Nerves System
# Flake for building nerves system
# Use `nix develop .` for regular Nerves builds
# Use `nix develop .#fhs` for Nerves System builds
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
erlangVersion = "erlang_27";
elixirVersion = "elixir_1_17";
erlang = pkgs.beam.interpreters.${erlangVersion};
elixir = pkgs.beam.packages.${erlangVersion}.${elixirVersion};
commonPkgs = [
elixir
erlang
pkgs.autoconf
pkgs.automake
pkgs.curl
pkgs.git
pkgs.pkg-config
pkgs.squashfsTools
];
# FHS User Environment
fhs = pkgs.buildFHSUserEnv {
name = "fhs-shell";
linkLibs = true;
targetPkgs = pkgs: commonPkgs ++ [
pkgs.bc
pkgs.cpio
pkgs.file
pkgs.gcc
pkgs.libtool
pkgs.libxcrypt
pkgs.ncurses5.dev
pkgs.which
];
runScript = pkgs.writeScript "init.sh" ''
exec bash
'';
};
in
{
devShells.fhs = fhs.env;
devShells.default = pkgs.mkShell {
packages = commonPkgs;
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment