How to handle non-nixos compatible shebangs in i3blocks scripts?

#1

I’m using i3 as my window manager, and I thought I would try some of the more complicated status commands to i3’s ibar.

I’m currently trying i3blocks. The problem is that many of their user contributed scripts (https://github.com/vivien/i3blocks-contrib) use a shebang like #!/bin/bash, which won’t work on Nixos.

Any suggestions on how to deal with this since the are masses of these scripts?

0 Likes

#2

Doesn’t seem to be that many of them:

$ rg --no-filename '#!' | sort | uniq -c | sort --reverse
      9 #!/usr/bin/env bash
      8 #!/bin/bash
      7 #!/usr/bin/env python3
      6 #!/usr/bin/env perl
      4 #!/bin/sh
      2 #!/usr/bin/perl
      2 #! /bin/sh
      1 #! /usr/bin/perl

So you could just fix them (e.g. using /usr/bin/env bash etc. instead) and create a PR upstream. Alternative would be to create a nix package for the repository and use patchShebangs.

0 Likes

#3

So you could just fix them (e.g. using /usr/bin/env bash etc. instead) and create a PR upstream.

Probably the best solution since they actually accept such PRs.

1 Like

#4

Thanks for your reply!

I got two answers even though I only asked one question :slight_smile: In this case it seems to be easier to just fix the shebangs and propose changes upstream, but I didn’t know about patchShebangs so that is a plus.

0 Likes