Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove perl dependency in activation scripts #51198

Closed
andrewchambers opened this issue Nov 29, 2018 · 11 comments
Closed

Remove perl dependency in activation scripts #51198

andrewchambers opened this issue Nov 29, 2018 · 11 comments
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@andrewchambers
Copy link
Contributor

andrewchambers commented Nov 29, 2018

Issue description

Approximately 10 percent of a minimal nixos install is perl, perhaps we could remove this somehow.

Not critical, feel free to close the issue if this is not the right place for that.

Steps to reproduce

Use a config like:

{ config, lib, ... }:
{
    imports = [
        <nixpkgs/nixos/modules/profiles/minimal.nix>
        <nixpkgs/nixos/modules/profiles/headless.nix>
        <nixpkgs/nixos/modules/profiles/qemu-guest.nix>
    ];

    fileSystems."/" = {
      device = "/dev/disk/by-label/nixos";
      autoResize = true;
    };

    boot.growPartition = true;
    boot.loader.grub.device = "/dev/sda";
    boot.kernelParams = [ "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
    boot.initrd.kernelModules = [ "virtio_scsi" ];
    boot.kernelModules = [ "virtio_pci" "virtio_net" ];

}

Run

nixos-rebuild build -I nixos-config="./configuration.nix"
du -sch $(nix-store -qR ./result) | sort -h

And see the second largest dependency is perl:

...
56M     /nix/store/q9ajsngf2w3r10dg7b1148wzq1avp4gj-perl-5.28.0
70M     /nix/store/cs0lixjvndy2z4gby1nvmnzdd4jkmi02-linux-4.14.81
597M    total
[ac@black:~/src/minimal-nixos]$ nix why-depends ./result /nix/store/q9ajsngf2w3r10dg7b1148wzq1avp4gj-perl-5.28.0
/nix/store/zazd30c454axi23z00qr5q7y3rvzzvvd-nixos-system-nixos-18.09pre-git
╚═══activate: …ll -m 0755 -d /home../nix/store/q9ajsngf2w3r10dg7b1148wzq1avp4gj-perl-5.28.0/bin/perl -w \.  -I/…
    => /nix/store/q9ajsngf2w3r10dg7b1148wzq1avp4gj-perl-5.28.0

Looking further, the two uses of perl are

/nix/store/1hkp2n6hz3ybf2rvkjkwrzgbjkrrakzl-update-users-groups.pl
and /nix/store/vn1xs9s2akf79y1pbya2qldydbf2b22m-setup-etc.pl .

So a few hundred lines of perl are taking up 10 percent of the base install.

@jtojnar
Copy link
Member

jtojnar commented Nov 29, 2018

Is it really an issue? See also #48378 for similar discussion.

@andrewchambers
Copy link
Contributor Author

It affects provisioning and boot times of VM's - Am investigating now to what degree, will report back with some results on google cloud platform and others using a tiny image I built today.

@c0bw3b c0bw3b added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Dec 4, 2018
@stale
Copy link

stale bot commented Jun 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2020
@xaverdh
Copy link
Contributor

xaverdh commented Jan 1, 2021

I made an attempt at rewriting setup-etc.pl in rust here. This is also my first program in rust ever, so please don't blindly run this on your system as root (just yet).
suggestions / help / reviews are welcome!

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 1, 2021
@xaverdh
Copy link
Contributor

xaverdh commented Jan 8, 2021

Ah the repository should be public now (I forgot about gitlab defaults to creates them as private..)

@Gaelan
Copy link
Contributor

Gaelan commented Feb 20, 2021

I'm all for Rust in general, but I'm not sure we want activation scripts in a compiled language.

Activation scripts are one of the few "moving parts" of a NixOS system, and I imagine there are a lot of situations where the ability to easily read, debug, and edit them would help with recovering from weird bugs. I've never personally ended up in such a situation, so it'd be interesting to hear from anyone who has.

@Gaelan
Copy link
Contributor

Gaelan commented Feb 20, 2021

I suppose this is less of a problem if it's just a prebuilt binary configured via arguments/environment/config file/etc instead of something like the current perl script that's partially dynamically generated.

@stale
Copy link

stale bot commented Aug 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 21, 2021
@AkechiShiro
Copy link
Contributor

@Gaelan So is a Rust pre-built binary something of interest or not worth it at all ?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 12, 2022
@otavio
Copy link
Contributor

otavio commented Feb 28, 2024

I'd love to see this moving forward; this reduces the size of minimal images and helps to boost the maintenance in long term.

@zimbatm
Copy link
Member

zimbatm commented Sep 6, 2024

This is now possible thanks to nikstur's work. See #270727 and follow-ups.

@zimbatm zimbatm closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

No branches or pull requests

8 participants