add nix flake with devshell
This commit is contained in:
parent
5a5535a4a7
commit
d341f77b52
3
.gitignore
vendored
3
.gitignore
vendored
@ -27,3 +27,6 @@ oauth2_token_agent-*.tar
|
|||||||
|
|
||||||
# Elixir VSCode extension data
|
# 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