# LibTmux.Server.createSessionWith

- **Package:** libtmux-haskell
- **Language:** Haskell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-haskell/blob/72edb54317bf619c6dc54bff311844f062f8984c/src/LibTmux/Server.hs#L406
- **Page:** https://libtmux.org/en/haskell/latest/reference/libtmux-server-v-createsessionwith/

```haskell
createSessionWith
  :: MutationOptions
  -> Server
  -> SessionOptions
  -> IO CreatedSession
```

Signature types: [`MutationOptions`](/en/haskell/latest/reference/libtmux-server-t-mutationoptions/), [`Server`](/en/haskell/latest/reference/libtmux-server-t-server/), [`SessionOptions`](/en/haskell/latest/reference/libtmux-creation-t-sessionoptions/), [`IO`](https://hackage.haskell.org/package/base-4.22.0.0/docs/Prelude.html#t:IO), [`CreatedSession`](/en/haskell/latest/reference/libtmux-creation-t-createdsession/).

Create with one [`timeout`](/en/haskell/latest/reference/libtmux-server-v-mutationoptions-timeout/) covering caller-context acquisition, admission
 and completion. [`MutationAppliedWithErrors`](/en/haskell/latest/reference/libtmux-server-v-mutationappliedwitherrors/), cancellation and timeout may
 retain a `CreationRecovery` with known IDs. A missing receipt proves no
 absence. Creation never retries and never starts a replacement daemon.
 Oversized options raise [`InvalidMutationArgument`](/en/haskell/latest/reference/libtmux-server-v-invalidmutationargument/) before admission. A caller
 environment beyond the native launch budget raises [`InvalidConfiguration`](/en/haskell/latest/reference/libtmux-server-v-invalidconfiguration/)
 without admitting an operation.

## Referenced declarations

- [`LibTmux.Creation.CreatedSession`](/en/haskell/latest/reference/libtmux-creation-t-createdsession/) (typealias)
- [`LibTmux.Server.MutationOptions`](/en/haskell/latest/reference/libtmux-server-t-mutationoptions/) (data type)
- [`LibTmux.Server.Server`](/en/haskell/latest/reference/libtmux-server-t-server/) (data type)
- [`LibTmux.Creation.SessionOptions`](/en/haskell/latest/reference/libtmux-creation-t-sessionoptions/) (data type)

## tmux command

The tmux commands behind `createSessionWith`.

- [`new-session`](/en/tmux/latest/manual/new-session/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_new_session_entry`](/en/tmux/latest/reference/c-variable-cmd_new_session_entry/) (attribute)
- [`cmd_new_session_exec`](/en/tmux/latest/reference/c-function-cmd-new-session-c-cmd_new_session_exec/) (function)

Each path starts at a function a command runs, which is degree 1. The degree counts steps from there along the path, and each step is a call or a reference: degree 2 is reached from that function, degree 3 from the next, and so on.

### Create a session and its first pane

1. [`cmd_new_session_exec`](/en/tmux/latest/reference/c-function-cmd-new-session-c-cmd_new_session_exec/) (function)
2. calls → [`spawn_window`](/en/tmux/latest/reference/c-function-spawn_window/) (function)
3. calls → [`spawn_pane`](/en/tmux/latest/reference/c-function-spawn_pane/) (function)
4. calls → [`window_add_pane`](/en/tmux/latest/reference/c-function-window_add_pane/) (function)
5. calls → [`window_pane_create`](/en/tmux/latest/reference/c-function-window-c-window_pane_create/) (function)
