liminix

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

default.nix (896B)


      1 {
      2   config,
      3   pkgs,
      4   lib,
      5   ...
      6 }:
      7 let
      8   o = config.system.outputs;
      9   inherit (pkgs) runCommand;
     10   inherit (lib) mkOption types;
     11   inherit (pkgs.buildPackages) min-copy-closure;
     12 in
     13 {
     14   imports = [ ../system-configuration.nix ];
     15   options.system.outputs.updater = mkOption {
     16     type = types.package;
     17     description = ''
     18       updater
     19       ******
     20 
     21       For configurations with a writable filesystem, create a shell
     22       script that runs on the build system and updates the device
     23       over the network to the new configuration
     24     '';
     25   };
     26 
     27   config.system.outputs.updater = runCommand "buildUpdater" { } ''
     28     mkdir -p $out/bin $out/etc
     29     cp ${o.kernel.config} $out/etc/kconfig
     30     substitute ${./update.sh} $out/bin/update.sh \
     31        --subst-var-by toplevel ${o.systemConfiguration} \
     32        --subst-var-by min_copy_closure ${min-copy-closure}
     33     chmod +x  $out/bin/update.sh
     34   '';
     35 }