summaryrefslogtreecommitdiff
path: root/overlays/wifi2qr.nix
blob: 72b1535f4adf23f5952359427abd79ddb85e9401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
final: prev:
let
  rev = "407ceb7cc5b72598aed79fb59c5c8c545b951f8e";
in {
  wifi2qr = prev.stdenv.mkDerivation {
    name = "wifi2qr";
    version = builtins.substring 0 8 rev;
    src = prev.fetchurl {
      url = "https://raw.githubusercontent.com/dlenski/wifi2qr/${rev}/wifi2qr";
      hash = "sha256-FmiSlYhq3SoUNaWMByvHGO91dFsc3Px++WIkDsXZP6g=";
    };

    buildInputs = [ prev.makeWrapper ];
    
    phases = ["unpackPhase" "patchPhase" "installPhase"];
    unpackPhase = ''
      install -m 0644 $src wifi2qr
    '';
    patchPhase = ''
      ${prev.gnused}/bin/sed -ri 's|#!/bin/bash|#!${final.bash}/bin/bash|' wifi2qr
    '';
    installPhase = ''
      mkdir -p $out/bin
      install -m 0755 -t $out/bin wifi2qr
      wrapProgram $out/bin/wifi2qr \
        --set PATH ${final.which}/bin:${final.coreutils}/bin:${final.gnugrep}/bin:${final.gnused}/bin:${final.libqrencode}/bin:${final.networkmanager}/bin
    '';
  };
}