Shall I keep the original stateVersion value even after upgrading from 18.03 to 18.09?

In the manual, it stated that the stateVersion should only be modified when it is required in the release note.

So is it true that I should leave it as its original value 18.03 even after I upgrade to 18.09?

2 Likes

Yes, do not change stateVersion! :slight_smile:

It keeps things compatible with your systems (mutable) state - e.g. it uses the same PostgreSQL version as previously - so that you don’t need to migrate them. If you change the stateVersion you might break your system or need to migrate manually.

Quoting André Patrick Bubel (2018-10-15 09:02:01)

It keeps things like the same PostgreSQL Version after version, so that you don’t need to migrate them. If you change the stateVersion you might break your system or need to migrate manually.

I think these things need to be documented a bit more. Like “In 19.03 we
upgraded PostgreSQL to . To receive that update, change
stateVersion to 19.03 and perform manual migration as described in
PostgreSQL manual (not a PostgreSQL user so I don’t know how they document
migration to new versions)”.

Or maybe I’m not reading enough changelogs. Maybe this is already
implemented.

1 Like

Yes :slight_smile:

In case anyone else read that incorrectly, “yes” is in reply to the body text of the question, not the question title. I.e., do not change stateVersion.

1 Like

Thank you for reminding me the the mismatch between the title and the content. Now I have modified the title.

I have added that to my answer, and have rewritten the explanation, so I hope it is clearer now.

The problem here is that you need to migrate everything that this option touches. You likely want to read all the release notes for the versions since you last changed the option and grep the nixpkgs repo for all occurrences of the stateVersion option to check if your system is affected.

2 Likes

Haven’t changed the stateVersion since 15.09, so was wondering what I am missing. So here is a short summary.

mysql:

  • 17.09 changed data directory to /var/lib/mysql (was /var/mysql)

postgres:

  • 16.09 changed package to postgres95 (pre-16.09 use postgres94)
  • 17.09 changed package to postgres96
  • 17.09 changed user to postgres (was root)
  • 17.09 changed data directory to /var/lib/postgresql/${config.services.postgresql.package.psqlSchema} (where psqlSchema is 9.6 for example) (was /var/db/postgresql)

matrix-synapse:

  • 18.03 changed the default database type to psycopg2 (was sqlite3)

ipfs:

  • 17.09 changed the default data directory to /var/lib/ipfs (was /var/lib/ipfs/.ipfs)

radicale:

  • 17.09 changed the default package to radicale2 (was radicale1)

caddy:

  • 17.09 adds dataDir to CADDYPATH

amazon-options:

  • 17.03 sets ec2.hvm to true by default
6 Likes