diff --git a/README.md b/README.md index f8cd12dc09..e76a732f96 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ The MDSplus developers want to know who you are. If you or your site is using MD [MDSplus User Survey](https://docs.google.com/forms/d/e/1FAIpQLScSsA-fY2yTsW076bBreJmNbBqY9jsd-m4vmAdPvfCxXidiOQ/viewform?usp=sf_link). ## Building MDSplus + +### Building from source manually To build and install MDSplus on unix systems, you will need to obtain the MDSplus distribution from github either as a git repository or as a compressed tar file. @@ -35,6 +37,7 @@ When MDSplus is built to generate releases for public distribution a deploy script is used which uses Docker to pull specially configured Docker images from https://hub.docker.com/r/mdsplus/docker/ +### Building using Dockerized build environment You can build MDSplus for any of the linux and windows operatings systems without needing to install any special compilers or libraries. If you have the mdsplus source code and Docker installed on your linux system and your @@ -60,6 +63,20 @@ You can find the available operating systems that you could specify for the # ls /deploy/os/*.opts +### Building with nix package manager +The mdsplus repo is a nix flake, meaning that it specifies a build recipe +for mdsplus and all of its dependencies. You can automatically download, +build, and install mdsplus using the following nix command (after enabling the +currently experimental flakes feature): + + nix shell github:mdsplus/mdsplus/ + +Upon first invocation, the above command will build and install mdsplus into +the nix store, and then put the user into a subshell in which the mdsplus +programs are available on the PATH. The commands will be accessible until +the subshell is exited. In subsequent invocations, the user will go directly +into the subshell without rebuilding or reinstalling. + --------------------------------------------------------------------------- Who Uses MDSplus This map shows world fusion sites using MDSplus. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..20aad5414e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1622516815, + "narHash": "sha256-ZjBd81a6J3TwtlBr3rHsZspYUwT9OdhDk+a/SgSEf7I=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7e9b0dff974c89e070da1ad85713ff3c20b0ca97", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..75a1c6cd89 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +{ + description = "mdsplus scientific database"; + inputs.nixpkgs.url = "github:nixos/nixpkgs/21.05"; + + outputs = { self, nixpkgs }: + with import nixpkgs { + system = "x86_64-linux"; + }; + + let + mdsplus = stdenv.mkDerivation rec { + name = "mdsplus"; + src = self; + # https://github.com/MDSplus/mdsplus/blob/alpha/README.INSTALL + buildInputs = [ + gperf + jdk8 + jre8 + libxml2 + readline + motif + perl + xorg.libXt + ]; + patchPhase = '' + patchShebangs --build . + ''; + preConfigure = '' + ./bootstrap + ''; + nativeBuildInputs = [ + which + automake + autoconf + autoconf-archive + python + git + flex + bison + gfortran + rsync + ]; + }; + + mdsplus_wrapped = runCommand "mdsplus" { + buildInputs = [ mdsplus ]; + nativeBuildInputs = [ makeWrapper ]; + } '' + for b in $(ls ${mdsplus}/bin); do + makeWrapper ${mdsplus}/bin/$b $out/bin/$b --set MDSPLUS_DIR "${mdsplus}" + done + ln -s ${mdsplus} $out/mdsplus-install-location + ''; + + in { + packages.x86_64-linux = { mdsplus = mdsplus_wrapped; }; + defaultPackage.x86_64-linux = self.packages.x86_64-linux.mdsplus; + }; +}