uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
75
nixos/modules/services/system/kerberos/default.nix
Normal file
75
nixos/modules/services/system/kerberos/default.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{config, lib, ...}:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption mkIf types length attrNames;
|
||||
cfg = config.services.kerberos_server;
|
||||
kerberos = config.krb5.kerberos;
|
||||
|
||||
aclEntry = {
|
||||
options = {
|
||||
principal = mkOption {
|
||||
type = types.str;
|
||||
description = "Which principal the rule applies to";
|
||||
};
|
||||
access = mkOption {
|
||||
type = types.either
|
||||
(types.listOf (types.enum ["add" "cpw" "delete" "get" "list" "modify"]))
|
||||
(types.enum ["all"]);
|
||||
default = "all";
|
||||
description = "The changes the principal is allowed to make.";
|
||||
};
|
||||
target = mkOption {
|
||||
type = types.str;
|
||||
default = "*";
|
||||
description = "The principals that 'access' applies to.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
realm = {
|
||||
options = {
|
||||
acl = mkOption {
|
||||
type = types.listOf (types.submodule aclEntry);
|
||||
default = [
|
||||
{ principal = "*/admin"; access = "all"; }
|
||||
{ principal = "admin"; access = "all"; }
|
||||
];
|
||||
description = ''
|
||||
The privileges granted to a user.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./mit.nix
|
||||
./heimdal.nix
|
||||
];
|
||||
|
||||
###### interface
|
||||
options = {
|
||||
services.kerberos_server = {
|
||||
enable = lib.mkEnableOption "the kerberos authentification server";
|
||||
|
||||
realms = mkOption {
|
||||
type = types.attrsOf (types.submodule realm);
|
||||
description = ''
|
||||
The realm(s) to serve keys for.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ kerberos ];
|
||||
assertions = [{
|
||||
assertion = length (attrNames cfg.realms) <= 1;
|
||||
message = "Only one realm per server is currently supported.";
|
||||
}];
|
||||
};
|
||||
}
|
||||
68
nixos/modules/services/system/kerberos/heimdal.nix
Normal file
68
nixos/modules/services/system/kerberos/heimdal.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{ pkgs, config, lib, ... } :
|
||||
|
||||
let
|
||||
inherit (lib) mkIf concatStringsSep concatMapStrings toList mapAttrs
|
||||
mapAttrsToList;
|
||||
cfg = config.services.kerberos_server;
|
||||
kerberos = config.krb5.kerberos;
|
||||
stateDir = "/var/heimdal";
|
||||
aclFiles = mapAttrs
|
||||
(name: {acl, ...}: pkgs.writeText "${name}.acl" (concatMapStrings ((
|
||||
{principal, access, target, ...} :
|
||||
"${principal}\t${concatStringsSep "," (toList access)}\t${target}\n"
|
||||
)) acl)) cfg.realms;
|
||||
|
||||
kdcConfigs = mapAttrsToList (name: value: ''
|
||||
database = {
|
||||
dbname = ${stateDir}/heimdal
|
||||
acl_file = ${value}
|
||||
}
|
||||
'') aclFiles;
|
||||
kdcConfFile = pkgs.writeText "kdc.conf" ''
|
||||
[kdc]
|
||||
${concatStringsSep "\n" kdcConfigs}
|
||||
'';
|
||||
in
|
||||
|
||||
{
|
||||
# No documentation about correct triggers, so guessing at them.
|
||||
|
||||
config = mkIf (cfg.enable && kerberos == pkgs.heimdal) {
|
||||
systemd.services.kadmind = {
|
||||
description = "Kerberos Administration Daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
'';
|
||||
serviceConfig.ExecStart =
|
||||
"${kerberos}/libexec/heimdal/kadmind --config-file=/etc/heimdal-kdc/kdc.conf";
|
||||
restartTriggers = [ kdcConfFile ];
|
||||
};
|
||||
|
||||
systemd.services.kdc = {
|
||||
description = "Key Distribution Center daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
'';
|
||||
serviceConfig.ExecStart =
|
||||
"${kerberos}/libexec/heimdal/kdc --config-file=/etc/heimdal-kdc/kdc.conf";
|
||||
restartTriggers = [ kdcConfFile ];
|
||||
};
|
||||
|
||||
systemd.services.kpasswdd = {
|
||||
description = "Kerberos Password Changing daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
'';
|
||||
serviceConfig.ExecStart = "${kerberos}/libexec/heimdal/kpasswdd";
|
||||
restartTriggers = [ kdcConfFile ];
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
# Can be set via the --config-file option to KDC
|
||||
"heimdal-kdc/kdc.conf".source = kdcConfFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
68
nixos/modules/services/system/kerberos/mit.nix
Normal file
68
nixos/modules/services/system/kerberos/mit.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{ pkgs, config, lib, ... } :
|
||||
|
||||
let
|
||||
inherit (lib) mkIf concatStrings concatStringsSep concatMapStrings toList
|
||||
mapAttrs mapAttrsToList;
|
||||
cfg = config.services.kerberos_server;
|
||||
kerberos = config.krb5.kerberos;
|
||||
stateDir = "/var/lib/krb5kdc";
|
||||
PIDFile = "/run/kdc.pid";
|
||||
aclMap = {
|
||||
add = "a"; cpw = "c"; delete = "d"; get = "i"; list = "l"; modify = "m";
|
||||
all = "*";
|
||||
};
|
||||
aclFiles = mapAttrs
|
||||
(name: {acl, ...}: (pkgs.writeText "${name}.acl" (concatMapStrings (
|
||||
{principal, access, target, ...} :
|
||||
let access_code = map (a: aclMap.${a}) (toList access); in
|
||||
"${principal} ${concatStrings access_code} ${target}\n"
|
||||
) acl))) cfg.realms;
|
||||
kdcConfigs = mapAttrsToList (name: value: ''
|
||||
${name} = {
|
||||
acl_file = ${value}
|
||||
}
|
||||
'') aclFiles;
|
||||
kdcConfFile = pkgs.writeText "kdc.conf" ''
|
||||
[realms]
|
||||
${concatStringsSep "\n" kdcConfigs}
|
||||
'';
|
||||
env = {
|
||||
# What Debian uses, could possibly link directly to Nix store?
|
||||
KRB5_KDC_PROFILE = "/etc/krb5kdc/kdc.conf";
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (cfg.enable && kerberos == pkgs.krb5Full) {
|
||||
systemd.services.kadmind = {
|
||||
description = "Kerberos Administration Daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
'';
|
||||
serviceConfig.ExecStart = "${kerberos}/bin/kadmind -nofork";
|
||||
restartTriggers = [ kdcConfFile ];
|
||||
environment = env;
|
||||
};
|
||||
|
||||
systemd.services.kdc = {
|
||||
description = "Key Distribution Center daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
PIDFile = PIDFile;
|
||||
ExecStart = "${kerberos}/bin/krb5kdc -P ${PIDFile}";
|
||||
};
|
||||
restartTriggers = [ kdcConfFile ];
|
||||
environment = env;
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"krb5kdc/kdc.conf".source = kdcConfFile;
|
||||
};
|
||||
environment.variables = env;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue