diff --git a/devices/xmuhk/README.md b/devices/xmuhk/README.md index b6c83617..3d02a545 100644 --- a/devices/xmuhk/README.md +++ b/devices/xmuhk/README.md @@ -1,21 +1,13 @@ # install nix -1. download [nix-portable](https://github.com/DavHau/nix-portable), - move the executable file to `$PATH`, rename it to `nix-portable` and make it executable. -2. create several symlinks (including `nix` `nix-store` etc.) to it. -3. create file `~/.config/nix/nix.conf` with the following content: `ignored-acls = lustre.lov` -4. run `nix --version`, wait for it to initialize and print the version. +1. Build nix using `nix build github:NixOS/nixpkgs/nixos-24.11#nixStatic`, upload, create symlink `nix-store` `nix-build` etc. pointing to it. +2. Upload `.config/nix/nix.conf`. # install or update packages -1. run `nix build github:CHN-beta/nixos#xmuhk` elsewhere (on NixOS is better, to avoid impure from FHS envs) -2. `nix-store --export $(nix-store -qR ./result) | xz -T0 | pv > xmuhk.nar.xz` -3. copy `xmuhk.nar.xz` to hpc, import it with `cat xmuhk.nar.xz | nix-store --import` -4. create gcroot symlink: `ln -s /nix/store/xxxx-xmuhk ~/.nix-portable/nix/var/nix/gcroots/current` -5. optionally `nix gc` -6. create `nix-exec` in `$PATH` with the following content, make it executable: - ```sh - #!/usr/bin/env sh - nix shell ~/.nix-portable/nix/var/nix/gcroots/current -c "$(basename "$0")" "$@" - ``` -7. make symlinks to `nix-exec` for needed commands, e.g. `ln -s singularity nix-exec` +1. On nixos, make sure `/public/home/xmuhk/.nix` is mounted correctly. +2. Build using `sudo nix build --store 'local?store=/public/home/xmuhk/.nix/store&state=/public/home/xmuhk/.nix/state&log=/public/home/xmuhk/.nix/log' .#xmuhk` . +3. Diff store using `sudo nix-store --store 'local?store=/public/home/xmuhk/.nix/store&state=/public/home/xmuhk/.nix/state&log=/public/home/xmuhk/.nix/log' -qR ./result | grep -Fxv -f <(ssh xmuhk find .nix/store -maxdepth 1 -exec realpath '{}' '\;') | sudo xargs nix-store --store 'local?store=/public/home/xmuhk/.nix/store&state=/public/home/xmuhk/.nix/state&log=/public/home/xmuhk/.nix/log' --export | xz -T0 | pv > xmuhk.nar.xz` . +4. Upload `xmuhk.nar.xz` to hpc. +5. On hpc, `pv xmuhk.nar.xz | xz -d | nix-store --import` . +6. Create gcroot using `nix build /xxx-xmuhk -o .nix/state/gcroots/current`, where `/xxx-xmuhk` is the last path printed by `nix-store --import` . diff --git a/devices/xmuhk/default.nix b/devices/xmuhk/default.nix index 0037eb75..d85d3cfc 100644 --- a/devices/xmuhk/default.nix +++ b/devices/xmuhk/default.nix @@ -1,6 +1,3 @@ -# sudo nix build --store 'local?store=/public/home/xmuhk/.nix/store&state=/public/home/xmuhk/.nix/state&log=/public/home/xmuhk/.nix/log' .#xmuhk -# sudo nix-store --store 'local?store=/public/home/xmuhk/.nix/store&state=/public/home/xmuhk/.nix/state&log=/public/home/xmuhk/.nix/log' -qR ./result | grep -Fxv -f <(ssh xmuhk find .nix/store -maxdepth 1 -exec realpath '{}' '\;') | sudo xargs nix-store --store 'local?store=/public/home/xmuhk/.nix/store&state=/public/home/xmuhk/.nix/state&log=/public/home/xmuhk/.nix/log' --export | xz -T0 | pv > xmuhk.nar.xz -# cat data.nar | nix-store --import { inputs, localLib }: let pkgs = import inputs.nixpkgs (localLib.buildNixpkgsConfig