mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	Add config for Librem 5
This commit is contained in:
		
				
					committed by
					
						
						Jörg Thalheim
					
				
			
			
				
	
			
			
			
						parent
						
							50dc4ef928
						
					
				
				
					commit
					9070d2340c
				
			
							
								
								
									
										43
									
								
								purism/librem/5r4/librem5-base/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								purism/librem/5r4/librem5-base/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
{ stdenv, fetchFromGitLab, shellcheck, kmod, lib }:
 | 
			
		||||
stdenv.mkDerivation {
 | 
			
		||||
  pname = "librem5-udev-rules";
 | 
			
		||||
  version = "unstable";
 | 
			
		||||
  src = fetchFromGitLab {
 | 
			
		||||
    domain = "source.puri.sm";
 | 
			
		||||
    owner = "Librem5";
 | 
			
		||||
    repo = "librem5-base";
 | 
			
		||||
    rev = "f5b51beb144f76ef3bc483b74e19867bd6364d32";
 | 
			
		||||
    hash = "sha256-5k7e4o9ak0zik+XqRV6PPwkTDf3yH3NxtLkhTyCQj7U=";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  buildPhase = ":";
 | 
			
		||||
 | 
			
		||||
  checkInputs = [ shellcheck ];
 | 
			
		||||
  doCheck = true;
 | 
			
		||||
  checkPhase = "make";
 | 
			
		||||
 | 
			
		||||
  installPhase = ''
 | 
			
		||||
    mkdir -p "$out/bin" "$out/lib/udev/rules.d"
 | 
			
		||||
    cp -v default/lockdown-support/lockdown-support.sh "$out/bin"
 | 
			
		||||
    chmod +x "$out/bin/lockdown-support.sh"
 | 
			
		||||
    cp -v default/gpsd/99-gnss.rules "$out/lib/udev/rules.d"
 | 
			
		||||
 | 
			
		||||
    pushd debian
 | 
			
		||||
    for rule in librem5-base-defaults.*.udev; do
 | 
			
		||||
      cp -v "$rule" "$out/lib/udev/rules.d/''${rule#*.}.rules"
 | 
			
		||||
    done
 | 
			
		||||
    popd
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  postFixup = ''
 | 
			
		||||
    sed -i \
 | 
			
		||||
      -e "s@/usr/sbin/lockdown-support.sh@$out/bin/lockdown-support.sh@g" \
 | 
			
		||||
      -e "s@/usr/sbin/modprobe@${kmod}/bin/modprobe@g" \
 | 
			
		||||
      -e "s@/usr/sbin/rmmod@${kmod}/bin/rmmod@g" \
 | 
			
		||||
      "$out"/lib/udev/rules.d/*.udev.rules
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  # https://source.puri.sm/Librem5/librem5-base/-/issues/68
 | 
			
		||||
  # President@Purism promised it's under a free license: https://matrix.to/#/%23community-librem-5%3Atalk.puri.sm/%24hNCtZr7Escmr56uz1eEiaHpakteEXig7b5G8t2W6tWs?via=balsoft.ru&via=matrix.org&via=shareknot.de&via=zorix.us
 | 
			
		||||
  meta.license = lib.licenses.free;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user