In this assignment you will install the software you need for the lab assignments of this course. After this session, you should have a comfortable working environment, so that you can immediately start with the real work in the next lab assignment.
Configuring a User-Friendly Shell
(This section is optional. Please ignore if your are perfectly comfortable using your current shell)
Most of the time, we will be working in a terminal. Therefore, it is important that the shell you are using is user-friendly. For example, it is quite useful if pressing the
key actually deletes a character, which is by default not the case. For many users,
is easier to use then the default shell on our Linux machines:
(Korn Shell). You can find out what shell you are using by typing:
You can also recognize the shell by its prompt: the usual prompt of
is a plain
. Bash usually shows the current user, directory, followed by a
. You can change the shell to bash by just entering the command
. If you want to change your shell to bash forever, then add the line
the end of the file
in your home directory. Also, you have to change the configuration of the gnome terminal: start the terminal, go to edit, current-profile, title and command and enable the checkbox "Run command as login shell". From now, we will assume that you are using bash.
If your Bash prompt is not
, then you can configure bash to use this prompt by adding the line
The software you will use in this course is deployed using Nix
. Nix is already installed on the Linux machines.
First, please check if you are a member of the
group, which is required for using Nix. If you are not, then please ask the teaching assistent
for help. Example for my account:
First, you have to prepare your account for using Nix. Please add the following line to
(create the file if it does not exist.
stands for your home directory, aka
. You can edit
with any plain text editor you want (emacs, vi, kate, gedit, pico, nano, ...)
Now, start a new terminal, and start the bash shell (the default shell is
, which is not very user-friendly). Now you should be able to invoke the program
, since the line you have just added to
adds the Nix installation directory to your path. Try if the tool indeed can be found using:
$ nix-env --help
This should print some information on how to use
, which you can ignore for now. You are now ready to use Nix to install the required software.
Using the PT channel
The software you need during this course is available in a so called Nix channel. You can use this Nix channel to install all the software safely and quickly and it is easy to update your installation if new software is available.
You need to install:
- eclipse-sdk (optional)
- subversion (optional)
Subscribing to the Channel
First, check if you are already subscribed to any Nix channels:
$ nix-channel --list
If this show a list of URLs, then remove every url using the command:
$ nix-channel --remove url
Next, subscribe yourself to the PT channel:
$ nix-channel --add http://nix.cs.uu.nl/dist/courses/channels-v3/nixpkgs-pt-unstable
Next, update the channels you are subscribed to:
$ nix-channel --update
You can now have a look at the software that is available in this channel:
$ nix-env -qa
This will show a list of packages. You can now install this software using:
$ nix-env -i sdf2-bundle strategoxt java-front ...
This will take some time, since lots of dependencies will have to be downloaded.
Check the Installation
You can try if everything works using one or more of the following commands:
$ sdf2table --help
$ strc --help
$ stratego-shell --help
$ parse-java --help
$ dryad-front --help
(part of the sdf2-bundle) and
(part of Stratego/XT) are in fact already installed in
. Please check if your
is configured correctly by verifying the version of
$ strc --version
This should print STRC 0.17M1 (revision ????) and not 0.14, which is the version of
For more information about using Nix and Nix channels, please consult the Nix manual, available from the Nix
Update Before Every Session
Before starting on your assignments, you should always check if we have updated or added software in the Nix channel. Also, you need to update if you are working on a different computer in the lab. Updating the installation is done using the following commands:
$ nix-channel --update
$ nix-env -u '*'
Working at Home
If you want to work on the lab assignments at home, then we advice to install Nix on your Linux machine, but you can also install the packages using RPMs. It is not possible to do the lab assignments on a Microsoft Windows machine. See Software
for more information.
Choose an Editor
For some students this will be their first experience with a GNU/Linux system. You'll need an editor for Stratego, SDF, shell scripts, etc. There are several options:
Eclipse. Stratego supports Eclipse with the Spoofax plugin. Sometimes Eclipse is a bit heavy for our assignments, since Eclipse is project oriented, but Eclipse is the editor with the best support for Stratego, so we advice you to use Eclipse. Eclipse is available in the PT channel. This already includes the Spoofax plugin, so you don't need to do anything but install Eclipse from this channel. Please make sure that you don't accidentally start the Eclipse that was already installed on your system.
GNU Emacs supports a lot of different file formats. Stratego support for Emacs is ok. The biggest advantage of GNU Emacs is that the support for shell scripts, Makefiles, etc is very good.
Ultraedit. For typical Microsoft Windows users,
kate might be a bit more accessible than GNU Emacs.
At the Stratego website you can find an overview of the support for editors
Make GNU Emacs User Friendly
(This section is optional. Please ignore if you already have a favourite editor for Linux)
Unfortunately, GNU Emacs has some rough edges in its default configuration. In this section we will explain how to configure GNU Emacs to make it more user friendly
First, many people are used to
for selection. The CUA mode configures Emacs to use these key bindings. Download the CUA Mode
) to a directory, for example
Next, edit the file
to activate the CUA mode. Add the following lines the end of this file:
(add-to-list 'load-path "~/myemacs")
Now you can start GNU Emacs:
You can specify files that you want to open on the command-line, and you can open files via the menu. Check if your
works and cry for help if it does not.
Next, you might want to change the default font of GNU Emacs. You can do that by saving this file
to your home directory.
It's probably a good idea to save your assignments in Subversion. If you don't have a personal repository for course work yet, then you can create one yourself in our Subversion Repoman
. Please make sure that the repository is not accessible to other students.
You don't have to submit anything.