2021-02-24 22:14:58 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, glib
|
|
|
|
, pandoc
|
|
|
|
, systemd
|
|
|
|
, libyaml
|
|
|
|
, python3
|
|
|
|
, libuuid
|
|
|
|
, bash-completion
|
|
|
|
, lib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "netplan";
|
2023-06-01 02:14:09 +00:00
|
|
|
version = "0.106.1";
|
2021-02-24 22:14:58 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-10-13 16:33:34 +00:00
|
|
|
owner = "canonical";
|
2021-02-24 22:14:58 +00:00
|
|
|
repo = "netplan";
|
|
|
|
rev = version;
|
2023-06-01 02:14:09 +00:00
|
|
|
hash = "sha256-wQ4gd9+9YU92WGRMjSiF/zLCGxhaSl8s22pH1jr+Mm0=";
|
2021-02-24 22:14:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
glib
|
|
|
|
pandoc
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
systemd
|
|
|
|
glib
|
|
|
|
libyaml
|
2023-05-24 12:57:15 +00:00
|
|
|
(python3.withPackages (p: with p; [ pyyaml netifaces dbus-python rich ]))
|
2021-02-24 22:14:58 +00:00
|
|
|
libuuid
|
|
|
|
bash-completion
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2022-08-18 15:12:15 +00:00
|
|
|
substituteInPlace netplan/libnetplan.py \
|
2021-11-15 14:22:03 +00:00
|
|
|
--replace "/lib/netplan/generate" "$out/lib/netplan/generate" \
|
|
|
|
--replace "ctypes.util.find_library('netplan')" "\"$out/lib/libnetplan.so\""
|
2021-02-24 22:14:58 +00:00
|
|
|
|
2021-11-15 14:22:03 +00:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'SYSTEMD_GENERATOR_DIR=' 'SYSTEMD_GENERATOR_DIR ?= ' \
|
|
|
|
--replace 'SYSTEMD_UNIT_DIR=' 'SYSTEMD_UNIT_DIR ?= ' \
|
2022-08-13 12:48:51 +00:00
|
|
|
--replace 'BASH_COMPLETIONS_DIR=' 'BASH_COMPLETIONS_DIR ?= ' \
|
|
|
|
--replace 'pkg-config' '$(PKG_CONFIG)'
|
2021-10-13 16:33:34 +00:00
|
|
|
|
|
|
|
# from upstream https://github.com/canonical/netplan/blob/ee0d5df7b1dfbc3197865f02c724204b955e0e58/rpm/netplan.spec#L81
|
|
|
|
sed -e "s/-Werror//g" -i Makefile
|
2021-02-24 22:14:58 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PREFIX="
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"SYSTEMD_GENERATOR_DIR=lib/systemd/system-generators/"
|
|
|
|
"SYSTEMD_UNIT_DIR=lib/systemd/units/"
|
|
|
|
"BASH_COMPLETIONS_DIR=share/bash-completion/completions"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Backend-agnostic network configuration in YAML";
|
|
|
|
homepage = "https://netplan.io";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ mkg20001 ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|