Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realmd: init #181145

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
./services/admin/pgadmin.nix
./services/admin/salt/master.nix
./services/admin/salt/minion.nix
./services/admin/realmd.nix
./services/amqp/activemq/default.nix
./services/amqp/rabbitmq.nix
./services/audio/alsa.nix
Expand Down
49 changes: 49 additions & 0 deletions nixos/modules/services/admin/realmd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ config, pkgs, lib, ... }:

with lib;

let
SohamG marked this conversation as resolved.
Show resolved Hide resolved
pkg = pkgs.realmd;
SohamG marked this conversation as resolved.
Show resolved Hide resolved
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";
};
SohamG marked this conversation as resolved.
Show resolved Hide resolved
};

config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.realmd pkgs.oddjob pkgs.adcli ];
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}";
};
};
}
79 changes: 79 additions & 0 deletions pkgs/os-specific/linux/realmd/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{ 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";

srcs = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = pname;
repo = pname;
rev = version;
sha256 = "1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf";
SohamG marked this conversation as resolved.
Show resolved Hide resolved
SohamG marked this conversation as resolved.
Show resolved Hide resolved
};

# I dont know how to include this as a shell script.
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"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/sbin/winbindd" "${samba}/sbin/winbindd"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/bin/wbinfo" "${samba}/bin/wbinfo"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/bin/net" "${samba}/sbin/net"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/sbin/authconfig" "${samba}/sbin/authconfig"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/sbin/adcli" "${adcli}/bin/adcli"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/sbin/oddjobd" "${oddjob}/sbin/oddjobd"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/libexec/oddjob/mkhomedir" "${oddjob}/libexec/oddjob/mkhomedir"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/sbin/sssd" "${sssd}/sbin/sssd"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/sbin/sss_cache" "${sssd}/sbin/sss_cache"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/bin/sh" "${bash}/bin/bash"
substituteInPlace service/realmd-redhat.conf \
--replace "/usr/bin/systemctl" "${systemd}/bin/systemctl"

cp service/realmd-redhat.conf service/realmd-nixos.conf
'';

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"
];
}
SohamG marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12769,6 +12769,8 @@ with pkgs;

reveal-md = callPackage ../tools/text/reveal-md { };

realmd = callPackage ../os-specific/linux/realmd { };

rewritefs = callPackage ../os-specific/linux/rewritefs { };

rdiff-backup = callPackage ../tools/backup/rdiff-backup { };
Expand Down