push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 79e26235..bdc32c52 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -91,6 +91,7 @@ OSFAMILIES = {
],
"openeuler": ["openeuler"],
"OpenCloudOS": ["OpenCloudOS", "TencentOS"],
+ "nixos": ["nixos"],
}
LOG = logging.getLogger(__name__)
diff --git a/cloudinit/distros/nixos.py b/cloudinit/distros/nixos.py
new file mode 100644
index 00000000..67c049b8
--- /dev/null
+++ b/cloudinit/distros/nixos.py
@@ -0,0 +1,109 @@
+# vi: ts=4 expandtab
+#
+# Copyright (C) 2012 Canonical Ltd.
+# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012 Yahoo! Inc.
+#
+# Author: Scott Moser <scott.moser@canonical.com>
+# Author: Juerg Haefliger <juerg.haefliger@hp.com>
+# Author: Joshua Harlow <harlowja@yahoo-inc.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+import os
+
+from cloudinit import distros
+from cloudinit import helpers
+from cloudinit import util
+from cloudinit import atomic_helper
+
+from cloudinit.distros.parsers.hostname import HostnameConf
+from cloudinit.net import dhcp
+
+LOG = logging.getLogger(__name__)
+
+class Distro(distros.Distro):
+
+ def __init__(self, name, cfg, paths):
+ distros.Distro.__init__(self, name, cfg, paths)
+ # This will be used to restrict certain
+ # calls from repeatly happening (when they
+ # should only happen say once per instance...)
+ self._runner = helpers.Runners(paths)
+ self.usr_lib_exec = os.path.join(os.path.dirname(__file__),
+ "../../../../../libexec")
+ self.osfamily = 'nixos'
+ self.dhcp_client_priority = [
+ dhcp.Udhcpc,
+ dhcp.IscDhclient,
+ dhcp.Dhcpcd,
+ ]
+
+ def _select_hostname(self, hostname, fqdn):
+ # Prefer the short hostname over the long
+ # fully qualified domain name
+ if not hostname:
+ return fqdn
+ return hostname
+
+ def _write_hostname(self, your_hostname, out_fn):
+ conf = None
+ try:
+ # Try to update the previous one
+ # so lets see if we can read it first.
+ conf = self._read_hostname_conf(out_fn)
+ except IOError:
+ pass
+ if not conf:
+ conf = HostnameConf('')
+ conf.set_hostname(your_hostname)
+ atomic_helper.write_file(out_fn, str(conf).encode("utf-8"))
+
+ def _read_system_hostname(self):
+ sys_hostname = self._read_hostname(self.hostname_conf_fn)
+ return (self.hostname_conf_fn, sys_hostname)
+
+ def _read_hostname_conf(self, filename):
+ conf = HostnameConf(util.load_text_file(filename))
+ conf.parse()
+ return conf
+
+ def _read_hostname(self, filename, default=None):
+ hostname = None
+ try:
+ conf = self._read_hostname_conf(filename)
+ hostname = conf.hostname
+ except IOError:
+ pass
+ if not hostname:
+ return default
+ return hostname
+
+ def _write_network(self, settings):
+ raise NotImplementedError()
+
+ def apply_locale(self, locale, out_fn=None):
+ raise NotImplementedError()
+
+ def install_packages(self, pkglist):
+ raise NotImplementedError()
+
+ def package_command(self, command, args=None, pkgs=None):
+ pass
+
+ def set_timezone(self, tz):
+ pass
+
+ def update_package_sources(self):
+ pass

View File

