Created
July 19, 2022 03:48
-
-
Save s1341/b41cef30d6590bfbfe08f2156e17d2fe to your computer and use it in GitHub Desktop.
Updated realmd derivation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv | |
, fetchFromGitLab | |
, openldap | |
, libkrb5 | |
, packagekit | |
, polkit | |
, libxslt | |
, intltool | |
, glib | |
, pkg-config | |
, systemd | |
, autoreconfHook | |
, samba | |
, adcli | |
, oddjob | |
, sssd | |
, bash | |
}: | |
stdenv.mkDerivation rec { | |
pname = "realmd"; | |
version = "0.17.0"; | |
src = fetchFromGitLab { | |
domain = "gitlab.freedesktop.org"; | |
owner = pname; | |
repo = pname; | |
rev = version; | |
sha256 = "1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf"; | |
}; | |
# I didn't know substitueInPlace was a thing... | |
preConfigure = '' | |
substituteInPlace service/realmd-defaults.conf \ | |
--replace "/usr/sbin/winbindd" "${samba}/sbin/winbindd" | |
substituteInPlace service/realmd-defaults.conf \ | |
--replace "/usr/bin/net" "${samba}/sbin/net" | |
substituteInPlace service/realmd-defaults.conf \ | |
--replace "/usr/sbin/adcli" "${adcli}/bin/adcli" | |
substituteInPlace service/realmd-defaults.conf \ | |
--replace "/bin/bash" "${bash}/bin/bash" | |
cat >service/realmd-nixos.conf <<END | |
# Distro specific overrides for redhat | |
[paths] | |
smb.conf = /etc/samba/smb.conf | |
krb5.conf = /etc/krb5.conf | |
[samba-packages] | |
samba-common-tools = ${samba}/sbin/net | |
[winbind-packages] | |
samba-winbind = ${samba}/sbin/winbindd | |
samba-winbind-clients = ${samba}/bin/wbinfo | |
oddjob = ${oddjob}/sbin/oddjobd | |
oddjob-mkhomedir = ${oddjob}/libexec/oddjob/mkhomedir | |
[sssd-packages] | |
sssd = ${sssd}/sbin/sssd | |
oddjob = ${oddjob}/sbin/oddjobd | |
oddjob-mkhomedir = ${oddjob}/libexec/oddjob/mkhomedir | |
[adcli-packages] | |
adcli = ${adcli}/bin/adcli | |
[commands] | |
winbind-enable-logins = | |
winbind-disable-logins = | |
winbind-enable-service = ${systemd}/bin/systemctl enable winbind.service | |
winbind-disable-service = ${systemd}/bin/systemctl disable winbind.service | |
winbind-restart-service = ${systemd}/bin/systemctl restart winbind.service | |
winbind-stop-service = ${systemd}/bin/systemctlstop winbind.service | |
sssd-enable-logins = | |
sssd-disable-logins = | |
sssd-enable-service = ${systemd}/bin/systemctl enable sssd.service | |
sssd-disable-service = ${systemd}/bin/systemctl disable sssd.service | |
sssd-restart-service = ${systemd}/bin/systemctl restart sssd.service | |
sssd-stop-service = ${systemd}/bin/systemctl stop sssd.service | |
sssd-caches-flush = ${sssd}/sbin/sss_cache --users --groups --netgroups --services --autofs-maps | |
END | |
''; | |
nativeBuildInputs = [ autoreconfHook pkg-config ]; | |
buildInputs = | |
[ openldap libkrb5 polkit libxslt intltool glib systemd ]; | |
configureFlags = [ | |
"--with-distro=nixos" | |
"--disable-doc" | |
"--sysconfdir=${placeholder "out"}/etc" | |
"--with-systemd-unit-dir=${placeholder "out"}/share/systemd" | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, writeText, ... }: | |
with lib; | |
let | |
pkg = pkgs.realmd; | |
cfg = config.services.realmd; | |
in | |
{ | |
options.services.realmd = { | |
enable = mkOption { | |
type = types.bool; | |
default = false; | |
description = '' | |
Enable the realmd service which allows using `realm` to join | |
machines to AD/LDAP domains. | |
''; | |
}; | |
configText = mkOption { | |
type = types.lines; | |
default = ""; | |
description = "The verbatim contents of config file /etc/realmd.conf"; | |
}; | |
}; | |
config = mkIf cfg.enable { | |
environment.systemPackages = [ pkgs.realmd pkgs.oddjob pkgs.adcli pkgs.packagekit ]; | |
systemd.packages = [ pkgs.realmd pkgs.oddjob pkgs.packagekit ]; | |
systemd.services.realmd = { | |
wantedBy = ["multi-user.target"]; | |
after = ["network.target"]; | |
description = "Realm and Domain Configuration"; | |
enable = true; | |
documentation = ["man:realm(8)" "man:realmd.conf(5)"]; | |
serviceConfig = { | |
Type = "dbus"; | |
BusName = "org.freedesktop.realmd"; | |
ExecStart = "${pkgs.realmd}/libexec/realmd"; | |
}; | |
}; | |
environment.etc."realmd.conf" = { | |
target = "realmd.conf"; | |
source = pkgs.writeText "realmd.conf" "${cfg.configText}"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment