What Is the Meaning of *Nix

What is the meaning of *nix?

*nix just means operating systems that are like the old workhorse Unix. Some examples include Linux, FreeBSD, and Mac OS X (its kernel, Darwin, is based on BSD).

The main relation between *nix and Ruby is just a pragmatic one; most Ruby developers seem to prefer to work on Unix-like OSes (typically Linux or Mac OS X). There's no official relationship, and it's quite possible to work with Ruby on non-*nix OSes like Windows.

What are the main *nix OS's which are good for learning *nix programming?

To be called UNIX you have to pass a certification that it conforms to the specification, so Linux is more precisely called a UNIX-like operating system. The main paradigms remain even if many particulars will change if you go from Linux to UNIX and from UNIX to another UNIX flavor. That said, you should take a look at The Art of Unix Programming to get a feeling about the ways of doing things.

The more practical thing to do is to get an easy to use Linux distro (Ubuntu, SuSE, Mandriva) and familiarize yourself with it while doing some programming projects. Then, when you are more familiar with how things work so you can manage to solve issues by yourself with ease, and to get a feeling about a different flavor of OS, try OpenSolaris (Nexenta) or some BSD flavor (for instance FreeBSD). The reason for this is that you'll be able to get an environment which works without much (or any) trouble using mainstream Linux, whereas with less used free Unices you'll may hit upon unsupported hardware, harder configuration and so on.

Also, user oriented distros will fare as well as programmer oriented distros (if such a thing exists) to do programming, all the tools will be there at a single package download away, if they don't come in the DVD or CDs themselves. You can usually set up at install time how you wish to use your OS, there are server groups, programming groups and so on, which you can select.

One of the most shocking differences from the user point of view between Unices and Linux is that Unices do not come with the GNU set of tools. These tools are of very high quality and you will miss them if you get used to them and then move to another flavor. It is usually heard that sysadmins first install all the GNU tools on OSs that don't have them.

What is the nix-expression nixpkgs ?

From man nix-env (and likely other sources):

   NIX_PATH
A colon-separated list of directories used to look up Nix
expressions enclosed in angle brackets (i.e., <path>). For
instance, the value

/home/eelco/Dev:/etc/nixos

will cause Nix to look for paths relative to /home/eelco/Dev and
/etc/nixos, in that order. It is also possible to match paths
against a prefix. For example, the value

nixpkgs=/home/eelco/Dev/nixpkgs-branch:/etc/nixos

will cause Nix to search for <nixpkgs/path> in
/home/eelco/Dev/nixpkgs-branch/path and /etc/nixos/nixpkgs/path.

On my machine, NIX_PATH is nixpkgs=/Users/me/.nix-defexpr/channels/nixpkgs, so <nixpkgs> refers to the nixpkgs channel that I am subscribed to.

In general, <...> causes a path to be treated not literally, but as found in some directory specified by your NIX_PATH.

Why are *nix commands referred to as Man(1), Diff(1), Cat(1), etc

It's the manual section its man page lives in. From man man:

   The table below shows the section numbers of the manual followed by the types of pages they contain.

1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven-
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]

What is the active Nix expression ?

This is the file from which the Nix expression in which any attribute specified with -A is evaluated. (Absent -A, that content is expected to directly be a derivation).

Let's say you have a mydir/default.nix file that evaluates to an attrset with keys foo, bar, and baz, each of which maps to a derivation as a value.

In this case, running nix-env -f mydir -iA foo will load mydir/default.nix, evaluate foo in the context of that loaded code, run any associated build steps, and add that software to your active environment.

What does the nixpkgs string / value mean in Nix?

<nixpkgs> is a Nix expression that is evaluated by looking at the Nix search path in the NIX_PATH environment variable and/or -I option.

It is described in more detail in the Nix manual.

Note that the Nix search path is impractical in many situations. You can only pass it from the outside, and it easily creates impurity. In my experience, problems are better solved with explicit argument passing or the functions relating to fix-points like callPackage and the overlay system.

As an example, NixOS has only one extra search path parameter, and it is only read once in nixos/default.nix if no explicit configuration is given. This way, you have the flexibility to provide your own configuration, which is why you (nix-build) and hydra can confidently build the NixOS VM tests, bootable images, docker images, etc.

What do the numbers after command and system call names mean in *nix?

These numbers refer to Unix man sections.

1   Commands available to users
2 Unix and C system calls
3 C library routines for C programs
4 Special file names
5 File formats and conventions for files used by Unix
6 Games
7 Word processing packages
8 System administration commands and procedures

You can specify a section number with the man command by just listing the section number:

man 1 somecommand  

would look for somecommand in section 1 of the man pages.

Wikipedia has some additional information on this as does this page on how to use man pages.



Related Topics



Leave a reply



Submit