I’m not 100% sure what you’re trying to do, but if it’s about keeping configuration.nix in git:
If you want to keep /etc/nixos in git, just run git as root.
If you want to keep configuration.nix and related files in a git repo owned by your user for easier git config (and perhaps better editor integration), you’ll need to change the path nixos-rebuild uses to find it.
Move your /etc/nixos to a directory owned by your user, e.g. /home/ivoencarnacao/.local/src/nixos
Set its permissions: sudo chown -R ivoencarnacao:users /home/ivoencarnacao/.local/src/nixos
Add somewhere in configuration.nix (importantly, now withoutsudo, otherwise you’ll break the permissions):