mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-30 19:54:43 +00:00
56 lines
955 B
Nix
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);
|
|
|
|
};
|
|
}
|