2023-02-13 23:23:27 +01:00
{ stdenv , fetchFromGitLab , shellcheck , kmod , lib }:
stdenv . mkDerivation {
2023-08-16 00:23:36 +02:00
pname = " l i b r e m 5 - b a s e " ;
2023-02-13 23:23:27 +01:00
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 " ;
2023-08-16 00:23:36 +02:00
rev = " 9 6 b 0 f 9 2 0 c d e 9 1 5 7 3 3 2 b 0 c 1 6 b a 1 1 3 5 e e 6 0 a 3 f 3 2 5 9 " ;
hash = " s h a 2 5 6 - n R 4 2 d k 3 g 0 / I k V F y g Z 7 K 1 S Z 2 K o Q J e D z u M O u m K d O O Q S 5 k = " ;
2023-02-13 23:23:27 +01:00
} ;
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
2023-08-16 00:23:36 +02:00
mkdir - p " $ o u t / e t c / p u l s e "
cp - v " d e f a u l t / a u d i o / p u l s e / l i b r e m 5 . p a " " $ o u t / e t c / p u l s e / l i b r e m 5 . p a "
substituteInPlace " $ o u t / e t c / p u l s e / l i b r e m 5 . p a " \
- - replace " . i n c l u d e / e t c / p u l s e / d e f a u l t . p a " " "
2023-02-13 23:23:27 +01:00
'' ;
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 15:21:51 +02:00
# President@Purism promised it's under a free license: https://matrix.to/#/%23community-librem-5%3Atalk.puri.sm/%24hNCtZr7Escmr56uz1eEiaHpakteEXig7b5G8t2W6tWs
2023-02-13 23:23:27 +01:00
meta . license = lib . licenses . free ;
}