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
				
			
							
								
								
									
										53
									
								
								purism/librem/5r4/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								purism/librem/5r4/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
{ config, pkgs, lib, ... }:
 | 
			
		||||
let cfg = config.hardware.librem5;
 | 
			
		||||
in {
 | 
			
		||||
  options = {
 | 
			
		||||
    hardware.librem5 = {
 | 
			
		||||
      wifiCard = lib.mkOption {
 | 
			
		||||
        type = lib.types.enum [ "redpine" "sparklan" "none" ];
 | 
			
		||||
        description = lib.mdDoc ''
 | 
			
		||||
          Which wi-fi card is installed in your phone.
 | 
			
		||||
 | 
			
		||||
          Phones shipped before Januarly 2023 have redpine, newer phones have sparklan.
 | 
			
		||||
        '';
 | 
			
		||||
        default = "redpine";
 | 
			
		||||
      };
 | 
			
		||||
      customInitrdModules = lib.mkEnableOption (lib.mdDoc "use of custom kernel modules in the initrd.");
 | 
			
		||||
      installUdevPackages = lib.mkEnableOption (lib.mdDoc "installation of udev packages from librem5-base.");
 | 
			
		||||
      lockdownFix = lib.mkEnableOption (lib.mdDoc "fix for orientation and proximity sensors not working after lockdown.");
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  imports = [ ./initrd.nix ./wifi.nix ./lockdown-fix.nix ];
 | 
			
		||||
 | 
			
		||||
  config = {
 | 
			
		||||
    hardware.librem5 = {
 | 
			
		||||
      customInitrdModules = lib.mkDefault true;
 | 
			
		||||
      installUdevPackages = lib.mkDefault true;
 | 
			
		||||
      lockdownFix = lib.mkDefault true;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    nixpkgs.overlays = [
 | 
			
		||||
      (import ./kernel)
 | 
			
		||||
      (final: prev: {
 | 
			
		||||
        ubootLibrem5 = final.callPackage ./u-boot { };
 | 
			
		||||
 | 
			
		||||
        librem5-base = final.callPackage ./librem5-base { };
 | 
			
		||||
      })
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    boot = {
 | 
			
		||||
      kernelParams = [ "rootwait" ];
 | 
			
		||||
 | 
			
		||||
      loader = {
 | 
			
		||||
        generic-extlinux-compatible.enable = lib.mkDefault true;
 | 
			
		||||
        grub.enable = false;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      kernelPackages = lib.mkDefault pkgs.linuxPackages_librem5;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    services.udev.packages = lib.mkIf cfg.installUdevPackages [ pkgs.librem5-base ];
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user