Error on confs import

Guys, I am trying to setup an openvpn server on GCE - It was part working bur after the last reboot it is messing around the file structure.

On my configuration.nix itś writen:
GNU nano 4.7 /etc/nixos/configuration.nix Modified
{ config, pkgs, lib, options, modulesPath, users, environment, … }:

{
  imports = [
    <nixpkgs/nixos/modules/virtualisation/google-compute-image.nix>
    ~/WCBRpar/Restricted/SKN/commons/users.nix
    #~/WCBRpar/Restricted/SKN/confs/WCBRpar-vpn-configuration.nix
  ];
 
  # Loads the secondary HD with the whole organization files 
  fileSystems =  {
    "~/WCBRpar" = { 
      label = "WCBRpar";
      fsType = "ext4";
      options = [ "data=journal" ];
      neededForBoot = true;
      };
    };

I dont know why is the FS acting awkwardly, considering:

[root@skynet-srv01:/]# lsblk -fn
sda                                                                       
└─sda1 ext4   nixos   cc3d2c34-67eb-4446-8842-337d74a15f9a  229.3G     2% /
sdb                                                                       
└─sdb1 ext4   WCBRpar d524b360-22e2-4e54-93fd-8e7a675aa782  185.8G     0% /~/WCBRpar

Although it is correctly structured, when the OS tryies to use the files it cant:

[root@skynet-srv01:/]# ls ~/WCBRpar/ returns nothig

but when using \ it works properly :

[root@skynet-srv01:/]# ls \~/WCBRpar/Restricted/SKN/commons 
users.nix

Yet, the rebuit wont work anymore:

[root@skynet-srv01:/]# nixos-rebuild switch --upgrade 
unpacking channels...
error: getting status of '/root/WCBRpar/Restricted/SKN/commons/users.nix': No such file or directory
(use '--show-trace' to show detailed location information)
building Nix...
error: getting status of '/root/WCBRpar/Restricted/SKN/commons/users.nix': No such file or directory
(use '--show-trace' to show detailed location information)
building the system configuration...
error: getting status of '/root/WCBRpar/Restricted/SKN/commons/users.nix': No such file or directory
(use '--show-trace' to show detailed location information)

Maybe it’s late and I am missing the point. Perhaps anyone of you can see what i am not able to figure out.

You have a directory literally named ~, and that’s bound to confuse tools as you can see.

If you do want your secondary HD mounted on /~/WCBRpar, you need to change your imports to use absolute paths:

  imports = [
    <nixpkgs/nixos/modules/virtualisation/google-compute-image.nix>
    /~/WCBRpar/Restricted/SKN/commons/users.nix
    /~/WCBRpar/Restricted/SKN/confs/WCBRpar-vpn-configuration.nix
  ];

If what you actually want is for it to be mounted under your home directory (i.e. /root/WCBRpar), then you need to change the mountpoint:

  fileSystems =  {
    "/root/WCBRpar" = { 
      label = "WCBRpar";
      fsType = "ext4";
      options = [ "data=journal" ];
      neededForBoot = true;
      };
    };

If this case, be very careful when removing the /~ directory.

Thanks - There was no /~directory - probably was created by some misinterpretation. I’ll correct the files and ther confs.