add nix flake with devshell
This commit is contained in:
parent
5a5535a4a7
commit
d341f77b52
5
.gitignore
vendored
5
.gitignore
vendored
@ -26,4 +26,7 @@ oauth2_token_agent-*.tar
|
||||
/tmp/
|
||||
|
||||
# Elixir VSCode extension data
|
||||
/.elixir_ls/
|
||||
/.elixir_ls/
|
||||
|
||||
.direnv
|
||||
.state
|
||||
26
flake.lock
generated
Normal file
26
flake.lock
generated
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1722062969,
|
||||
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
26
flake.nix
Normal file
26
flake.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; };
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
devShell.x86_64-linux = let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
beam = pkgs.beam.packages.erlang_27;
|
||||
elixir = beam.elixir_1_17;
|
||||
elixir-ls = (beam.elixir-ls.override { inherit elixir; });
|
||||
in pkgs.mkShell {
|
||||
buildInputs = [ elixir elixir-ls ];
|
||||
shellHook = ''
|
||||
# this allows mix to work on the local directory
|
||||
mkdir -p .state/mix .state/hex
|
||||
export MIX_HOME=$PWD/.state/mix
|
||||
export HEX_HOME=$PWD/.state/hex
|
||||
export PATH=$MIX_HOME/bin:$MIX_HOME/escripts:$HEX_HOME/bin:$PATH
|
||||
# TODO: not sure how to make hex available without installing it afterwards.
|
||||
mix local.hex --if-missing --force
|
||||
export LANG=en_US.UTF-8
|
||||
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.state\"' -kernel shell_history_file_bytes 1024000"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user