liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

boot-fit.nix (690B)


      1 {
      2   config,
      3   pkgs,
      4   lib,
      5   ...
      6 }:
      7 let
      8   inherit (lib)
      9     mkIf
     10     mkEnableOption
     11     mkOption
     12     types
     13     concatStringsSep
     14     ;
     15   inherit (pkgs.pseudofile) dir symlink;
     16   cfg = config.boot.loader.fit;
     17   o = config.system.outputs;
     18   cmdline = concatStringsSep " " config.boot.commandLine;
     19   wantsDtb = config.hardware.dts ? src && config.hardware.dts.src != null;
     20 in
     21 {
     22   options.boot.loader.fit.enable = mkEnableOption "FIT in /boot";
     23 
     24   config = mkIf cfg.enable {
     25     system.outputs.bootfiles = pkgs.runCommand "boot-fit" { } ''
     26       mkdir $out
     27       cd $out
     28       cp ${o.uimage} fit
     29     '';
     30     filesystem = dir {
     31       boot = symlink config.system.outputs.bootfiles;
     32     };
     33   };
     34 }