@@ -0,0 +1,22 @@
diff --git a/tests/unittests/cmd/devel/test_logs.py b/tests/unittests/cmd/devel/test_logs.py
index 78466e8d0..cc2b7246d 100644
--- a/tests/unittests/cmd/devel/test_logs.py
+++ b/tests/unittests/cmd/devel/test_logs.py
@@ -179,7 +179,7 @@ class TestCollectLogs:
for to_write in to_collect:
write_file(
- tmp_path / to_write, pathlib.Path(to_write).name, mode=0x700
+ tmp_path / to_write, pathlib.Path(to_write).name
)
collect_dir = tmp_path / "collect"
@@ -225,7 +225,7 @@ class TestCollectLogs:
for to_write in to_collect:
write_file(
- tmp_path / to_write, pathlib.Path(to_write).name, mode=0x700
+ tmp_path / to_write, pathlib.Path(to_write).name
)
collect_dir = tmp_path / "collect"

View File

@@ -0,0 +1,156 @@
{
lib,
nixosTests,
cloud-utils,
dmidecode,
fetchFromGitHub,
iproute2,
openssh,
python3,
shadow,
systemd,
coreutils,
gitUpdater,
busybox,
procps,
}:
python3.pkgs.buildPythonApplication rec {
pname = "cloud-init";
version = "25.2";
pyproject = true;
namePrefix = "";
src = fetchFromGitHub {
owner = "canonical";
repo = "cloud-init";
tag = version;
hash = "sha256-Ww76dhfoGrIbxPiXHxDjpgPsinmfrs42NnGmzhBeGC0=";
};
patches = [
./0001-add-nixos-support.patch
./0002-fix-test-logs-on-nixos.patch
];
prePatch = ''
substituteInPlace setup.py \
--replace /lib/systemd $out/lib/systemd
substituteInPlace cloudinit/net/networkd.py \
--replace '["/usr/sbin", "/bin"]' '["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]'
substituteInPlace tests/unittests/test_net_activators.py \
--replace '["/usr/sbin", "/bin"]' \
'["/usr/sbin", "/bin", "${iproute2}/bin", "${systemd}/bin"]'
substituteInPlace tests/unittests/cmd/test_clean.py \
--replace "/bin/bash" "/bin/sh"
'';
postInstall = ''
install -D -m755 ./tools/write-ssh-key-fingerprints $out/libexec/write-ssh-key-fingerprints
for i in $out/libexec/*; do
wrapProgram $i --prefix PATH : "${lib.makeBinPath [ openssh ]}"
done
'';
build-system = with python3.pkgs; [
setuptools
];
propagatedBuildInputs = with python3.pkgs; [
configobj
jinja2
jsonpatch
jsonschema
netifaces
oauthlib
pyserial
pyyaml
requests
];
nativeCheckInputs = with python3.pkgs; [
pytest7CheckHook
httpretty
dmidecode
# needed for tests; at runtime we rather want the setuid wrapper
passlib
shadow
responses
pytest-mock
coreutils
procps
];
makeWrapperArgs = [
"--prefix PATH : ${
lib.makeBinPath [
dmidecode
cloud-utils.guest
busybox
]
}/bin"
];
disabledTests = [
# tries to create /var
"test_dhclient_run_with_tmpdir"
"test_dhcp_client_failover"
# clears path and fails because mkdir is not found
"test_path_env_gets_set_from_main"
# tries to read from /etc/ca-certificates.conf while inside the sandbox
"test_handler_ca_certs"
"TestRemoveDefaultCaCerts"
# Doesn't work in the sandbox
"TestEphemeralDhcpNoNetworkSetup"
"TestHasURLConnectivity"
"TestReadFileOrUrl"
"TestConsumeUserDataHttp"
# Chef Omnibus
"TestInstallChefOmnibus"
# Disable failing VMware and PuppetAio tests
"test_get_data_iso9660_with_network_config"
"test_get_data_vmware_guestinfo_with_network_config"
"test_get_host_info"
"test_no_data_access_method"
"test_install_with_collection"
"test_install_with_custom_url"
"test_install_with_default_arguments"
"test_install_with_no_cleanup"
"test_install_with_version"
# https://github.com/canonical/cloud-init/issues/5002
"test_found_via_userdata"
];
preCheck = ''
# TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build
export TMPDIR=/tmp
'';
pythonImportsCheck = [
"cloudinit"
];
passthru = {
tests = { inherit (nixosTests) cloud-init cloud-init-hostname; };
updateScript = gitUpdater { ignoredVersions = ".ubuntu.*"; };
};
meta = with lib; {
homepage = "https://github.com/canonical/cloud-init";
description = "Provides configuration and customization of cloud instance";
changelog = "https://github.com/canonical/cloud-init/raw/${version}/ChangeLog";
license = with licenses; [
asl20
gpl3Plus
];
maintainers = with maintainers; [
illustris
jfroche
];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,35 @@
{
lib,
buildPythonPackage,
fetchPypi,
boto3,
cryptography,
}:
buildPythonPackage rec {
pname = "ec2instanceconnectcli";
version = "1.0.3";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-/U59a6od0JI27VHX+Bvue/7tQy+iwU+g8yt9/GgdoH4=";
};
propagatedBuildInputs = [
boto3
cryptography
];
# has no tests
doCheck = false;
pythonImportsCheck = [ "ec2instanceconnectcli" ];
meta = with lib; {
description = "Command Line Interface for AWS EC2 Instance Connect";
homepage = "https://github.com/aws/aws-ec2-instance-connect-cli";
license = licenses.asl20;
maintainers = with maintainers; [ yurrriq ];
};
}

View File

@@ -0,0 +1,71 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
bash,
bashInteractive,
util-linux,
setuptools,
distro,
udevCheckHook,
}:
buildPythonPackage rec {
pname = "google-compute-engine";
version = "20190124";
format = "setuptools";
src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
repo = "compute-image-packages";
rev = version;
sha256 = "08cy0jd463kng6hwbd3nfldsp4dpd2lknlvdm88cq795wy0kh4wp";
};
buildInputs = [ bash ];
propagatedBuildInputs = [
setuptools
distro
];
nativeBuildInputs = [
udevCheckHook
];
postPatch = ''
for file in $(find google_compute_engine -type f); do
substituteInPlace "$file" \
--replace /bin/systemctl "/run/current-system/systemd/bin/systemctl" \
--replace /bin/bash "${bashInteractive}/bin/bash" \
--replace /sbin/hwclock "${util-linux}/bin/hwclock"
# SELinux tool ??? /sbin/restorecon
done
substituteInPlace google_config/udev/64-gce-disk-removal.rules \
--replace /bin/sh "${bash}/bin/sh" \
--replace /bin/umount "${util-linux}/bin/umount" \
--replace /usr/bin/logger "${util-linux}/bin/logger"
'';
postInstall = ''
# allows to install the package in `services.udev.packages` in NixOS
mkdir -p $out/lib/udev/rules.d
cp -r google_config/udev/*.rules $out/lib/udev/rules.d
# sysctl snippets will be used by google-compute-config.nix
mkdir -p $out/sysctl.d
cp google_config/sysctl/*.conf $out/sysctl.d
patchShebangs $out/bin/*
'';
pythonImportsCheck = [ "google_compute_engine" ];
meta = with lib; {
description = "Google Compute Engine tools and services";
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
license = licenses.asl20;
maintainers = with maintainers; [ zimbatm ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,96 @@
{
stdenv,
buildPythonApplication,
colorclass,
fetchPypi,
fetchurl,
installShellFiles,
lib,
linode-metadata,
openapi3,
packaging,
pyyaml,
requests,
rich,
setuptools,
terminaltables,
}:
let
hash = "sha256-QQxadKVEIh1PvD8FdYgJ/U1iyWdy6FvO+LUELQ70KKw=";
# specVersion taken from: https://www.linode.com/docs/api/openapi.yaml at `info.version`.
specVersion = "4.176.0";
specHash = "sha256-P1E8Ga5ckrsw/CX0kxFef5fe8/p/pDCLuleX9wR5l48=";
spec = fetchurl {
url = "https://raw.githubusercontent.com/linode/linode-api-docs/v${specVersion}/openapi.yaml";
hash = specHash;
};
in
buildPythonApplication rec {
pname = "linode-cli";
version = "5.56.2";
pyproject = true;
src = fetchPypi {
pname = "linode_cli";
inherit version;
hash = hash;
};
patches = [ ./remove-update-check.patch ];
# remove need for git history
prePatch = ''
substituteInPlace setup.py \
--replace "version = get_version()" "version='${version}',"
'';
postConfigure = ''
python3 -m linodecli bake ${spec} --skip-config
cp data-3 linodecli/
echo "${version}" > baked_version
'';
nativeBuildInputs = [ installShellFiles ];
propagatedBuildInputs = [
colorclass
linode-metadata
pyyaml
requests
setuptools
terminaltables
rich
openapi3
packaging
];
doInstallCheck = true;
installCheckPhase = ''
$out/bin/linode-cli --skip-config --version | grep ${version} > /dev/null
'';
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
for shell in bash fish; do
installShellCompletion --cmd linode-cli \
--$shell <($out/bin/linode-cli --skip-config completion $shell)
done
'';
passthru.updateScript = ./update.sh;
meta = {
description = "Linode Command Line Interface";
changelog = "https://github.com/linode/linode-cli/releases/tag/v${version}";
downloadPage = "https://pypi.org/project/linode-cli";
homepage = "https://github.com/linode/linode-cli";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
ryantm
techknowlogick
];
mainProgram = "linode-cli";
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/linodecli/api_request.py b/linodecli/api_request.py
index 4273aa6..3ada5c2 100644
--- a/linodecli/api_request.py
+++ b/linodecli/api_request.py
@@ -305,7 +305,7 @@ def _attempt_warn_old_version(ctx, result):
file=sys.stderr,
)
- if api_version_higher:
+ if False:
# check to see if there is, in fact, a version to upgrade to. If not, don't
# suggest an upgrade (since there's no package anyway)
new_version_exists = False

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep gnused jq yq-go
set -x -eu -o pipefail
cd $(dirname "${BASH_SOURCE[0]}")
SPEC_VERSION=$(curl -s https://www.linode.com/docs/api/openapi.yaml | yq eval '.info.version' -)
SPEC_SHA256=$(nix-prefetch-url --quiet https://raw.githubusercontent.com/linode/linode-api-docs/v${SPEC_VERSION}/openapi.yaml)
VERSION=$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/linode/linode-cli/tags" \
| jq 'map(.name)' \
| grep '"' \
| sed 's/[ ",(^v)]//g' \
| grep -v -e rc -e list \
| cut -d '"' -f4 | sort -rV | head -n 1)
SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/linode/linode-cli/archive/refs/tags/v${VERSION}.tar.gz)
setKV () {
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
}
setKV specVersion ${SPEC_VERSION}
setKV specHash ${SPEC_SHA256}
setKV version ${VERSION}
setKV hash ${SHA256}

View File

@@ -0,0 +1,49 @@
{
lib,
stdenv,
fetchurl,
cpio,
e2fsprogs,
perl,
pkg-config,
ocamlPackages,
glibc,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "supermin";
version = "5.2.2";
src = fetchurl {
url = "https://download.libguestfs.org/supermin/${lib.versions.majorMinor finalAttrs.version}-stable/supermin-${finalAttrs.version}.tar.gz";
sha256 = "zjkh02NcgWjPt8oMWoK51c71srJx+Et3bWO4u77sNY4=";
};
nativeBuildInputs = [
cpio
e2fsprogs
perl
pkg-config
]
++ (with ocamlPackages; [
findlib
ocaml
]);
buildInputs = lib.optionals stdenv.hostPlatform.isGnu [
glibc
glibc.static
];
postPatch = ''
patchShebangs src/bin2c.pl
'';
meta = with lib; {
homepage = "https://libguestfs.org/supermin.1.html";
description = "Tool for creating and building supermin appliances";
maintainers = with maintainers; [ qyliss ];
license = licenses.gpl2Plus;
platforms = platforms.linux;
mainProgram = "supermin";
};
})