1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-30 19:54:43 +00:00
nix-darwin/modules/system/write-text.nix
Daiderd Jordan cd49cc1ab3
generalized module for write-text
- use custom etc activation script
2016-11-05 22:47:09 +01:00

56 lines
955 B
Nix

{ lib, mkTextDerivation }:
with lib;
{ config, name, ... }:
let
sourceDrv = mkTextDerivation name config.text;
in
{
options = {
enable = mkOption {
type = types.bool;
default = true;
description = ''
Whether this /etc file should be generated. This
option allows specific /etc files to be disabled.
'';
};
text = mkOption {
default = null;
type = types.nullOr types.lines;
description = ''
Text of the file.
'';
};
target = mkOption {
type = types.str;
default = name;
description = ''
Name of symlink (relative to
<filename>/etc</filename>). Defaults to the attribute
name.
'';
};
source = mkOption {
type = types.path;
description = ''
Path of the source file.
'';
};
};
config = {
source = mkIf (config.text != null) (mkDefault sourceDrv);
};
}