liminix

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

default.nix (918B)


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