diff --git a/README.md b/README.md index 138ae1bbdbaf39fd20f46cc41308d489a430e43a..134f5c69937257c745bb433e26f29039b1bce7fe 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,40 @@ This repository contains the material for the practical session of course [RM4ES](https://moodle.univ-tlse3.fr/course/view.php?id=4996) given in the Spring semester of 2024. ## Install +Ensure that you are in your home directory (run `cd`). + Clone this repository: ``` git clone git@gitlab.irit.fr:sepia-pub/mael/RM4ES-practicals.git -cd RM4ES-practicals ``` -TODO: how to install Nix on lab computers +Install [Nix]: + +```bash +# download and install nix-user-chroot, a hack to install nix without root privilege +curl -L https://github.com/nix-community/nix-user-chroot/releases/download/1.2.2/nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl --output nix-user-chroot +# give exec rights +chmod u+x nix-user-chroot +# download and install nix +./nix-user-chroot ~/.nix bash -c "curl -L https://nixos.org/nix/install | bash" +# enable cachix +mkdir -p ~/.config/nix && cp ~/RM4ES-practicals/util/nix.conf ~/.config/nix +# add a line to your bashrc +echo 'source ~/.nix-profile/etc/profile.d/nix.sh' >> ~/.bashrc +``` + +Now, each time you want to test your schedulers, you need to run, from the repository `RM4ES-practicals`: + +```bash +~/nix-user-chroot ~/.nix bash +nix-shell -A expe +``` + +Or, as a one-liner: +```bash +~/nix-user-chroot ~/.nix bash -c "nix-shell -A expe" +``` -TODO: how to install poetry on lab computers ## Status rn We can start a small expe! diff --git a/default.nix b/default.nix index 1dc0d9865d5c0598af7649af5e2c1e4d4bbc93a1..9898783613e5067170505fb41649adee963a5f7c 100644 --- a/default.nix +++ b/default.nix @@ -9,7 +9,6 @@ let jobs = rec { - evalys = kapack.evalys.overrideAttrs (attr: rec { name = "evalys"; version = "d4d47bd2f4d076730b05f1345b1bf9032cd28753"; @@ -20,77 +19,15 @@ let }; }); - - # small shell to dev and test schedulers - dev = pkgs.mkShell rec { - packages = [ - # kapack.pybatsim-core - pkgs.stdenv.cc.cc.lib - # python3Packages.poetry - python3 - (pkgs.poetry.override { python3 = python3; }) - # (python3.withPackages - # (ps: with ps; with python3Packages; [ - # poetry-core - # ]) - # ) - ]; - shellHook = '' - cd sched - poetry install - export VIRTUAL_ENV_DISABLE_PROMPT=1 - poetry shell - ''; - - LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib"; - }; - expe = pkgs.mkShell rec { buildInputs = [ - kapack.batsim + kapack.batsim-410 + kapack.pybatsim-320 python3Packages.matplotlib evalys ]; - QT_QPA_PLATFORM_PLUGIN_PATH = with pkgs.libsForQt5.qt5; "${qtbase.bin}/lib/qt-${qtbase.version}/plugins/platforms"; + QT_QPA_PLATFORM_PLUGIN_PATH= with pkgs.libsForQt5.qt5; "${qtbase.bin}/lib/qt-${qtbase.version}/plugins/platforms"; }; - - test = pkgs.mkShell rec { - buildInputs = [ - # pkgs.stdenv.cc.cc.lib - python3Packages.poetry-core - pkgs.poetry - ]; - - # LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib"; - }; - # lib = pkgs.lib; - # pybatsim-example = python3Packages.buildPythonPackage rec { - # pname = "pybatsim-example"; - # version = "local"; - # format = "pyproject"; - - # src = lib.sourceByRegex ./sched [ - # "^pyproject\.toml$" - # "^poetry\.lock$" - # "^.*\.py$" - # ]; - # buildInputs = [ - # poetry - # ]; - # propagatedBuildInputs = [ - # pybatsim-core - # ]; - # }; - - # # example shell that enables to run the example scheduler (run `pybatsim rejector` in the shell) - # example-shell = pkgs.mkShell rec { - # buildInputs = [ - # pybatsim-example - # ]; - # }; - - - }; in diff --git a/util/nix.conf b/util/nix.conf new file mode 100644 index 0000000000000000000000000000000000000000..145f55b8d7fadcf7de2ee4964af46c23ce3cf6df --- /dev/null +++ b/util/nix.conf @@ -0,0 +1,6 @@ +sandbox = true +experimental-features = nix-command flakes +cores = 4 +max-jobs = auto +substituters = https://cache.nixos.org https://capack.cachix.org https://batsim.cachix.org +trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= batsim.cachix.org-1:IQ/4c8P/yzhxQwp6t58LatLcvHz0qMolEHJQz9w9pxc= capack.cachix.org-1:38D+QFk3JXvMYJuhSaZ+3Nm/Qh+bZJdCrdu4pkIh5BU= \ No newline at end of file