diff --git a/.gitignore b/.gitignore index 62c2455..1a8b004 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ open_ai_client-*.tar # Temporary files, for example, from tests. /tmp/ +.nix-hex +.nix-mix diff --git a/.zellij.kdl b/.zellij.kdl new file mode 100644 index 0000000..5f31a20 --- /dev/null +++ b/.zellij.kdl @@ -0,0 +1,32 @@ +layout { + default_tab_template split_direction="horizontal" { + children + pane size=1 borderless=true { + plugin location="compact-bar" + } + } + + tab name="1 code" focus=true { + pane split_direction="vertical" { + pane name="editor" size="80%" focus=true command="nvim" borderless=true + pane name="tests" size="20%" command="mix" { + args "test.interactive" "--stale" + } + } + } + + // tab name="2 servers" { + // pane split_direction="vertical" { + // pane name="docker" command="docker" { + // args "compose" "up" + // } + // pane name="web" command="iex" start_suspended=true { + // args "-S" "mix" "phx.server" + // } + // } + // } + + tab name="2 git" { + pane name="git" command="lazygit" borderless=true + } +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7acbf07 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1728421091, + "narHash": "sha256-ZKLYFgFaMCQkyr1m3jMvx7g4Q6eBoFmEBLeu4QpsUD0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ecf10b087d9c8902d85e71a51ab99427269fdcf7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7450936 --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "A flake for building development environment of Phoenix project."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/master"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + with pkgs; { + devShells.default = mkShell { + buildInputs = [ + beam.interpreters.erlang_27 + beam.packages.erlang_27.elixir_1_16 + nodePackages.nodejs + flyctl + ] + ++ lib.optionals stdenv.isLinux [ + # For ExUnit Notifier on Linux. + libnotify + + # For file_system on Linux. + inotify-tools + ] + ++ lib.optionals stdenv.isDarwin [ + # For ExUnit Notifier on macOS. + terminal-notifier + + # For file_system on macOS. + darwin.apple_sdk.frameworks.CoreFoundation + darwin.apple_sdk.frameworks.CoreServices + ]; + + shellHook = '' + # allows mix to work on the local directory + mkdir -p .nix-mix + mkdir -p .nix-hex + export MIX_HOME=$PWD/.nix-mix + export HEX_HOME=$PWD/.nix-hex + export ERL_LIBS=$HEX_HOME/lib/erlang/lib + + # concats PATH + export PATH=$MIX_HOME/bin:$PATH + export PATH=$MIX_HOME/escripts:$PATH + export PATH=$HEX_HOME/bin:$PATH + + # enables history for IEx + export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.erlang-history\"'" + ''; + }; + } + ); +}