summary refs log tree commit diff
path: root/pkgs/build-support/usernixos/activation.nix
blob: 2e3f0af2bf7789aaba23d93cae0ee2d737096ce2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ pkgs, config, ... }:

let
  script = pkgs.writeScriptBin "usernixos" (''
    #!${pkgs.bash}/bin/bash
  '' + config.activationContents);
in
with pkgs.lib;
{
  options = {
    activation = mkOption {
      default = {};
    };

    activationContents = mkOption {
      default = "";
      internal = true;
      merge = concatStringsSep "\n";
      description = ''
        Commands to run at activation
      '';
    };
  };

  config.activation.toplevel = script;
}