jiebi/CodeConvo huggingface dataset:
<ins> diff --git a/llm/generate/gen_linux.sh b/llm/generate/gen_linux.sh index 48d08fd0..e50f7b36 100755 --- a/llm/generate/gen_linux.sh +++ b/llm/generate/gen_linux.sh @@ -284,9 +284,6 @@ if [ -z "${OLLAMA_SKIP_ROCM_GENERATE}" -a -d "${ROCM_PATH}" ]; then mkdir -p "${ROCM_DIST_DIR}" for dep in $(ldd "${BUILD_DIR}/bin/ollama_llama_server" | grep "=>" | cut -f2 -d= | cut -f2 -d' ' | grep -v "${GOARCH}/rocm${ROCM_VARIANT}" | grep -e rocm -e amdgpu -e libtinfo -e libnuma -e libelf ); do cp -a "${dep}"* "${ROCM_DIST_DIR}" -        if [ $(readlink -f "${dep}") != "${dep}" ] ; then -            cp $(readlink -f "${dep}") "${ROCM_DIST_DIR}" -        fi done install dist </ins>
<ins> { python, stdenv }: with python.pkgs; buildPythonApplication rec { pname = "chkcrontab"; version = "1.7"; src = fetchPypi { inherit pname version; sha256 = "0gmxavjkjkvjysgf9cf5fcpk589gb75n1mn20iki82wifi1pk1jn"; }; meta = with stdenv.lib; { description = "A tool to detect crontab errors"; license = licenses.asl20; maintainers = with maintainers; [ ma27 ]; homepage = https://github.com/lyda/chkcrontab; }; } </ins>
outputs = [ "out" ]; buildPhase = '' <del> make $makeFlags built-sources make $makeFlags systemd-cryptsetup make $makeFlags systemd-cryptsetup-generator </del> <ins> ninja systemd-cryptsetup systemd-cryptsetup-generator </ins> ''; <del> # For some reason systemd-cryptsetup-generator is a wrapper-script # with the current release of systemd. We want the real one. # TODO: Remove `.libs` prefix when the wrapper-script is gone </del> installPhase = '' mkdir -p $out/lib/systemd/ <del> cp .libs/systemd-cryptsetup $out/lib/systemd/systemd-cryptsetup cp .libs/*.so $out/lib/ </del> <ins> cp systemd-cryptsetup $out/lib/systemd/systemd-cryptsetup cp src/shared/*.so $out/lib/systemd/ </ins> mkdir -p $out/lib/systemd/system-generators/ <del> cp .libs/systemd-cryptsetup-generator $out/lib/systemd/system-generators/systemd-cryptsetup-generator </del> <ins> cp systemd-cryptsetup-generator $out/lib/systemd/system-generators/systemd-cryptsetup-generator </ins> ''; })
enableParallelBuilding = true; postPatch = '' <ins> substituteInPlace contrib/smime_keys  --replace /usr/bin/openssl ${openssl}/bin/openssl </ins> for f in doc/*.{xml,xsl}*  ; do substituteInPlace $f  --replace http://docbook.sourceforge.net/release/xsl/current     ${docbook_xsl}/share/xml/docbook-xsl
<del> { stdenv, fetchsvn, fetchurl, cups, zlib }: </del> <ins> { stdenv, fetchsvn, cups, zlib, jbigkit }: </ins> let rev = "315"; in stdenv.mkDerivation rec { name = "splix-svn-${rev}"; src = fetchsvn { # We build this from svn, because splix hasn't been in released in several years # although the community has been adding some new printer models.
}; preBuild = '' <del> makeFlags="V=1 DISABLE_JBIG=1 CUPSFILTER=$out/lib/cups/filter CUPSPPD=$out/share/cups/model" </del> <ins> makeFlags="$makeFlags CUPSFILTER=$out/lib/cups/filter CUPSDRV=$out/share/cups/drv" </ins> ''; <del> buildInputs = [cups zlib]; </del> <ins> buildFlags = [ "drv" "all" ]; makeFlags = [ "DRV_ONLY=1" ]; buildInputs = [ cups zlib jbigkit ]; </ins> meta = { <ins> description = "CUPS drivers for SPL (Samsung Printer Language) printers"; </ins> homepage = http://splix.sourceforge.net; platforms = stdenv.lib.platforms.linux; maintainers = [ stdenv.lib.maintainers.peti ];
{ stdenv, fetchurl, unzip, jdk, makeWrapper }: stdenv.mkDerivation rec { <del> name = "gradle-2.1"; </del> <ins> name = "gradle-2.2.1"; </ins> src = fetchurl { url = "http://services.gradle.org/distributions/${name}-bin.zip"; <del> sha256 = "0y7qifc61nng24zn73bdwh5d0m25dnllfiwfkyw220mblag4zviy"; </del> <ins> sha256 = "420aa50738299327b611c10b8304b749e8d3a579407ee9e755b15921d95ff418"; </ins> }; installPhase = ''
makeWrapper ${jdk}/bin/java $out/bin/gradle  --set JAVA_HOME ${jdk}  <del> --add-flags "-classpath $out/lib/gradle-launcher-2.1.jar org.gradle.launcher.GradleMain" </del> <ins> --add-flags "-classpath $out/lib/gradle-launcher-2.2.1.jar org.gradle.launcher.GradleMain" </ins> ''; phases = "unpackPhase installPhase";
patchShebangs . ''; <ins> postConfigure = '' # A stopgap for a non-deterministic build failure when using only one core # Upstream bug: https://bugs.webkit.org/show_bug.cgi?id=183788#c4 ninja JavaScriptCoreForwardingHeaders WTFForwardingHeaders ''; </ins> cmakeFlags = [ "-DPORT=GTK" "-DUSE_LIBHYPHEN=0"
exit 126 fi <del> mkdir -m 0755 -p "$mountPoint/dev" </del> <ins> mkdir -m 0755 -p "$mountPoint/dev" "$mountPoint/sys" </ins> mount --rbind /dev "$mountPoint/dev" <ins> mount --rbind /sys "$mountPoint/sys" </ins> # Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings. LOCALE_ARCHIVE=$system/sw/lib/locale/locale-archive chroot "$mountPoint" "$system/activate" >&2 || true
<del> { lib, stdenv, fetchurl, fetchpatch, pkg-config, intltool, xorg, pcre, gst_all_1, glib , xosd, libnotify, enchant, wrapGAppsHook, gdk-pixbuf }: </del> <ins> { stdenv , lib , fetchurl , fetchpatch , autoreconfHook , intltool , pkg-config , wrapGAppsHook , enchant , gdk-pixbuf , glib , gst_all_1 , libnotify , pcre , xorg , xosd }: </ins> stdenv.mkDerivation { <del> pname = "xneur"; version = "0.20.0"; </del> <ins> pname = "xneur"; version = "0.20.0"; </ins> src = fetchurl { url = "https://github.com/AndrewCrewKuznetsov/xneur-devel/raw/f66723feb272c68f7c22a8bf0dbcafa5e3a8a5ee/dists/0.20.0/xneur_0.20.0.orig.tar.gz";
}; nativeBuildInputs = [ <del> pkg-config intltool wrapGAppsHook </del> <ins> autoreconfHook intltool pkg-config wrapGAppsHook </ins> ]; buildInputs = [ <del> xorg.libX11 xorg.libXtst pcre gst_all_1.gstreamer glib xosd xorg.libXext xorg.libXi libnotify enchant gdk-pixbuf gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good </del> <ins> enchant gdk-pixbuf glib gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gstreamer libnotify pcre xorg.libX11 xorg.libXext xorg.libXi xorg.libXtst xosd </ins> ]; patches = [
url = "https://salsa.debian.org/debian/xneur/-/raw/da38ad9c8e1bf4e349f5ed4ad909f810fdea44c9/debian/patches/gcc-10.patch"; sha256 = "0pc17a4sdrnrc4z7gz28889b9ywqsm5mzm6m41h67j2f5zh9k3fy"; }) <ins> (fetchpatch { name = "enchant2.patch"; url = "https://salsa.debian.org/debian/xneur/-/raw/695b0fea56cde4ff6cf0f3988218c5cb9d7ff5ae/debian/patches/enchant2.patch"; sha256 = "02a3kkfzdvs5f8dfm6j5x3jcn5j8qah9ykfymp6ffqsf4fijp65n"; }) </ins> ]; postPatch = '' <del> sed -e 's@for xosd_dir in@for xosd_dir in ${xosd} @' -i configure </del> <ins> sed -e 's@for xosd_dir in@for xosd_dir in ${xosd} @' -i configure.ac </ins> ''; meta = with lib; {
<del> { lib, stdenv, fetchurl, aspell, pkg-config, glib, hunspell, hspell }: stdenv.mkDerivation rec { version = "1.6.1"; pname = "enchant"; src = fetchurl { url = "https://github.com/AbiWord/${pname}/releases/download/${pname}-1-6-1/${pname}-${version}.tar.gz"; sha256 = "1xg3m7mniyqyff8qv46jbfwgchb6di6qxdjnd5sfir7jzv0dkw5y"; }; nativeBuildInputs = [ pkg-config ]; buildInputs = [ aspell glib hunspell hspell ]; meta = with lib; { description = "Generic spell checking library"; homepage = "https://abiword.github.io/enchant"; platforms = platforms.unix; badPlatforms = [ "x86_64-darwin" ]; license = licenses.lgpl21; # never built on aarch64-darwin since first introduction in nixpkgs broken = stdenv.isDarwin && stdenv.isAarch64; }; } </del>
emacsWithPackages = emacs.pkgs.withPackages; # Added 2020-12-18 enblendenfuse = throw "'enblendenfuse' has been renamed to/replaced by 'enblend-enfuse'"; # Converted to throw 2022-02-22 <ins> enchant1 = throw "enchant1 has been removed from nixpkgs, as it was unmaintained"; # Added 2023-01-18 </ins> encryptr = throw "encryptr was removed because it reached end of life"; # Added 2022-02-06 envdir = throw "envdir has been dropped due to the lack of maintenance from upstream since 2018"; # Added 2022-06-03 envelope = throw "envelope has been removed from nixpkgs, as it was unmaintained"; # Added 2021-08-05
with stdenv.lib; let <del> version = "2.11.1"; sha256 = "1jrcff0szyjxc3vywyiclwdzk0xgq4cxvjbvmcfyjcpdrq9j5pyr"; </del> <ins> version = "2.12.0"; sha256 = "17377xxbmwbrnh895a108z944pqi39hzrbw4jzgj8pcipi3s3x69"; </ins> audio = optionalString (hasSuffix "linux" stdenv.system) "alsa," + optionalString pulseSupport "pa," + optionalString sdlSupport "sdl,";
outputs = [ "out" "ga" ]; <del> patches = [ ./no-etc-install.patch ./statfs-flags.patch (fetchpatch { name = "glibc-2.27-memfd.patch"; url = "https://git.qemu.org/?p=qemu.git;a=patch;h=75e5b70e6b5dcc4f2219992d7cffa462aa406af0"; sha256 = "0gaz93kb33qc0jx6iphvny0yrd17i8zhcl3a9ky5ylc2idz0wiwa"; }) ] </del> <ins> patches = [ ./no-etc-install.patch ] </ins> ++ optional nixosTestRunner ./force-uid0-on-9p.patch ++ optional pulseSupport ./fix-hda-recording.patch ++ optionals stdenv.hostPlatform.isMusl [
<del> { qemu, fetchFromGitHub, lib }: let src = fetchFromGitHub { owner  = "riscv"; repo   = "riscv-qemu"; rev    = "f733c7b5f86147216e14aff90c03ccdd76056bef"; sha256 = "1ppr9qqwi7qqh8m6dgk1hrzg8zri240il27l67vfayd8ijagb9zq"; fetchSubmodules = true; }; version = "2.11.92"; revCount = "60378"; shortRev = builtins.substring 0 9 src.rev; targets = [ "riscv32-linux-user" "riscv32-softmmu" "riscv64-linux-user" "riscv64-softmmu" ]; in lib.overrideDerivation qemu (orig: { name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}"; inherit src; # <<<<<<< HEAD #   # https://github.com/riscv/riscv-qemu/pull/109 #   patches = [ ./no-etc-install.patch ./statfs-flags.patch ./riscv-initrd.patch ]; # ======= # The pulseaudio and statfs patches are in 2.12.0+, which this is based on patches = [ ./force-uid0-on-9p.patch ./no-etc-install.patch ]; configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ]; postInstall = null; }) </del>
<del> { lib, stdenv, fetchurl, ncurses, libtool, gettext, autoconf, automake, pkgconfig }: </del> <ins> { lib, stdenv, fetchurl, ncurses, pkgconfig }: </ins> stdenv.mkDerivation rec { name = "procps-${version}"; version = "3.3.14"; <ins> # The project's releases are on SF, but git repo on gitlab. </ins> src = fetchurl { <del> url = "https://gitlab.com/procps-ng/procps/-/archive/v${version}/procps-v${version}.tar.bz2"; sha256 = "0igvsl3s7m5ygxgypzksk4cp2wkvv3lk49s7i9m5wbimyakmr0vf"; </del> <ins> url = "mirror://sourceforge/procps-ng/procps-ng-${version}.tar.xz"; sha256 = "0v3j6rkzzscqds37i105cxx3q4dk04rsgpqfd5p7hzcvk59h5njy"; </ins> }; buildInputs = [ ncurses ]; <del> nativeBuildInputs = [ libtool gettext autoconf automake pkgconfig ]; # autoreconfHook doesn't quite get, what procps-ng buildprocss does # with po/Makefile.in.in and stuff. preConfigure = '' ./autogen.sh ''; </del> <ins> nativeBuildInputs = [ pkgconfig ]; </ins> makeFlags = "usrbin_execdir=$(out)/bin";
STACK_PLATFORM_VARIANT="nix"; STACK_IN_NIX_SHELL=1; <del> STACK_IN_NIX_EXTRA_ARGS = concatMap (pkg: ["--extra-lib-dirs=${getLib pkg}/lib" "--extra-include-dirs=${getDev pkg}/include"]) buildInputs ++ extraArgs; </del> <ins> STACK_IN_NIX_EXTRA_ARGS = extraArgs; shellHook = '' for pkg in ''${pkgsHostHost[@]} ''${pkgsHostBuild[@]} ''${pkgsHostTarget[@]} do [ -d "$pkg/lib" ] &&  export STACK_IN_NIX_EXTRA_ARGS+=" --extra-lib-dirs=$pkg/lib" [ -d "$pkg/include" ] &&  export STACK_IN_NIX_EXTRA_ARGS+=" --extra-include-dirs=$pkg/include" done ''; </ins> # XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042. LD_LIBRARY_PATH = makeLibraryPath (LD_LIBRARY_PATH ++ buildInputs);
TimeoutSec = "infinity"; Restart = "on-failure"; WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab"; <del> ExecStart="${cfg.packages.gitlab.rubyEnv}/bin/sidekiq -C "${cfg.packages.gitlab}/share/gitlab/config/sidekiq_queues.yml" -e production -P ${cfg.statePath}/tmp/sidekiq.pid"; </del> <ins> ExecStart="${cfg.packages.gitlab.rubyEnv}/bin/sidekiq -C "${cfg.packages.gitlab}/share/gitlab/config/sidekiq_queues.yml" -e production"; </ins> }; };
tests.mesos = callTest tests/mesos.nix {}; tests.misc = callTest tests/misc.nix {}; tests.mongodb = callTest tests/mongodb.nix {}; <ins> tests.mpd = callTest tests/mpd.nix {}; </ins> tests.mumble = callTest tests/mumble.nix {}; tests.munin = callTest tests/munin.nix {}; tests.mutableUsers = callTest tests/mutable-users.nix {};
<ins> import ./make-test.nix ({ pkgs, ... }: let track = pkgs.fetchurl { # Sourced from http://freemusicarchive.org/music/Blue_Wave_Theory/Surf_Music_Month_Challenge/Skyhawk_Beach_fade_in # License: http://creativecommons.org/licenses/by-sa/4.0/ name = "Blue_Wave_Theory-Skyhawk_Beach.mp3"; url = https://freemusicarchive.org/file/music/ccCommunity/Blue_Wave_Theory/Surf_Music_Month_Challenge/Blue_Wave_Theory_-_04_-_Skyhawk_Beach.mp3; sha256 = "0xw417bxkx4gqqy139bb21yldi37xx8xjfxrwaqa0gyw19dl6mgp"; }; defaultCfg = rec { user = "mpd"; group = "mpd"; dataDir = "/var/lib/mpd"; musicDirectory = "${dataDir}/music"; }; defaultMpdCfg = with defaultCfg; { inherit dataDir musicDirectory user group; enable = true; }; musicService = { user, group, musicDirectory }: { description = "Sets up the music file(s) for MPD to use."; requires = [ "mpd.service" ]; after = [ "mpd.service" ]; wantedBy = [ "default.target" ]; script = '' mkdir -p ${musicDirectory} && chown -R ${user}:${group} ${musicDirectory} cp ${track} ${musicDirectory} chown ${user}:${group} ${musicDirectory}/$(basename ${track}) ''; }; mkServer = { mpd, musicService, }: { boot.kernelModules = [ "snd-dummy" ]; sound.enable = true; services.mpd = mpd; systemd.services.musicService = musicService; }; in { name = "mpd"; meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ emmanuelrosa ]; }; nodes = { client = { config, pkgs, ... }: { }; serverALSA = { config, pkgs, ... }: (mkServer { mpd = defaultMpdCfg // { network.listenAddress = "any"; extraConfig = '' audio_output { type "alsa" name "ALSA" mixer_type "null" } ''; }; musicService = with defaultMpdCfg; musicService { inherit user group musicDirectory; }; }) // { networking.firewall.allowedTCPPorts = [ 6600 ]; }; serverPulseAudio = { config, pkgs, ... }: (mkServer { mpd = defaultMpdCfg // { extraConfig = '' audio_output { type "pulse" name "The Pulse" } ''; }; musicService = with defaultCfg; musicService { inherit user group musicDirectory; }; }) // { hardware.pulseaudio.enable = true; }; }; testScript = '' my $mpc = "${pkgs.mpc_cli}/bin/mpc --wait"; # Connects to the given server and attempts to play a tune. sub play_some_music { my $server = $_[0]; $server->waitForUnit("mpd.service"); $server->succeed("$mpc update"); my @tracks = $server->execute("$mpc ls"); for my $track (split(/n/, $tracks[1])) { $server->succeed("$mpc add $track"); }; my @added_tracks = $server->execute("$mpc listall"); (length $added_tracks[1]) > 0 or die "Failed to add audio tracks to the playlist."; $server->succeed("$mpc play"); my @status = $server->execute("$mpc status"); my @output = split(/n/, $status[1]); $output[1] =~ /.*playing.*/ or die "Audio track is not playing, as expected."; $server->succeed("$mpc stop"); }; play_some_music($serverALSA); play_some_music($serverPulseAudio); $client->succeed("$mpc -h serverALSA status"); # The PulseAudio-based server is configured not to accept external client connections # to perform the following test: $client->fail("$mpc -h serverPulseAudio status"); ''; }) </ins>
<del> Two changes: * Add an alias for `which', so abcde can find things in store * Choose the right CDROM reader syntax for `cd-paranoia' --- abcde-2.5.4/abcde~	2012-09-18 06:09:31.000000000 -0700 +++ abcde-2.5.4/abcde	2012-10-27 00:08:48.000862364 -0700 @@ -17,6 +17,11 @@ VERSION='2.5.4' +which () +{ +  type -P $1 +} + usage () { echo "This is abcde v$VERSION." @@ -3497,6 +3502,10 @@ for DEFAULT_CDROMREADER in $DEFAULT_CDROMREADERS; do if new_checkexec $DEFAULT_CDROMREADER; then CDROMREADERSYNTAX=$DEFAULT_CDROMREADER +                        case "$DEFAULT_CDROMREADER" in +			  cd-paranoia)  CDROMREADERSYNTAX=cdparanoia;; +			  *)            CDROMREADERSYNTAX=$DEFAULT_CDROMREADER;; +			esac break fi done </del>
, perl, MusicBrainz, MusicBrainzDiscID , makeWrapper }: <del> let version = "2.8.1"; </del> <ins> let version = "2.9.2"; </ins> in stdenv.mkDerivation { name = "abcde-${version}"; src = fetchurl { url = "https://abcde.einval.com/download/abcde-${version}.tar.gz"; <del> sha256 = "0f9bjs0phk23vry7gvh0cll9vl6kmc1y4fwwh762scfdvpbp3774"; </del> <ins> sha256 = "13c5yvp87ckqgha160ym5rdr1a4divgvyqbjh0yb6ffclip6qd9l"; </ins> }; # FIXME: This package does not support `distmp3', `eject', etc. <del> patches = [ ./abcde.patch ]; </del> configurePhase = '' sed -i "s|^[[:blank:]]*prefix *=.*$|prefix = $out|g ; s|^[[:blank:]]*etcdir *=.*$|etcdir = $out/etc|g ; s|^[[:blank:]]*INSTALL *=.*$|INSTALL = install -c|g"  "Makefile"; <del> # We use `cd-paranoia' from GNU libcdio, which contains a hyphen # in its name, unlike Xiph's cdparanoia. sed -i "s|^[[:blank:]]*CDPARANOIA=.*$|CDPARANOIA=cd-paranoia|g ; s|^[[:blank:]]*DEFAULT_CDROMREADERS=.*$|DEFAULT_CDROMREADERS="cd-paranoia cdda2wav"|g"  "abcde" </del> <ins> echo 'CDPARANOIA=${libcdio-paranoia}/bin/cd-paranoia' >>abcde.conf echo CDROMREADERSYNTAX=cdparanoia >>abcde.conf </ins> substituteInPlace "abcde"  --replace "/etc/abcde.conf" "$out/etc/abcde.conf" ''; <del> buildInputs = [ makeWrapper ]; </del> <ins> nativeBuildInputs = [ makeWrapper ]; </ins> <del> propagatedBuildInputs = [ perl MusicBrainz MusicBrainzDiscID ]; </del> <ins> buildInputs = [ perl MusicBrainz MusicBrainzDiscID ]; </ins> installFlags = [ "sysconfdir=$(out)/etc" ]; postFixup = '' for cmd in abcde cddb-tool abcde-musicbrainz-tool; do <del> wrapProgram "$out/bin/$cmd" --prefix PATH ":"  ${stdenv.lib.makeBinPath [ "$out" which libcdio-paranoia cddiscid wget vorbis-tools id3v2 eyeD3 lame flac glyr ]} </del> <ins> wrapProgram "$out/bin/$cmd"  --prefix PERL5LIB : "$PERL5LIB"  --prefix PATH ":" ${stdenv.lib.makeBinPath [ "$out" which libcdio-paranoia cddiscid wget vorbis-tools id3v2 eyeD3 lame flac glyr ]} </ins> done ''; <del> meta = { </del> <ins> meta = with stdenv.lib; { </ins> homepage = http://abcde.einval.com/wiki/; <del> license = stdenv.lib.licenses.gpl2Plus; </del> <ins> license = licenses.gpl2Plus; maintainers = with maintainers; [ gebner ]; </ins> description = "Command-line audio CD ripper"; longDescription = '' abcde is a front-end command-line utility (actually, a shell script) that grabs tracks off a CD, encodes them to Ogg/Vorbis, MP3, FLAC, Ogg/Speex and/or MPP/MP+ (Musepack) format, and tags them, all in one go. ''; <del> platforms = stdenv.lib.platforms.linux; </del> <ins> platforms = platforms.linux; </ins> }; }
(assertMacAddress "MACAddress") ]; <ins> # NOTE The PrivateKey directive is missing on purpose here, please # do not add it to this list. The nix store is world-readable let's # refrain ourselves from providing a footgun. checkWireGuard = checkUnitConfig "WireGuard" [ (assertOnlyFields [ "PrivateKeyFile" "ListenPort" "FwMark" ]) (assertRange "FwMark" 1 4294967295) ]; # NOTE The PresharedKey directive is missing on purpose here, please # do not add it to this list. The nix store is world-readable,let's # refrain ourselves from providing a footgun. checkWireGuardPeer = checkUnitConfig "WireGuardPeer" [ (assertOnlyFields [ "PublicKey" "PresharedKeyFile" "AllowedIPs" "Endpoint" "PersistentKeepalive" ]) (assertRange "PersistentKeepalive" 1 65535) ]; </ins> checkVlan = checkUnitConfig "VLAN" [ (assertOnlyFields ["Id" "GVRP" "MVRP" "LooseBinding" "ReorderHeader"]) (assertRange "Id" 0 4094)
''; }; <ins> wireguardConfig = mkOption { default = {}; example = { PrivateKeyFile = "/etc/wireguard/secret.key"; ListenPort = 51820; FwMark = 42; }; type = types.addCheck (types.attrsOf unitOption) checkWireGuard; description = '' Each attribute in this set specifies an option in the <literal>[WireGuard]</literal> section of the unit. See <citerefentry><refentrytitle>systemd.netdev</refentrytitle> <manvolnum>5</manvolnum></citerefentry> for details. Use <literal>PrivateKeyFile</literal> instead of <literal>PrivateKey</literal>: the nix store is world-readable. ''; }; wireguardPeers = mkOption { default = []; example = [ { wireguardPeerConfig={ Endpoint = "192.168.1.1:51820"; PublicKey = "27s0OvaBBdHoJYkH9osZpjpgSOVNw+RaKfboT/Sfq0g="; PresharedKeyFile = "/etc/wireguard/psk.key"; AllowedIPs = [ "10.0.0.1/32" ]; PersistentKeepalive = 15; };}]; type = with types; listOf (submodule wireguardPeerOptions); description = '' Each item in this array specifies an option in the <literal>[WireGuardPeer]</literal> section of the unit. See <citerefentry><refentrytitle>systemd.netdev</refentrytitle> <manvolnum>5</manvolnum></citerefentry> for details. Use <literal>PresharedKeyFile</literal> instead of <literal>PresharedKey</literal>: the nix store is world-readable. ''; }; </ins> vlanConfig = mkOption { default = {}; example = { Id = "4"; };
}; }; <ins> wireguardPeerOptions = { options = { wireguardPeerConfig = mkOption { default = {}; example = { }; type = types.addCheck (types.attrsOf unitOption) checkWireGuardPeer; description = '' Each attribute in this set specifies an option in the <literal>[WireGuardPeer]</literal> section of the unit.  See <citerefentry><refentrytitle>systemd.network</refentrytitle> <manvolnum>5</manvolnum></citerefentry> for details. ''; }; }; }; </ins> networkOptions = commonNetworkOptions // { networkConfig = mkOption {
${attrsToSection def.bondConfig} ''} <ins> ${optionalString (def.wireguardConfig != { }) '' [WireGuard] ${attrsToSection def.wireguardConfig} ''} ${flip concatMapStrings def.wireguardPeers (x: '' [WireGuardPeer] ${attrsToSection x.wireguardPeerConfig} '')} </ins> ${def.extraConfig} ''; };
systemd = handleTest ./systemd.nix {}; systemd-confinement = handleTest ./systemd-confinement.nix {}; systemd-timesyncd = handleTest ./systemd-timesyncd.nix {}; <ins> systemd-networkd-wireguard = handleTest ./systemd-networkd-wireguard.nix {}; </ins> pdns-recursor = handleTest ./pdns-recursor.nix {}; taskserver = handleTest ./taskserver.nix {}; telegraf = handleTest ./telegraf.nix {};
<ins> let generateNodeConf = { lib, pkgs, config, privkpath, pubk, peerId, nodeId, ...}: { imports = [ common/user-account.nix ]; systemd.services.systemd-networkd.environment.SYSTEMD_LOG_LEVEL = "debug"; networking.useNetworkd = true; networking.firewall.enable = false; virtualisation.vlans = [ 1 ]; environment.systemPackages = with pkgs; [ wireguard-tools ]; boot.extraModulePackages = [ config.boot.kernelPackages.wireguard ]; systemd.network = { enable = true; netdevs = { "90-wg0" = { netdevConfig = { Kind = "wireguard"; Name = "wg0"; }; wireguardConfig = { PrivateKeyFile = privkpath ; ListenPort = 51820; FwMark = 42; }; wireguardPeers = [ {wireguardPeerConfig={ Endpoint = "192.168.1.${peerId}:51820"; PublicKey = pubk; PresharedKeyFile = pkgs.writeText "psk.key" "yTL3sCOL33Wzi6yCnf9uZQl/Z8laSE+zwpqOHC4HhFU="; AllowedIPs = [ "10.0.0.${peerId}/32" ]; PersistentKeepalive = 15; };}]; }; }; networks = { "99-nope" = { matchConfig.Name = "eth*"; linkConfig.Unmanaged = true; }; "90-wg0" = { matchConfig = { Name = "wg0"; }; address = [ "10.0.0.${nodeId}/32" ]; routes = [ { routeConfig = { Gateway = "10.0.0.${nodeId}"; Destination = "10.0.0.0/24"; }; } ]; }; "90-eth1" = { matchConfig = { Name = "eth1"; }; address = [ "192.168.1.${nodeId}/24" ]; }; }; }; }; in import ./make-test.nix ({pkgs, ... }: { name = "networkd-wireguard"; meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ ninjatrappeur ]; }; nodes = { node1 = { pkgs, ... }@attrs: let localConf = { privkpath = pkgs.writeText "priv.key" "GDiXWlMQKb379XthwX0haAbK6hTdjblllpjGX0heP00="; pubk = "iRxpqj42nnY0Qz8MAQbSm7bXxXP5hkPqWYIULmvW+EE="; nodeId = "1"; peerId = "2"; }; in generateNodeConf (attrs // localConf); node2 = { pkgs, ... }@attrs: let localConf = { privkpath = pkgs.writeText "priv.key" "eHxSI2jwX/P4AOI0r8YppPw0+4NZnjOxfbS5mt06K2k="; pubk = "27s0OvaBBdHoJYkH9osZpjpgSOVNw+RaKfboT/Sfq0g="; nodeId = "2"; peerId = "1"; }; in generateNodeConf (attrs // localConf); }; testScript = '' startAll; $node1->waitForUnit('systemd-networkd-wait-online.service'); $node2->waitForUnit('systemd-networkd-wait-online.service'); $node1->succeed('ping -c 5 10.0.0.2'); $node2->succeed('ping -c 5 10.0.0.1'); # Is the fwmark set? $node2->succeed('wg | grep -q 42'); ''; }) </ins>