The people as a whole get together and decide, e.g. draw up a Constitution and then form a government to enforce those rights.
If they don't, then the strongest horse in the area will decide.
Take your pick.
Your rights are inherent to being a human being. You are endowed by your Creator with the inalienable Rights of Life, Liberty, and the Pursuit of Happiness. A libertarian government would be one that enforces those rights.
Governments do not grant rights. They either enforce or abrogate them.