The motivation in #5641 isn't too strong, but /etc/os-release exists on
pretty much every Linux distro, while /etc/nixos sounds like an
implementation detail.
});
// Patching executable if that's NixOS.
- if (await fs.stat("/etc/nixos").then(_ => true).catch(_ => false)) {
+ if (await isNixOs()) {
await patchelf(dest);
}
return dest;
}
+async function isNixOs(): Promise<boolean> {
+ try {
+ const contents = await fs.readFile("/etc/os-release");
+ return contents.indexOf("ID=nixos") !== -1;
+ } catch (e) {
+ return false;
+ }
+}
+
async function downloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> {
while (true) {
try {