-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failes with initdb: error: could not create directory \"/homeless-shelter\": Permission denied
?
#280
Comments
Fascinating. I've never seen that "homeless-shelter" error before. What version of postgres are you using? |
At the moment it seems like version 14.8:
If you want to investigate further (I'm doing as well when I have time), in the project above, on the linked branch, you should be able to just do |
It looks like I was able to fix it by setting the tmpFolder <- liftIO $ Env.getEnv "TMP"
liftIO $ Env.setEnv "HOME" tmpFolder I also tried setting this in my flake.nix itself, but couldn't figure out how to set that properly there. So for now my Haskell code does that fix 😅 Edit: So looks like it indeed works, in ci as well, so the above branch is no longer broken. If you still want to see it yourself, use this commit for example: 92583670739f58756668b6353b49d9c39170e181 |
I found the following: https://nixos.org/guides/nix-pills/working-derivation.html#id1388 So nix is forcing us not to depend on the home folder. But looks like somewhere postgres still does, apparently when using |
I did some more investigation, and found a cleaner fix. So as I found in my previous comment it looks like nix disallows the use of the home folder. I looked deeper into the tmp-postgres code, and found that the So to fix this, I use the following in my nix build:
I think the |
The homeless-shelter is the
You can see how it is done in Nixpkgs here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/configuration-common.nix#L1204-L1214 |
I'm trying to run my tests as part of my
nix flake check
, but when I do this tests that use tmp-postgres fail withI tried manually setting the
cacheTemporaryDirectory
andtemporaryDirectory
to whatever theTMP
environment variable is set to (seems to be/build
) but that results in the same error, still complaining about homeless-shelter.What am I missing? Is there a way to make this work inside nix?
(For more code, my project is available at: https://github.com/TheOddler/elmder/tree/pablo/trying-to-fix-backend-nix-build)
The text was updated successfully, but these errors were encountered: