Change:
<ins> # GNOME Terminal. { config, pkgs, lib, ... }: with lib; let cfg = config.programs.gnome-terminal; in { # Added 2019-08-19 imports = [ (mkRenamedOptionModule [ "services" "gnome3" "gnome-terminal-server" "enable" ] [ "programs" "gnome-terminal" "enable" ]) ]; options = { programs.gnome-terminal.enable = mkEnableOption "GNOME Terminal"; }; config = mkIf cfg.enable { environment.systemPackages = [ pkgs.gnome3.gnome-terminal ]; services.dbus.packages = [ pkgs.gnome3.gnome-terminal ]; systemd.packages = [ pkgs.gnome3.gnome-terminal ]; programs.bash.vteIntegration = true; programs.zsh.vteIntegration = true; }; } </ins>

Discussion:
Open a gnome-terminal and go to any directory other than $HOME. Right-click in the terminal and click "New Terminal" A new terminal opens, but the current directory is $HOME. This has probably always been like this in NixOS. On traditionally systems is sourced which exposes the shell $PWD to the terminal. In NixOS that file lies "dormant" in the store: Users can workaround this by manually sourcing the file: (probably best to pick the one in gnome-terminal's clousure) system: host os: multi-user?: sandbox: version: channels(ole): channels(root): nixpkgs: Gnome installed by
Is that supposed to be done for new windows? It works for me with new tabs, I think.
It does after sourcing the file so I assume it's intended. I'll check on an other system when I get the chance. I get the same behavior with new tabs (does not preserve $PWD when is not sourced) Can you check the content of (bash) or (zsh)?
I use fish-shell and the pwd just seems to be preserved.
Seems fish notifies various terminals . More context:
Would something like the following work? This global solution is not very nice but I am not sure how to address it correctly.
The alternative might be to add something like the linked fish config to : The script checks if the shell isn't bash or zsh, so it should be safe to do so. Did a quick test in a VM and it seems to do the trick.
For some reason the above snippet doesn't "initialize" for me. I have to manually run . Weird. I even some manual trace and see that is sourced. But still it doesn't work. I'm using bash, but perhaps I have some untracked stuff in .bashrc that is interfering? I'm currently unable to debug using the NixOS VM. stops in stage-1 at "mke2fs 1.44.1 (24-Mar-2018)". EDIT: typo
hmm, weird, I'm specifically running this diff on unstable: I'm able to launch bash (from zsh) and the directory successfully updates when creating new terminals, though I can't quite remember if I tested things out with bash in a VM.

edit: managed to do ctrl-return
Thanks to I am now able to use "nixos-rebuild build-vm" again (on NixOS 18.03). I can confirm the above patch () fixes it. (I guess why it doesn't work on my physical laptop is due to some imperative changes in my $HOME.) Would you like to make a PR?
This seems to strangely only work in bash, has anyone gotten this to work with ZSH? I suppose I could source the file manually though I'm not sure which path the ${} refers to?
I have this patch in my tree which works for ZSH: Edit: I see I posted this exact diff above :laughing: Kinda forgot about this, should really subit a PR.
I've that bit into my config and have done a rebuild, but don't get the desired behavior. Where does the actually output to (which file) - would this not be needed in my .zshrc?
It should show up in . The exact patch I posted relies on btw. You could also include it straight in your configuration if you're not using gnome.
Many thanks - I'm a bit cautious to try that line as I've previously had various issues with fonts / themes / icons. I've found a direct copy of from my old Arch installation and just sourcing that manually for now -works perfectly! In the event it's useful to someone:
Sorry, guess I wasn't clear. I meant including in your , that way it isn't hidden behind the flag.
I'm struggling to find a way to represent that configuration snippet as a nixos option that can be generalized to just mean or support for vte terminals. For example it could be but vte isn't a program.
Since the VTE lib comes from , what about something like ? In the same way we have . also have a bunch of shell configuration (, , , ...), so it could make sens.
Yay, great suggestion I can do that :+1:
My old solution posted no longer seems to work after upgrading to nixos 20.09. I can't seem to find the actual solution to this, any pointers?
What was your old solution? If you enable gnome-terminal you will have the vte module enabled.

If not enable them manually
I've got: However I still seem to run into the same issue, after running . As for the old solution - that was sourcing the file I had from arch linux. I also tried: And sourcing that file with - that still does not seem to work.
I managed to fix this by setting to instead of . No idea if this setting perhaps got reset somehow - but it worked previously. :)