{"id":5538,"date":"2026-09-17T06:50:37","date_gmt":"2026-09-17T06:50:37","guid":{"rendered":"https:\/\/netguide.io\/linux\/using-zsh-instead-of-bash-with-nix-develop-how-to-switch-shells\/"},"modified":"2026-09-17T06:50:37","modified_gmt":"2026-09-17T06:50:37","slug":"using-zsh-instead-of-bash-with-nix-develop-how-to-switch-shells","status":"publish","type":"post","link":"https:\/\/netguide.io\/linux\/en\/using-zsh-instead-of-bash-with-nix-develop-how-to-switch-shells\/","title":{"rendered":"Using Zsh Instead of Bash with Nix develop: How to Switch Shells"},"content":{"rendered":"<script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"4797\" data-bid=\"2\" data-placement=\"4798\">PGRpdiBpZD0ibmV0Z3VpZGVhLTEyMjE4OTc1MzEiIGNsYXNzPSJuZXRndWlkZWEtYmVmb3JlLWNvbnRlbnQgbmV0Z3VpZGVhLWVudGl0eS1wbGFjZW1lbnQiPjxkaXYgY2xhc3M9Im5ldGd1aWRlYS1hZGxhYmVsIj5BZHZlcnRpc2VtZW50czwvZGl2PjxzY3JpcHQgYXN5bmMgc3JjPSIvL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9qcy9hZHNieWdvb2dsZS5qcz9jbGllbnQ9Y2EtcHViLTYyNTg1NTYyNTcyNDU5OTgiIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiPjwvc2NyaXB0PjxpbnMgY2xhc3M9ImFkc2J5Z29vZ2xlIiBzdHlsZT0iZGlzcGxheTpibG9jazsiIGRhdGEtYWQtY2xpZW50PSJjYS1wdWItNjI1ODU1NjI1NzI0NTk5OCIgCmRhdGEtYWQtc2xvdD0iMzQ5NDExNTM0MiIgCmRhdGEtYWQtZm9ybWF0PSJhdXRvIj48L2lucz4KPHNjcmlwdD4gCihhZHNieWdvb2dsZSA9IHdpbmRvdy5hZHNieWdvb2dsZSB8fCBbXSkucHVzaCh7fSk7IAo8L3NjcmlwdD4KPC9kaXY+<\/script><p>If you use the Nix package manager for development environments, you might run into a surprise right at the start: despite having Zsh configured system-wide, running <code>nix develop<\/code> launches Bash by default. This guide shows you how to use your preferred shell inside Nix environments.<\/p>\r\n\r\n<h2>Step 1: Test the launch via command-line argument<\/h2>\r\n<p>To start your own shell directly with Nix, pass the <code>$SHELL<\/code> environment variable to Nix using the <code>-c<\/code> flag:<\/p>\r\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>nix develop -c $SHELL<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">nix<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">develop<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-c<\/span><span style=\"color: #E1E4E8\"> $SHELL<\/span><\/span><\/code><\/pre><\/div>\r\n<p>This command launches the user shell defined in <code>$SHELL<\/code> right inside the development environment.<\/p>\r\n\r\n<h2>Step 2: Configure the shell in your project via flake.nix<\/h2>\r\n<p>If you maintain a project and want <code>nix develop<\/code> to launch your shell automatically, you can modify your repository&#8217;s <code>flake.nix<\/code> file.<\/p>\r\n<p>Path: <code>.\/flake.nix<\/code><\/p>\r\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\r\n  outputs = { self, nixpkgs }:\r\n    let\r\n      system = \"x86_64-linux\";\r\n      pkgs = nixpkgs.legacyPackages.${system};\r\n    in {\r\n      devShells.${system}.default = pkgs.mkShell {\r\n        shellHook = ''\r\n          $SHELL\r\n        '';\r\n      };\r\n    };\r\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #B392F0\">outputs<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> { self<\/span><span style=\"color: #F97583\">,<\/span><span style=\"color: #E1E4E8\"> nixpkgs }:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">let<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">      <\/span><span style=\"color: #B392F0\">system<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;x86_64-linux&quot;<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">      <\/span><span style=\"color: #B392F0\">pkgs<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #FFAB70\">nixpkgs<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #FFAB70\">legacyPackages<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8; font-style: italic\">${<\/span><span style=\"color: #FFAB70; font-style: italic\">system<\/span><span style=\"color: #E1E4E8; font-style: italic\">}<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">in<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">      <\/span><span style=\"color: #B392F0\">devShells<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #E1E4E8; font-style: italic\">${<\/span><span style=\"color: #FFAB70; font-style: italic\">system<\/span><span style=\"color: #E1E4E8; font-style: italic\">}<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #B392F0\">default<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #FFAB70\">pkgs<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #FFAB70\">mkShell<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #B392F0\">shellHook<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&#39;&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">          $SHELL<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">        &#39;&#39;<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">      };<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    };<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span><\/code><\/pre><\/div>\r\n<p>Adding <code>$SHELL<\/code> to the <code>shellHook<\/code> of <code>pkgs.mkShell<\/code> ensures your preferred shell is executed when the dev environment starts.<\/p>\r\n\r\n<h2>Potential issues and quirks<\/h2>\r\n<ul>\r\n  <li><strong>Nested shells:<\/strong> Launching <code>$SHELL<\/code> inside <code>shellHook<\/code> may result in nested sessions, requiring you to press <code>Ctrl+D<\/code> twice when exiting to return to your previous terminal session.<\/li>\r\n<\/ul>\r\n\r\n<h2>Reverting changes<\/h2>\r\n<p>If you modified a local <code>flake.nix<\/code>, simply remove the <code>$SHELL<\/code> call from the <code>shellHook<\/code> block.<\/p>\r\n\r\n<h2>Conclusion<\/h2>\r\n<p>While Nix defaults to Bash for development environments, you can easily adapt it to your workflow using the <code>-c<\/code> flag or a <code>shellHook<\/code>. Alternatively, tools like <code>direnv<\/code> can be used, as they integrate environment variables without altering your current shell once cached.<\/p>\r\n<p><em>Sources: <a href=\"https:\/\/discourse.nixos.org\/t\/using-nix-develop-opens-bash-instead-of-zsh\/25075\" rel=\"nofollow noopener\" target=\"_blank\">Forum: NixOS &#8211; Forum<\/a>, <a href=\"https:\/\/discourse.nixos.org\/t\/using-nix-develop-opens-bash-instead-of-zsh\/25075\" rel=\"nofollow noopener\" target=\"_blank\">discourse.nixos.org<\/a><\/em><\/p><script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"4799\" data-bid=\"2\" data-placement=\"4800\">PGRpdiBpZD0ibmV0Z3VpZGVhLTI1MjEzNDA0MzAiIGNsYXNzPSJuZXRndWlkZWEtYWZ0ZXItY29udGVudCBuZXRndWlkZWEtZW50aXR5LXBsYWNlbWVudCI+PGRpdiBjbGFzcz0ibmV0Z3VpZGVhLWFkbGFiZWwiPkFkdmVydGlzZW1lbnRzPC9kaXY+PHNjcmlwdCBhc3luYyBzcmM9Ii8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL2pzL2Fkc2J5Z29vZ2xlLmpzP2NsaWVudD1jYS1wdWItNjI1ODU1NjI1NzI0NTk5OCIgY3Jvc3NvcmlnaW49ImFub255bW91cyI+PC9zY3JpcHQ+PGlucyBjbGFzcz0iYWRzYnlnb29nbGUiIHN0eWxlPSJkaXNwbGF5OmJsb2NrOyIgZGF0YS1hZC1jbGllbnQ9ImNhLXB1Yi02MjU4NTU2MjU3MjQ1OTk4IiAKZGF0YS1hZC1zbG90PSI0NTU5Nzg1MDAyIiAKZGF0YS1hZC1mb3JtYXQ9ImF1dG8iPjwvaW5zPgo8c2NyaXB0PiAKKGFkc2J5Z29vZ2xlID0gd2luZG93LmFkc2J5Z29vZ2xlIHx8IFtdKS5wdXNoKHt9KTsgCjwvc2NyaXB0Pgo8L2Rpdj4=<\/script>","protected":false},"excerpt":{"rendered":"<p>By default, nix develop launches Bash. With just a few tweaks, you can make your Nix development environment use your preferred shell directly.<\/p>\n","protected":false},"author":1,"featured_media":5535,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[616,619,609,611,615,610],"class_list":["post-5538","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized-en","tag-bash-en","tag-development","tag-nix-en","tag-nixos-en","tag-terminal-en","tag-zsh-en"],"uagb_featured_image_src":{"full":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp.webp",1200,630,false],"thumbnail":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp-150x150.webp",150,150,true],"medium":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp-300x158.webp",300,158,true],"medium_large":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp-768x403.webp",768,403,true],"large":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp-1024x538.webp",1024,538,true],"1536x1536":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp.webp",1200,630,false],"2048x2048":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2026\/09\/nix-develop-mit-zsh-statt-bash-nutzen-so-klappt-der-shell-wechsel-editorial-editorial-119195-httpsnixos.orgindex.webp.webp",1200,630,false]},"uagb_author_info":{"display_name":"Tobias","author_link":"https:\/\/netguide.io\/linux\/author\/tobias-pries\/"},"uagb_comment_info":0,"uagb_excerpt":"By default, nix develop launches Bash. With just a few tweaks, you can make your Nix development environment use your preferred shell directly.","brizy_media":[],"_links":{"self":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/5538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/comments?post=5538"}],"version-history":[{"count":1,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/5538\/revisions"}],"predecessor-version":[{"id":5539,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/5538\/revisions\/5539"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media\/5535"}],"wp:attachment":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media?parent=5538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/categories?post=5538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/tags?post=5538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}