Question: Is it immoral for an Objectivist to hold any government (civilian) job, or does it depend on the nature of the job?
Answer: Objectivism holds that each person's life is its own moral sanction, and that no one thrives in life except by living as a rational being. In politics, Objectivism holds that the best society is one that allows us to lead our lives free from the initiation of force. In this context, we will still need a government to provide courts of law and police and military services, all of which are necessary to protect our rights to freedom.
These basic functions of government will entail a variety of jobs, from court clerk to soldier, some of which are "civilian" and some of which are not. In addition, the government will doubtless have some kind of legislative body, with some kind of staff of its own, and election system that will need to be paid for and staffed, and so on. Furthermore, police and defense activities may require government-supported research or government purchases of products.
So even in an ideal society, there will be a variety of jobs in and around government that would be perfectly appropriate.
Today, no government confines itself to its legitimate functions. All governments initiate force, taking taxes to spend on industrial projects, social welfare schemes, subsidies, museums, roads, schools and so on. In fact, all these activities should be left to the free market. And governments regulate economic activity, preventing businesspeople and workers from setting the wages and hours they like, producing the products they choose, building the buildings they choose, and so on. In fact, these activities should also be left to the choices of individuals acting within their rights.
In Ayn Rand 's novel Atlas Shrugged , the productive people of the world decide to leave government to its own devices: they stop working for semi-government projects (in fact, they eventually stop working for all industrial enterprises that are regulated and taxed by the government). But as Rand herself pointed out, Atlas Shrugged represents an extreme situation of crushing government controls, complete cultural corruption, and rising dictatorship. That's not the situation of the developed world today, and though many trends are bad, there are also many reasons to hope for positive change.
What is an Objectivist to do?
First: "One must never fail to pronounce moral judgment" wrote Ayn Rand in her essay "How Does One Lead a Rational Life in an Irrational Society?" (in The Virtue of Selfishness). One needs to distinguish between right and wrong, and endeavor to support the right. Only in this way can the general character of society and government improve.
Second: When government is fulfilling a function that should be in the private market, it can be appropriate to work in that sector for the purpose of doing the essentially private work there. If you want to be a teacher, there is no blanket principle that forbids you to work in public schools or universities. If you want to build highways, there is no principle that forbids you to do that work just because the government is organizing the project and paying the bills.
Anyone who values their work and takes pride in living well is likely to find government work stultifying.
However, government projects are usually inefficient, hide-bound, and subject to capture by bureaucrats and entrenched public sector unions who turn the work into sinecures wherever possible. For this reason, anyone who values their work and takes pride in living well is likely to find government work stultifying. For this reason, it is worth considering private sector options fully before taking on a government job. When the government is fulfilling its proper duties, there won't be private sector alternatives. Where government is over-reaching, there generally will be, and they'll usually be better places to work.
And if one gets a government job, one must take care not to encourage or support the entrenchment of the bureaucracy or the moral arguments that apparatchiks use to bolster support for their programs. "Education isn't a business," cry public school teachers and state university professors, when they want more tax funds for their schools.