2023-02-13 17:23:27 -05:00
{ stdenv , fetchFromGitLab , shellcheck , kmod , lib }:
stdenv . mkDerivation {
pname = " l i b r e m 5 - u d e v - r u l e s " ;
version = " u n s t a b l e " ;
src = fetchFromGitLab {
domain = " s o u r c e . p u r i . s m " ;
owner = " L i b r e m 5 " ;
repo = " l i b r e m 5 - b a s e " ;
rev = " f 5 b 5 1 b e b 1 4 4 f 7 6 e f 3 b c 4 8 3 b 7 4 e 1 9 8 6 7 b d 6 3 6 4 d 3 2 " ;
hash = " s h a 2 5 6 - 5 k 7 e 4 o 9 a k 0 z i k + X q R V 6 P P w k T D f 3 y H 3 N x t L k h T y C Q j 7 U = " ;
} ;
buildPhase = " : " ;
checkInputs = [ shellcheck ] ;
doCheck = true ;
checkPhase = " m a k e " ;
installPhase = ''
mkdir - p " $ o u t / b i n " " $ o u t / l i b / u d e v / r u l e s . d "
cp - v default/lockdown-support/lockdown-support.sh " $ o u t / b i n "
chmod + x " $ o u t / b i n / l o c k d o w n - s u p p o r t . s h "
cp - v default/gpsd/99-gnss.rules " $ o u t / l i b / u d e v / r u l e s . d "
pushd debian
for rule in librem5-base-defaults . * . udev ; do
cp - v " $ r u l e " " $ o u t / l i b / u d e v / r u l e s . d / ' ' ${ rule #*.}.rules"
done
popd
'' ;
postFixup = ''
sed - i \
- e " s @ / u s r / s b i n / l o c k d o w n - s u p p o r t . s h @ $ o u t / b i n / l o c k d o w n - s u p p o r t . s h @ g " \
- e " s @ / u s r / s b i n / m o d p r o b e @ ${ kmod } / b i n / m o d p r o b e @ g " \
- e " s @ / u s r / s b i n / r m m o d @ ${ kmod } / b i n / r m m o d @ g " \
" $ o u t " /lib/udev/rules.d /* . u d e v . r u l e s
'' ;
# https://source.puri.sm/Librem5/librem5-base/-/issues/68
2023-03-29 09:21:51 -04:00
# President@Purism promised it's under a free license: https://matrix.to/#/%23community-librem-5%3Atalk.puri.sm/%24hNCtZr7Escmr56uz1eEiaHpakteEXig7b5G8t2W6tWs
2023-02-13 17:23:27 -05:00
meta . license = lib . licenses . free ;
}