diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 6d1878a43576..fe59e441abec 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -103,6 +103,8 @@ - [Hatsu](https://github.com/importantimport/hatsu), a self-hosted bridge that interacts with Fediverse on behalf of your static site. Available as [services.hatsu](options.html#opt-services.hatsu.enable). +- [Soteria](https://github.com/ImVaskel/soteria), a polkit authentication agent to handle elevated prompts for any desktop environment. Normally this should only be used on DEs or WMs that do not provide a graphical polkit frontend on their own. Available as [`security.soteria`](#opt-security.soteria.enable). + - [Flood](https://flood.js.org/), a beautiful WebUI for various torrent clients. Available as [services.flood](options.html#opt-services.flood.enable). - [Niri](https://github.com/YaLTeR/niri), a scrollable-tiling Wayland compositor. Available as [programs.niri](options.html#opt-programs.niri.enable). diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index e927a3aa07ae..a4e21fc632e7 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -6,7 +6,7 @@ - Create the first release note entry in this section! -## New Services {#sec-release-25.05-new-services} +## New Modules {#sec-release-25.05-new-modules} - Create the first release note entry in this section! diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 07d1d880a074..dbf82d63d5e5 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -362,6 +362,7 @@ ./security/polkit.nix ./security/rngd.nix ./security/rtkit.nix + ./security/soteria.nix ./security/sudo.nix ./security/sudo-rs.nix ./security/systemd-confinement.nix @@ -1410,6 +1411,7 @@ ./services/web-apps/crabfit.nix ./services/web-apps/davis.nix ./services/web-apps/cryptpad.nix + ./services/web-apps/dashy.nix ./services/web-apps/dependency-track.nix ./services/web-apps/dex.nix ./services/web-apps/discourse.nix diff --git a/nixos/modules/security/soteria.nix b/nixos/modules/security/soteria.nix new file mode 100644 index 000000000000..3b2f8349c4e5 --- /dev/null +++ b/nixos/modules/security/soteria.nix @@ -0,0 +1,50 @@ +{ + lib, + pkgs, + config, + ... +}: + +let + cfg = config.security.soteria; +in +{ + options.security.soteria = { + enable = lib.mkEnableOption null // { + description = '' + Whether to enable Soteria, a Polkit authentication agent + for any desktop environment. + + ::: {.note} + You should only enable this if you are on a Desktop Environment that + does not provide a graphical polkit authentication agent, or you are on + a standalone window manager or Wayland compositor. + ::: + ''; + }; + package = lib.mkPackageOption pkgs "soteria" { }; + }; + + config = lib.mkIf cfg.enable { + security.polkit.enable = true; + environment.systemPackages = [ cfg.package ]; + + systemd.user.services.polkit-soteria = { + description = "Soteria, Polkit authentication agent for any desktop environment"; + + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + + script = lib.getExe cfg.package; + serviceConfig = { + Type = "simple"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; + + meta.maintainers = with lib.maintainers; [ johnrtitor ]; +} diff --git a/nixos/modules/services/hardware/g810-led.nix b/nixos/modules/services/hardware/g810-led.nix new file mode 100644 index 000000000000..25472f0ac1e6 --- /dev/null +++ b/nixos/modules/services/hardware/g810-led.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.services.g810-led; +in +{ + options = { + services.g810-led = { + enable = lib.mkEnableOption "g810-led, a Linux LED controller for some Logitech G Keyboards"; + + package = lib.mkPackageOption pkgs "g810-led" { }; + + profile = lib.mkOption { + type = lib.types.nullOr lib.types.lines; + default = null; + example = '' + # G810-LED Profile (turn all keys on) + + # Set all keys on + a ffffff + + # Commit changes + c + ''; + description = '' + Keyboard profile to apply at boot time. + + The upstream repository provides [example configurations](https://github.com/MatMoul/g810-led/tree/master/sample_profiles). + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + environment.etc."g810-led/profile" = lib.mkIf (cfg.profile != null) cfg.profile; + + services.udev.packages = [ config.package ]; + }; + + meta.maintainers = with lib.maintainers; [ GaetanLepage ]; +} diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index cfe4d9d150f6..4947bf7a4dd1 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -123,6 +123,7 @@ let quality-menu = callPackage ./quality-menu.nix { }; reload = callPackage ./reload.nix { }; simple-mpv-webui = callPackage ./simple-mpv-webui.nix { }; + smartskip = callPackage ./smartskip.nix { }; sponsorblock = callPackage ./sponsorblock.nix { }; sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { }; thumbfast = callPackage ./thumbfast.nix { }; diff --git a/pkgs/applications/video/mpv/scripts/smartskip.nix b/pkgs/applications/video/mpv/scripts/smartskip.nix new file mode 100644 index 000000000000..505269847f08 --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/smartskip.nix @@ -0,0 +1,28 @@ +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, +}: + +buildLua { + pname = "smartskip"; + version = "0-unstable-2023-11-25"; + + scriptPath = "scripts/SmartSkip.lua"; + src = fetchFromGitHub { + owner = "Eisa01"; + repo = "mpv-scripts"; + rev = "48d68283cea47ff8e904decc9003b3abc3e2123e"; + hash = "sha256-95CAKjBRELX2f7oWSHFWJnI0mikAoxhfUphe9k51Qf4="; + }; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Automatically or manually skip opening, intro, outro, and preview"; + homepage = "https://github.com/Eisa01/mpv-scripts"; + license = lib.licenses.bsd2; + maintainers = [ lib.maintainers.iynaix ]; + }; +} diff --git a/pkgs/by-name/ce/cemu/package.nix b/pkgs/by-name/ce/cemu/package.nix index 061ff28069c9..a188326d9de4 100644 --- a/pkgs/by-name/ce/cemu/package.nix +++ b/pkgs/by-name/ce/cemu/package.nix @@ -50,13 +50,13 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "cemu"; - version = "2.2"; + version = "2.4"; src = fetchFromGitHub { owner = "cemu-project"; repo = "Cemu"; rev = "v${finalAttrs.version}"; - hash = "sha256-d4FMAj99SPj5S1p5nAUFNo386ZJvWxOKD9iGxHJYVBI="; + hash = "sha256-JBd5ntU1fFDvQpNbfP63AQANzuQTdfd4dfB29/BN5LM="; }; patches = [ diff --git a/pkgs/by-name/cu/cunicu/package.nix b/pkgs/by-name/cu/cunicu/package.nix new file mode 100644 index 000000000000..073cabc3ead9 --- /dev/null +++ b/pkgs/by-name/cu/cunicu/package.nix @@ -0,0 +1,67 @@ +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + installShellFiles, + protobuf, + protoc-gen-go, + protoc-gen-go-grpc, +}: +buildGoModule rec { + pname = "cunicu"; + version = "0.5.53"; + + src = fetchFromGitHub { + owner = "cunicu"; + repo = "cunicu"; + rev = "v${version}"; + hash = "sha256-y8JyXf+LdquhVr9G5wX1LdMF7wpj5PZG3xXGAWoypzA="; + }; + + nativeBuildInputs = [ + installShellFiles + protobuf + protoc-gen-go + protoc-gen-go-grpc + ]; + + CGO_ENABLED = 0; + + vendorHash = "sha256-OiLVdEf6fcGHx0k0xC5sZwhnK0FiLgfdkz2zNgBbcgY="; + + # These packages contain networking dependent tests which fail in the sandbox + excludedPackages = [ + "pkg/config" + "pkg/selfupdate" + "pkg/tty" + "scripts" + ]; + + ldflags = [ + "-X cunicu.li/cunicu/pkg/buildinfo.Version=${version}" + "-X cunicu.li/cunicu/pkg/buildinfo.BuiltBy=Nix" + ]; + + preBuild = '' + go generate ./... + ''; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + $out/bin/cunicu docs --with-frontmatter + installManPage ./docs/usage/man/*.1 + installShellCompletion --cmd cunicu \ + --bash <($out/bin/cunicu completion bash) \ + --zsh <($out/bin/cunicu completion zsh) \ + --fish <($out/bin/cunicu completion fish) + ''; + + meta = { + description = "Zeroconf peer-to-peer mesh VPN using Wireguard® and Interactive Connectivity Establishment (ICE)"; + homepage = "https://cunicu.li"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ stv0g ]; + platforms = lib.platforms.linux; + mainProgram = "cunicu"; + }; +} diff --git a/pkgs/by-name/fr/freecad/package.nix b/pkgs/by-name/fr/freecad/package.nix index 83d7598ce3e0..e895914254d7 100644 --- a/pkgs/by-name/fr/freecad/package.nix +++ b/pkgs/by-name/fr/freecad/package.nix @@ -212,7 +212,7 @@ stdenv.mkDerivation (finalAttrs: { right at home with FreeCAD. ''; license = lib.licenses.lgpl2Plus; - maintainers = with lib.maintainers; [ gebner AndersonTorres srounce ]; + maintainers = with lib.maintainers; [ gebner srounce ]; platforms = lib.platforms.linux; }; }) diff --git a/pkgs/by-name/la/lastpass-cli/package.nix b/pkgs/by-name/la/lastpass-cli/package.nix index cf35a16d029d..c6449f8f8e61 100644 --- a/pkgs/by-name/la/lastpass-cli/package.nix +++ b/pkgs/by-name/la/lastpass-cli/package.nix @@ -14,13 +14,13 @@ stdenv.mkDerivation rec { pname = "lastpass-cli"; - version = "1.6.0"; + version = "1.6.1"; src = fetchFromGitHub { owner = "lastpass"; repo = pname; rev = "v${version}"; - sha256 = "sha256-F/E8Y9aSkx5fhra+ppVsO/NXP28RF+QoGBzUccTfjRQ="; + sha256 = "sha256-Q0ZG5Ehg29STLeAerMoLfzjaH9JyPk7269RgiPmDJV8="; }; nativeBuildInputs = [ asciidoc cmake docbook_xsl pkg-config ]; diff --git a/pkgs/by-name/mk/mkalias/package.nix b/pkgs/by-name/mk/mkalias/package.nix index 507ce73827e8..1989452df36e 100644 --- a/pkgs/by-name/mk/mkalias/package.nix +++ b/pkgs/by-name/mk/mkalias/package.nix @@ -7,13 +7,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "mkalias"; - version = "1.0.0"; + version = "1.1.0"; src = fetchFromGitHub { owner = "vs49688"; repo = "mkalias"; rev = "v${finalAttrs.version}"; - hash = "sha256-L6bgCJ0fdiWmtlgTzDmTenTMP74UFUEqiDmE1+gg3zw="; + hash = "sha256-kIVCtYGlWKS0d/Potwo6X8F7Hgc/1S1RQTEbJi+IL9U="; }; nativeBuildInputs = [ @@ -24,6 +24,10 @@ stdenv.mkDerivation (finalAttrs: { darwin.apple_sdk.frameworks.Foundation ]; + cmakeFlags = [ + "-DMKALIAS_VERSION=${finalAttrs.version}" + ]; + installPhase = '' runHook preInstall @@ -35,7 +39,7 @@ stdenv.mkDerivation (finalAttrs: { meta = { description = "Quick'n'dirty tool to make APFS aliases"; homepage = "https://github.com/vs49688/mkalias"; - license = lib.licenses.mit; + license = lib.licenses.gpl2Only; mainProgram = "mkalias"; maintainers = with lib.maintainers; [ zane emilytrau ]; platforms = lib.platforms.darwin; diff --git a/pkgs/by-name/wi/wiliwili/package.nix b/pkgs/by-name/wi/wiliwili/package.nix index 85cc143f45f6..3bd64a0da20e 100644 --- a/pkgs/by-name/wi/wiliwili/package.nix +++ b/pkgs/by-name/wi/wiliwili/package.nix @@ -18,14 +18,14 @@ stdenv.mkDerivation (finalAttrs: { pname = "wiliwili"; - version = "1.4.1"; + version = "1.5.0"; src = fetchFromGitHub { owner = "xfangfang"; repo = "wiliwili"; rev = "v${finalAttrs.version}"; fetchSubmodules = true; - hash = "sha256-Fl8YV7yBW9dmcpcHCDVvkAzICTopNb4zKziDkR6NEwU="; + hash = "sha256-IHGUNnBSwCi+DU7K2yjRLUFRjeysiMojyGXMVecNyu4="; }; nativeBuildInputs = [ diff --git a/pkgs/development/compilers/reason/default.nix b/pkgs/development/compilers/reason/default.nix index 99c0b6a99a25..89487bdaa362 100644 --- a/pkgs/development/compilers/reason/default.nix +++ b/pkgs/development/compilers/reason/default.nix @@ -1,54 +1,35 @@ -{ lib, callPackage, stdenv, makeWrapper, fetchurl, ocaml, findlib, dune_3 -, ncurses -, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppxlib, utop, cppo, ppx_derivers +{ lib, callPackage, buildDunePackage, fetchurl +, fix, menhir, menhirLib, menhirSdk, merlin-extend, ppxlib, cppo, ppx_derivers , dune-build-info }: -stdenv.mkDerivation rec { - pname = "ocaml${ocaml.version}-reason"; +buildDunePackage rec { + pname = "reason"; version = "3.13.0"; + minimalOCamlVersion = "4.11"; + src = fetchurl { url = "https://github.com/reasonml/reason/releases/download/${version}/reason-${version}.tbz"; hash = "sha256-3yVEYGvIJKZwguIBGCbnoc3nrwzLW6RX6Tf+AYw85+Q="; }; - strictDeps = true; nativeBuildInputs = [ - makeWrapper - menhir - ocaml menhir cppo - dune_3 - findlib ]; buildInputs = [ dune-build-info fix menhirSdk - ppxlib - utop - ] ++ lib.optional (lib.versionOlder ocaml.version "4.07") ncurses; - - propagatedBuildInputs = [ - menhirLib merlin-extend - ppx_derivers ]; - buildFlags = [ "build" ]; # do not "make tests" before reason lib is installed - - installPhase = '' - runHook preInstall - dune install --prefix=$out --libdir=$OCAMLFIND_DESTDIR - wrapProgram $out/bin/rtop \ - --prefix PATH : "${utop}/bin" \ - --prefix CAML_LD_LIBRARY_PATH : "$CAML_LD_LIBRARY_PATH" \ - --prefix OCAMLPATH : "$OCAMLPATH:$OCAMLFIND_DESTDIR" - runHook postInstall - ''; + propagatedBuildInputs = [ + ppxlib + menhirLib + ]; passthru.tests = { hello = callPackage ./tests/hello { }; @@ -57,9 +38,8 @@ stdenv.mkDerivation rec { meta = with lib; { homepage = "https://reasonml.github.io/"; downloadPage = "https://github.com/reasonml/reason"; - description = "Facebook's friendly syntax to OCaml"; + description = "User-friendly programming language built on OCaml"; license = licenses.mit; - inherit (ocaml.meta) platforms; maintainers = [ ]; }; } diff --git a/pkgs/development/compilers/reason/rtop.nix b/pkgs/development/compilers/reason/rtop.nix new file mode 100644 index 000000000000..0255e57d5c47 --- /dev/null +++ b/pkgs/development/compilers/reason/rtop.nix @@ -0,0 +1,25 @@ +{ buildDunePackage, reason, cppo, utop, makeWrapper }: + +buildDunePackage { + pname = "rtop"; + inherit (reason) version src; + + nativeBuildInputs = [ + makeWrapper + cppo + ]; + + propagatedBuildInputs = [ reason utop ]; + + postInstall = '' + wrapProgram $out/bin/rtop \ + --prefix PATH : "${utop}/bin" \ + --prefix CAML_LD_LIBRARY_PATH : "$CAML_LD_LIBRARY_PATH" \ + --prefix OCAMLPATH : "$OCAMLPATH:$OCAMLFIND_DESTDIR" + ''; + + meta = reason.meta // { + description = "Toplevel (or REPL) for Reason, based on utop"; + mainProgram = "rtop"; + }; +} diff --git a/pkgs/development/compilers/reason/tests/hello/default.nix b/pkgs/development/compilers/reason/tests/hello/default.nix index 831b528c6ba9..42a0173a03be 100644 --- a/pkgs/development/compilers/reason/tests/hello/default.nix +++ b/pkgs/development/compilers/reason/tests/hello/default.nix @@ -1,4 +1,4 @@ -{ lib, buildDunePackage, ppxlib, reason }: +{ lib, buildDunePackage, reason }: buildDunePackage rec { pname = "helloreason"; @@ -19,7 +19,6 @@ buildDunePackage rec { ]; buildInputs = [ - ppxlib reason ]; diff --git a/pkgs/development/python-modules/caldav/default.nix b/pkgs/development/python-modules/caldav/default.nix index 9813d9b581bc..ce517c659439 100644 --- a/pkgs/development/python-modules/caldav/default.nix +++ b/pkgs/development/python-modules/caldav/default.nix @@ -7,10 +7,10 @@ pytestCheckHook, pythonOlder, python, - pytz, recurring-ical-events, requests, setuptools, + setuptools-scm, toPythonModule, tzlocal, vobject, @@ -19,32 +19,32 @@ buildPythonPackage rec { pname = "caldav"; - version = "1.3.9"; - + version = "1.4.0"; pyproject = true; - disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "python-caldav"; - repo = pname; + repo = "caldav"; rev = "refs/tags/v${version}"; - hash = "sha256-R9zXwD0sZE4bg6MTHWWCWWlZ5wH0H6g650zA7AboAo8="; + hash = "sha256-rixhEIcl37ZIiYFOnJY0Ww75xZy3o/436JcgLmoOGi0="; }; - nativeBuildInputs = [ setuptools ]; + build-system = [ + setuptools + setuptools-scm + ]; - propagatedBuildInputs = [ + dependencies = [ vobject lxml requests icalendar recurring-ical-events - pytz - tzlocal ]; nativeCheckInputs = [ pytestCheckHook + tzlocal (toPythonModule (xandikos.override { python3Packages = python.pkgs; })) ]; diff --git a/pkgs/development/python-modules/chainer/default.nix b/pkgs/development/python-modules/chainer/default.nix index 0ca1a2343941..789b0594c152 100644 --- a/pkgs/development/python-modules/chainer/default.nix +++ b/pkgs/development/python-modules/chainer/default.nix @@ -7,18 +7,19 @@ fetchFromGitHub, filelock, mock, - numpy, protobuf, pytestCheckHook, pythonOlder, six, + setuptools, + numpy, typing-extensions, }: buildPythonPackage rec { pname = "chainer"; version = "7.8.1.post1"; - format = "setuptools"; + build-system = [ setuptools ]; disabled = pythonOlder "3.7"; @@ -29,12 +30,18 @@ buildPythonPackage rec { hash = "sha256-epwnExmyCWmwaOz+mJnAl1peEeHLBdQGC62BlLfSTQQ="; }; - propagatedBuildInputs = [ + postPatch = '' + substituteInPlace chainer/_environment_check.py \ + --replace-fail "import numpy.distutils.system_info" "import numpy" \ + --replace-fail "numpy.distutils.system_info" "numpy.__config__.get_info" + ''; + + dependencies = [ filelock - numpy protobuf six typing-extensions + numpy ] ++ lib.optionals cudaSupport [ cupy ]; nativeCheckInputs = [ @@ -60,10 +67,10 @@ buildPythonPackage rec { pythonImportsCheck = [ "chainer" ]; - meta = with lib; { + meta = { description = "Flexible framework of neural networks for deep learning"; homepage = "https://chainer.org/"; - license = licenses.mit; - maintainers = with maintainers; [ hyphon81 ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ hyphon81 ]; }; } diff --git a/pkgs/development/python-modules/symspellpy/default.nix b/pkgs/development/python-modules/symspellpy/default.nix index e52fd3cc24fc..b0a9bc7b58ca 100644 --- a/pkgs/development/python-modules/symspellpy/default.nix +++ b/pkgs/development/python-modules/symspellpy/default.nix @@ -25,21 +25,6 @@ buildPythonPackage rec { disabled = pythonOlder "3.8"; - patches = [ - # patch for fix tests - # https://github.com/mammothb/symspellpy/pull/151 - (fetchpatch { - name = "fix-pkg-resources-deprecation-warning.patch"; - url = "https://github.com/mammothb/symspellpy/commit/b0298f4936f28a79612f5509612210868548793f.patch"; - hash = "sha256-mdUJMrcPv5zczIRP+8u5vicz2IE1AUN3YP0+zg3jqZg="; - }) - (fetchpatch { - name = "fix-error-message-checking-py312.patch"; - url = "https://github.com/mammothb/symspellpy/commit/f6f91e18316bed717036306c33d2ee82a922563a.patch"; - hash = "sha256-a5KsESIEIzlbcEPq8sTB2+XkuT/vP81U8StZhaL0MbA="; - }) - ]; - src = fetchFromGitHub { owner = "mammothb"; repo = "symspellpy"; @@ -62,11 +47,11 @@ buildPythonPackage rec { "symspellpy.symspellpy" ]; - meta = with lib; { + meta = { description = "Python port of SymSpell v6.7.1, which provides much higher speed and lower memory consumption"; homepage = "https://github.com/mammothb/symspellpy"; changelog = "https://github.com/mammothb/symspellpy/releases/tag/v${version}"; - license = licenses.mit; - maintainers = with maintainers; [ vizid ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ vizid ]; }; } diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/boot-config.nix b/pkgs/os-specific/bsd/openbsd/pkgs/boot-config.nix new file mode 100644 index 000000000000..23bd63e6d1ac --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/boot-config.nix @@ -0,0 +1,32 @@ +{ + mkDerivation, + lib, + flex, + byacc, + compatHook, +}: +mkDerivation { + path = "usr.sbin/config"; + + extraNativeBuildInputs = [ + flex + byacc + compatHook + ]; + + postPatch = '' + rm $BSDSRCDIR/usr.sbin/config/ukc.c + rm $BSDSRCDIR/usr.sbin/config/ukcutil.c + rm $BSDSRCDIR/usr.sbin/config/cmd.c + rm $BSDSRCDIR/usr.sbin/config/exec_elf.c + ''; + + buildPhase = '' + for f in *.l; do flex $f; done + for f in *.y; do yacc -H ''${f%.y}.h $f; done + for f in *.c; do $CC -I$TMP/include -DMAKE_BOOTSTRAP -c $f; done + $CC *.o -o config + ''; + + meta.platforms = lib.platforms.linux; +} diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/boot-ctags.nix b/pkgs/os-specific/bsd/openbsd/pkgs/boot-ctags.nix new file mode 100644 index 000000000000..e4bf4607da47 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/boot-ctags.nix @@ -0,0 +1,25 @@ +{ + mkDerivation, + lib, + flex, + byacc, + compatHook, +}: +mkDerivation { + path = "usr.bin/ctags"; + + extraNativeBuildInputs = [ + flex + byacc + compatHook + ]; + + buildPhase = '' + for f in *.l; do flex $f; done + for f in *.y; do yacc -H ''${f%.y}.h $f; done + for f in *.c; do $CC -I$TMP/include -DMAKE_BOOTSTRAP -c $f; done + $CC *.o -o ctags + ''; + + meta.platforms = lib.platforms.linux; +} diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/err.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/err.h new file mode 100644 index 000000000000..8ff38a621743 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/err.h @@ -0,0 +1,30 @@ +#pragma once +#include_next + +#include +#include +static inline void __attribute__((__format__(printf, 3, 4))) +errc(int eval, int code, const char *fmt, ...) { + // verr uses the error code from errno + // No need to keep the old value since this is noreturn anyway + errno = code; + + va_list args; + va_start(args, fmt); + verr(eval, fmt, args); + va_end(args); +} + +static inline void __attribute__((__format__(printf, 2, 3))) +warnc(int code, const char *fmt, ...) { + // verr uses the error code from errno + int old_errno = errno; + errno = code; + + va_list args; + va_start(args, fmt); + vwarn(fmt, args); + va_end(args); + + errno = old_errno; +} diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/fcntl.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/fcntl.h new file mode 100644 index 000000000000..d8bb61a2291d --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/fcntl.h @@ -0,0 +1,6 @@ +#pragma once +#include_next + +// Linux doesn't let you lock during open, make these do nothing +#define O_EXLOCK 0 +#define O_SHLOCK 0 diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/cdefs.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/cdefs.h new file mode 100644 index 000000000000..ea433160ad7c --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/cdefs.h @@ -0,0 +1,4 @@ +#include_next + +#define __packed __attribute__((__packed__)) +#define __aligned(x) __attribute__((__aligned__(x))) diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/dirent.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/dirent.h new file mode 100644 index 000000000000..d66bbdf7b613 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/dirent.h @@ -0,0 +1 @@ +#include diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/endian.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/endian.h new file mode 100644 index 000000000000..9abc15484c51 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/endian.h @@ -0,0 +1,2 @@ +// Seems to be the only header for htonl +#include diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/types.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/types.h new file mode 100644 index 000000000000..dc2578a8a1bb --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/sys/types.h @@ -0,0 +1,10 @@ +#include_next + +// for makedev, major, minor +#include + +// For htonl, htons, etc. +#include + +// for uint32_t etc. +#include diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/unistd.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/unistd.h new file mode 100644 index 000000000000..a52d202801f9 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/unistd.h @@ -0,0 +1,8 @@ +#pragma once + +#include_next + +// Reimplementing pledge and unvail with seccomp would be a pain, +// so do nothing but claim they succeeded +static int pledge(const char *, const char *) { return 0; } +static int unveil(const char *, const char *) { return 0; } diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/util.h b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/util.h new file mode 100644 index 000000000000..a12c43b15a9e --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/include/util.h @@ -0,0 +1 @@ +#include diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compat/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/compat/package.nix new file mode 100644 index 000000000000..69d457a180d8 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compat/package.nix @@ -0,0 +1,16 @@ +{ runCommand, lib }: + +runCommand "openbsd-compat" + { + include = ./include; + + meta = with lib; { + description = "A header-only library for running OpenBSD software on Linux"; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ artemist ]; + }; + } + '' + mkdir -p $out + cp -R $include $out/include + '' diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compatHook/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/compatHook/package.nix new file mode 100644 index 000000000000..3678b60f658b --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compatHook/package.nix @@ -0,0 +1,13 @@ +{ + stdenv, + makeSetupHook, + compat, +}: + +makeSetupHook { + name = "openbsd-compat-hook"; + substitutions = { + inherit compat; + inherit (stdenv.cc) suffixSalt; + }; +} ./setup-hook.sh diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/compatHook/setup-hook.sh b/pkgs/os-specific/bsd/openbsd/pkgs/compatHook/setup-hook.sh new file mode 100644 index 000000000000..af70cb4bcc8a --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/compatHook/setup-hook.sh @@ -0,0 +1,5 @@ +useOpenBSDCompat () { + export NIX_CFLAGS_COMPILE_@suffixSalt@+="-I@compat@/include" +} + +postHooks+=(useOpenBSDCompat) diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix index a16448752566..7e8a36ada14b 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix @@ -34,6 +34,8 @@ mkDerivation { sed -i -E \ -e 's|/usr/lib|\$\{LIBDIR\}|' \ share/mk/bsd.prog.mk + + substituteInPlace share/mk/bsd.obj.mk --replace-fail /bin/pwd pwd ''; installPhase = '' diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix index 44709f680884..0e0778d394a6 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix @@ -53,7 +53,7 @@ lib.makeOverridable ( install tsort lorder - ]; + ] ++ (attrs.extraNativeBuildInputs or [ ]); HOST_SH = stdenv'.shell; @@ -93,6 +93,6 @@ lib.makeOverridable ( dontBuild = true; } // lib.optionalAttrs stdenv'.hostPlatform.isStatic { NOLIBSHARED = true; } - // attrs + // (builtins.removeAttrs attrs [ "extraNativeBuildInputs" ]) ) ) diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/sys.nix b/pkgs/os-specific/bsd/openbsd/pkgs/sys.nix new file mode 100644 index 000000000000..58f1a0be8430 --- /dev/null +++ b/pkgs/os-specific/bsd/openbsd/pkgs/sys.nix @@ -0,0 +1,66 @@ +{ + mkDerivation, + boot-config, + pkgsBuildTarget, + baseConfig ? "GENERIC", +}: +mkDerivation { + path = "sys/arch/amd64"; + pname = "sys"; + extraPaths = [ "sys" ]; + noLibc = true; + + extraNativeBuildInputs = [ + boot-config + ]; + + postPatch = + # The in-kernel debugger (DDB) requires compiler flags not supported by clang, disable it + '' + sed -E -i -e '/DDB/d' $BSDSRCDIR/sys/conf/GENERIC + sed -E -i -e '/pseudo-device\tdt/d' $BSDSRCDIR/sys/arch/amd64/conf/GENERIC + '' + + + # Clang flags compatibility + '' + find $BSDSRCDIR -name 'Makefile*' -exec sed -E -i -e 's/-fno-ret-protector/-fno-stack-protector/g' -e 's/-nopie/-no-pie/g' {} + + sed -E -i -e 's_^\tinstall.*$_\tinstall bsd ''${out}/bsd_' -e s/update-link// $BSDSRCDIR/sys/arch/*/conf/Makefile.* + '' + + + # Remove randomness in build + '' + sed -E -i -e 's/^PAGE_SIZE=.*$/PAGE_SIZE=4096/g' -e '/^random_uniform/a echo 0; return 0;' $BSDSRCDIR/sys/conf/makegap.sh + sed -E -i -e 's/^v=.*$/v=0 u=nixpkgs h=nixpkgs t=`date -d @1`/g' $BSDSRCDIR/sys/conf/newvers.sh + ''; + + postConfigure = '' + export BSDOBJDIR=$TMP/obj + mkdir $BSDOBJDIR + make obj + + cd conf + config ${baseConfig} + cd - + ''; + + preBuild = + # A lot of files insist on calling unprefixed GNU `ld` and `objdump`. + # It's easier to add them to PATH than patch and substitute. + '' + mkdir $TMP/bin + export PATH=$TMP/bin:$PATH + ln -s ${pkgsBuildTarget.binutils}/bin/${pkgsBuildTarget.binutils.targetPrefix}objdump $TMP/bin/objdump + ln -s ${pkgsBuildTarget.binutils}/bin/${pkgsBuildTarget.binutils.targetPrefix}ld $TMP/bin/ld + '' + + + # The Makefile claims it needs includes, but it really doesn't. + # Tell it includes aren't real and can't hurt it. + '' + cd compile/${baseConfig}/obj + echo 'includes:' >>Makefile + ''; + + # stand is in a separate package + env.SKIPDIR = "stand"; + env.NIX_CFLAGS_COMPILE = "-Wno-unused-command-line-argument -Wno-visibility"; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4196f4b72cd0..4991c632a0c8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7676,7 +7676,7 @@ with pkgs; nqp = callPackage ../development/interpreters/rakudo/nqp.nix { }; zef = callPackage ../development/interpreters/rakudo/zef.nix { }; - inherit (ocamlPackages) reason; + inherit (ocamlPackages) reason rtop; buildRubyGem = callPackage ../development/ruby-modules/gem { inherit (darwin) libobjc; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 2f0ce2558934..6f244496f514 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1691,6 +1691,8 @@ let rresult = callPackage ../development/ocaml-modules/rresult { }; + rtop = callPackage ../development/compilers/reason/rtop.nix { }; + rusage = callPackage ../development/ocaml-modules/rusage { }; ### S ###