| 2 Apr 2024 |
| Rosario Pulella joined the room. | 12:27:39 |
| dgrig joined the room. | 15:13:18 |
| Ruther joined the room. | 19:52:38 |
| 3 Apr 2024 |
| quentin joined the room. | 00:28:49 |
| blu3 changed their display name from exet to blu3. | 16:01:24 |
| blu3 set a profile picture. | 16:44:08 |
| 5 Apr 2024 |
| kittenmreeow joined the room. | 15:16:46 |
| 6 Apr 2024 |
steveej | i'm working on a nixos config for a cloud-hypervisor based hosting platform. they load the kernel and initram directly without a bootloader. they hardcode calling /init. now i'm looking for a way to replace the /init. i've accepted the fact that i won't be able to do fallback for now. what is the right place in a config to execute this? i'm thinking of boot.loader.external.installHook but don't fully understand the context it runs in | 09:41:28 |
steveej | * i'm working on a nixos config for a cloud-hypervisor based hosting platform. they load the kernel and initram directly without a bootloader. they hardcode calling /init. now i'm looking for a way to replace the /init on nixos-rebuild switch or boot. i've accepted the fact that i won't be able to do fallback for now. what is the right place in a config to execute this? i'm thinking of boot.loader.external.installHook but don't fully understand the context it runs in | 09:42:04 |
K900 | What we've done in NixOS-WSL is use an activation script to inject a binary there | 09:43:43 |
K900 | That looks something like this: https://github.com/nix-community/NixOS-WSL/blob/main/utils/src/shim.rs | 09:44:21 |
K900 | You probably want to do something similar | 09:44:27 |
K900 | (or even steal that one wholesale as I'm pretty sure it doesn't have any WSL specific hacks left) | 09:44:39 |
steveej | i thought about an activation that too. does that work in the nixos-rebuild boot case? i thought it's only executed when the new system is booted, which in my case relies on /init pointing to the new system | 09:47:41 |
K900 | It doesn't, no | 09:48:33 |
K900 | The more correct way to do it would be through a bootloader script, yes | 09:48:43 |
K900 | But the important thing here is that you can't just symlink NixOS init to the right place and expect it to work | 09:49:01 |
K900 | Because normally activation happens before that | 09:49:06 |
K900 | So you have to have your own thing that will run the activation script and then run the stage2 init | 09:49:24 |
steveej | FWIW, this works imperatively on the system:
set -xeEu -o pipefail
result="$(nix build --refresh --tarball-ttl 0 github:holochain/holochain-infra/workorch-zos#nixosConfigurations.tfgrid-devnet-vm0.config.system.build.toplevel --print-out-paths --no-link)"
ln -sf "${result}"/init /init
| 09:49:30 |
steveej | i'd be ok putting this anywhere appropriate. but i want to prevent running it anywhere else other than on the actual target system, for probably obvious reasons 😆 | 09:50:47 |
steveej | this is just the update use-case. i've already got something for the initial system assembly | 09:51:07 |
steveej | i'm looking through the shim code you've sent me and am intimidated by wrangling with /dev entries :-) is this used as a PID1 shim? | 09:53:34 |
steveej | either i'm oversimplifying or my use-case is actually simpler than in WSL | 09:54:17 |
K900 | The /dev stuff can be ignored | 09:55:47 |
K900 | It's a workaround for a stupid WSL bug | 09:55:50 |
| Tumble joined the room. | 10:11:52 |
steveej | this works (obviously it's not a noop anymore)
boot.loader.external.installHook = pkgs.writeShellScript "noop" ''
${pkgs.coreutils}/bin/ln -sf "$1"/init /init
'';
| 10:37:57 |
adamcstephens | The lxc container does something similar | 11:29:02 |
| Sammy (It/Its) joined the room. | 13:05:26 |