diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index caf57d7d6371..e1c705eef3b5 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -73,10 +73,7 @@ let defaultPkgs = if opt.hostPlatform.isDefined then let - isCross = - !(lib.systems.equals (lib.systems.elaborate cfg.buildPlatform) ( - lib.systems.elaborate cfg.hostPlatform - )); + isCross = cfg.buildPlatform != cfg.hostPlatform; systemArgs = if isCross then { @@ -198,10 +195,13 @@ in }; hostPlatform = lib.mkOption { - type = lib.types.either lib.types.str lib.types.attrs; + type = lib.types.either lib.types.str lib.types.attrs; # TODO utilize lib.systems.parsedPlatform example = { system = "aarch64-linux"; }; + # Make sure that the final value has all fields for sake of other modules + # referring to this. TODO make `lib.systems` itself use the module system. + apply = lib.systems.elaborate; defaultText = lib.literalExpression ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform''; description = '' Specifies the platform where the NixOS configuration will run. @@ -213,13 +213,22 @@ in }; buildPlatform = lib.mkOption { - type = lib.types.either lib.types.str lib.types.attrs; + type = lib.types.either lib.types.str lib.types.attrs; # TODO utilize lib.systems.parsedPlatform default = cfg.hostPlatform; example = { system = "x86_64-linux"; }; # Make sure that the final value has all fields for sake of other modules # referring to this. + apply = + inputBuildPlatform: + let + elaborated = lib.systems.elaborate inputBuildPlatform; + in + if lib.systems.equals elaborated cfg.hostPlatform then + cfg.hostPlatform # make identical, so that `==` equality works; see https://github.com/NixOS/nixpkgs/issues/278001 + else + elaborated; defaultText = lib.literalExpression ''config.nixpkgs.hostPlatform''; description = '' Specifies the platform on which NixOS should be built. @@ -236,11 +245,14 @@ in }; localSystem = lib.mkOption { - type = lib.types.attrs; + type = lib.types.attrs; # TODO utilize lib.systems.parsedPlatform default = { inherit (cfg) system; }; example = { system = "aarch64-linux"; }; + # Make sure that the final value has all fields for sake of other modules + # referring to this. TODO make `lib.systems` itself use the module system. + apply = lib.systems.elaborate; defaultText = lib.literalExpression ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform''; description = '' Systems with a recently generated `hardware-configuration.nix` @@ -268,7 +280,7 @@ in # is a relation between at least 2 systems in the context of a # specific build step, not a single system. crossSystem = lib.mkOption { - type = lib.types.nullOr lib.types.attrs; + type = lib.types.nullOr lib.types.attrs; # TODO utilize lib.systems.parsedPlatform default = null; example = { system = "aarch64-linux"; @@ -404,18 +416,6 @@ in ${lib.concatMapStringsSep "\n" (file: " - ${file}") opt.config.files} ''; } - { - assertion = - (opt.hostPlatform.isDefined -> builtins.isAttrs cfg.buildPlatform -> !(cfg.buildPlatform ? parsed)) - && (opt.hostPlatform.isDefined -> builtins.isAttrs cfg.hostPlatform -> !(cfg.hostPlatform ? parsed)) - && (builtins.isAttrs cfg.localSystem -> !(cfg.localSystem ? parsed)) - && (builtins.isAttrs cfg.crossSystem -> !(cfg.crossSystem ? parsed)); - message = '' - Passing fully elaborated systems to `nixpkgs.localSystem`, `nixpkgs.crossSystem`, `nixpkgs.buildPlatform` - or `nixpkgs.hostPlatform` will break composability of package sets in nixpkgs. For example, pkgs.pkgsStatic - would not work in modules anymore. - ''; - } ]; }; diff --git a/nixos/modules/misc/nixpkgs/read-only.nix b/nixos/modules/misc/nixpkgs/read-only.nix index 9d0d452ba52d..fa372d13e545 100644 --- a/nixos/modules/misc/nixpkgs/read-only.nix +++ b/nixos/modules/misc/nixpkgs/read-only.nix @@ -40,11 +40,20 @@ in The Nixpkgs overlays that `pkgs` was initialized with. ''; }; - # buildPlatform and hostPlatform left out on purpose: - # - They are not supposed to be changed with this read-only module. - # - They are not supposed to be read either, according to the description - # of "system" in the traditional nixpkgs module. - # + hostPlatform = mkOption { + internal = true; + readOnly = true; + description = '' + The platform of the machine that is running the NixOS configuration. + ''; + }; + buildPlatform = mkOption { + internal = true; + readOnly = true; + description = '' + The platform of the machine that built the NixOS configuration. + ''; + }; # NOTE: do not add the legacy options such as localSystem here. Let's keep # this module simple and let module authors upgrade their code instead. }; @@ -52,8 +61,12 @@ in config = { _module.args.pkgs = # find mistaken definitions - builtins.seq cfg.config builtins.seq cfg.overlays cfg.pkgs; + builtins.seq cfg.config builtins.seq cfg.overlays builtins.seq cfg.hostPlatform builtins.seq + cfg.buildPlatform + cfg.pkgs; nixpkgs.config = cfg.pkgs.config; nixpkgs.overlays = cfg.pkgs.overlays; + nixpkgs.hostPlatform = cfg.pkgs.stdenv.hostPlatform; + nixpkgs.buildPlatform = cfg.pkgs.stdenv.buildPlatform; }; } diff --git a/nixos/modules/programs/chromium.nix b/nixos/modules/programs/chromium.nix index 290808b7bdbe..9b07c19ff8c0 100644 --- a/nixos/modules/programs/chromium.nix +++ b/nixos/modules/programs/chromium.nix @@ -22,7 +22,7 @@ in options = { programs.chromium = { - enable = lib.mkEnableOption "{command}`chromium` policies"; + enable = lib.mkEnableOption "policies for chromium based browsers like Chromium, Google Chrome or Brave"; enablePlasmaBrowserIntegration = lib.mkEnableOption "Native Messaging Host for Plasma Browser Integration"; diff --git a/nixos/modules/services/web-apps/homebox.nix b/nixos/modules/services/web-apps/homebox.nix index a6f4a58d0e57..f2e17a1b85f0 100644 --- a/nixos/modules/services/web-apps/homebox.nix +++ b/nixos/modules/services/web-apps/homebox.nix @@ -20,12 +20,14 @@ in package = mkPackageOption pkgs "homebox" { }; settings = lib.mkOption { type = types.attrsOf types.str; - defaultText = '' - HBOX_STORAGE_DATA = "/var/lib/homebox/data"; - HBOX_STORAGE_SQLITE_URL = "/var/lib/homebox/data/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1"; - HBOX_OPTIONS_ALLOW_REGISTRATION = "false"; - HBOX_OPTIONS_CHECK_GITHUB_RELEASE = "false"; - HBOX_MODE = "production"; + defaultText = lib.literalExpression '' + { + HBOX_STORAGE_DATA = "/var/lib/homebox/data"; + HBOX_STORAGE_SQLITE_URL = "/var/lib/homebox/data/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1"; + HBOX_OPTIONS_ALLOW_REGISTRATION = "false"; + HBOX_OPTIONS_CHECK_GITHUB_RELEASE = "false"; + HBOX_MODE = "production"; + } ''; description = '' The homebox configuration as Environment variables. For definitions and available options see the upstream diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 036f5129b1b3..5f43e3322340 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -506,12 +506,8 @@ in config = { nixpkgs = if options.nixpkgs?hostPlatform - then { - hostPlatform = - if host.options.nixpkgs.hostPlatform.isDefined - then host.config.nixpkgs.hostPlatform - else lib.defaultTo host.config.nixpkgs.localSystem host.config.nixpkgs.crossSystem; - } else { localSystem = lib.defaultTo host.config.nixpkgs.localSystem host.config.nixpkgs.crossSystem; } + then { inherit (host.pkgs.stdenv) hostPlatform; } + else { localSystem = host.pkgs.stdenv.hostPlatform; } ; boot.isContainer = true; networking.hostName = mkDefault name; diff --git a/nixos/tests/appliance-repart-image-verity-store.nix b/nixos/tests/appliance-repart-image-verity-store.nix index 4769dd052e87..ef0fda4f780d 100644 --- a/nixos/tests/appliance-repart-image-verity-store.nix +++ b/nixos/tests/appliance-repart-image-verity-store.nix @@ -40,7 +40,7 @@ verityStore = { enable = true; # by default the module works with systemd-boot, for simplicity this test directly boots the UKI - ukiPath = "/EFI/BOOT/BOOT${lib.toUpper pkgs.stdenv.hostPlatform.efiArch}.EFI"; + ukiPath = "/EFI/BOOT/BOOT${lib.toUpper config.nixpkgs.hostPlatform.efiArch}.EFI"; }; name = "appliance-verity-store-image"; @@ -51,7 +51,7 @@ repartConfig = { Type = "esp"; Format = "vfat"; - SizeMinBytes = if pkgs.stdenv.hostPlatform.isx86_64 then "64M" else "96M"; + SizeMinBytes = if config.nixpkgs.hostPlatform.isx86_64 then "64M" else "96M"; }; }; ${partitionIds.store-verity}.repartConfig = { diff --git a/nixos/tests/appliance-repart-image.nix b/nixos/tests/appliance-repart-image.nix index b916875bfcea..11447cf8fa03 100644 --- a/nixos/tests/appliance-repart-image.nix +++ b/nixos/tests/appliance-repart-image.nix @@ -53,7 +53,7 @@ in "esp" = { contents = let - efiArch = pkgs.stdenv.hostPlatform.efiArch; + efiArch = config.nixpkgs.hostPlatform.efiArch; in { "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = @@ -70,7 +70,7 @@ in # aarch64 kernel seems to generally be a little bigger than the # x86_64 kernel. To stay on the safe side, leave some more slack # for every platform other than x86_64. - SizeMinBytes = if pkgs.stdenv.hostPlatform.isx86_64 then "64M" else "96M"; + SizeMinBytes = if config.nixpkgs.hostPlatform.isx86_64 then "64M" else "96M"; }; }; "swap" = { diff --git a/pkgs/applications/misc/rofi/wayland.nix b/pkgs/applications/misc/rofi/wayland.nix index c79ec6debc8f..a28d6f1027fe 100644 --- a/pkgs/applications/misc/rofi/wayland.nix +++ b/pkgs/applications/misc/rofi/wayland.nix @@ -10,14 +10,14 @@ rofi-unwrapped.overrideAttrs (oldAttrs: rec { pname = "rofi-wayland-unwrapped"; - version = "1.7.7+wayland1"; + version = "1.7.8+wayland1"; src = fetchFromGitHub { owner = "lbonn"; repo = "rofi"; rev = version; fetchSubmodules = true; - hash = "sha256-wGBB7h2gZRQNmHV0NIbD0vvHtKZqnT5hd2gz5smKGoU="; + hash = "sha256-6hQfy0c73z1Oi2mGjuhKLZQIBpG1u06v40dmlc5fL/w="; }; depsBuildBuild = oldAttrs.depsBuildBuild ++ [ pkg-config ]; diff --git a/pkgs/by-name/hi/hifile/package.nix b/pkgs/by-name/hi/hifile/package.nix index 9a565f74f10c..9b4a6e10e2ff 100644 --- a/pkgs/by-name/hi/hifile/package.nix +++ b/pkgs/by-name/hi/hifile/package.nix @@ -5,12 +5,12 @@ }: let - version = "0.9.9.15"; + version = "0.9.9.16"; pname = "hifile"; src = fetchurl { url = "https://www.hifile.app/files/HiFile-${version}.AppImage"; - hash = "sha256-Q0clcmBLWt8qDzHYjRRbwyZBSWW//yBTbRcnRjrSlzM="; + hash = "sha256-/5ZAAq6yQQZ8NxlCeXp1jJ+fqewIGuBGD+KpjirfCjU="; }; appimageContents = appimageTools.extractType2 { diff --git a/pkgs/by-name/li/limesurvey/package.nix b/pkgs/by-name/li/limesurvey/package.nix index d9b1d6b029c9..d8b44edb8470 100644 --- a/pkgs/by-name/li/limesurvey/package.nix +++ b/pkgs/by-name/li/limesurvey/package.nix @@ -8,13 +8,13 @@ stdenv.mkDerivation rec { pname = "limesurvey"; - version = "6.6.5+240924"; + version = "6.10.2+250127"; src = fetchFromGitHub { owner = "LimeSurvey"; repo = "LimeSurvey"; rev = version; - hash = "sha256-CuuTFCDY7jnF2njZdyB6e8/nRf0n0ybKgZ0QscC2IAI="; + hash = "sha256-2ZRN2zbrrGWTXgsPeRWsQbg1qw2vVIAwzUI0LWgCL9g="; }; phpConfig = writeText "config.php" '' diff --git a/pkgs/by-name/op/open-webui/package.nix b/pkgs/by-name/op/open-webui/package.nix index cde4b0d81e04..4e7841d6b03c 100644 --- a/pkgs/by-name/op/open-webui/package.nix +++ b/pkgs/by-name/op/open-webui/package.nix @@ -7,19 +7,19 @@ }: let pname = "open-webui"; - version = "0.5.7"; + version = "0.5.9"; src = fetchFromGitHub { owner = "open-webui"; repo = "open-webui"; tag = "v${version}"; - hash = "sha256-spdwd3ffibmHb9LDgK1EkpUAK6OsD9d6gocrbEx/CrE="; + hash = "sha256-r4jl1WNI8tyhwyYbTZ+Q52xvv3PJY2FvhexMYHIIDPg="; }; frontend = buildNpmPackage { inherit pname version src; - npmDepsHash = "sha256-9wu5SWtom/pZrFRP8rrsZMoGEnN4MVAlkyeydr0Fslo="; + npmDepsHash = "sha256-PAX3aa0WdvCBvAD8AGQYqnx5Sd/85luMqP6hAyICyhA="; # Disabling `pyodide:fetch` as it downloads packages during `buildPhase` # Until this is solved, running python packages from the browser will not work. diff --git a/pkgs/by-name/pm/pmccabe/package.nix b/pkgs/by-name/pm/pmccabe/package.nix index 9f3982397dae..4c740db6e2aa 100644 --- a/pkgs/by-name/pm/pmccabe/package.nix +++ b/pkgs/by-name/pm/pmccabe/package.nix @@ -13,9 +13,11 @@ stdenv.mkDerivation rec { sha256 = "0a3h1b9fb87c82d5fbql5lc4gp338pa5s9i66dhw7zk8jdygx474"; }; - patches = [ - ./getopt_on_darwin.patch - ]; + patches = [ ./getopt_on_darwin.patch ]; + + # GCC 14 made implicit function declarations an error. With this switch we turn them + # back into a warning. + env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; configurePhase = '' sed -i -r Makefile \ diff --git a/pkgs/by-name/rt/rtfm/enable-write-permissions.patch b/pkgs/by-name/rt/rtfm/enable-write-permissions.patch deleted file mode 100644 index 8023d647f782..000000000000 --- a/pkgs/by-name/rt/rtfm/enable-write-permissions.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/doc2dash/docset_builder.cr 2024-04-20 10:45:32.000673168 +0300 -+++ b/src/doc2dash/docset_builder.cr 2024-04-20 10:45:56.072895349 +0300 -@@ -44,6 +44,7 @@ - real_dest = @html_dest.join(dest || source) - Dir.mkdir_p(Path.new(real_dest).dirname) - File.copy(original, real_dest) -+ File.chmod(real_dest, 0o600) - dest || source - end - diff --git a/pkgs/by-name/rt/rtfm/make.patch b/pkgs/by-name/rt/rtfm/make.patch deleted file mode 100644 index 40f327193deb..000000000000 --- a/pkgs/by-name/rt/rtfm/make.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/Makefile 2024-04-20 10:28:36.697545022 +0300 -+++ b/Makefile 2024-04-20 10:37:55.591657540 +0300 -@@ -7,8 +7,10 @@ - shards build --debug -Dpreview_mt - - configure: -- shards install -- ./bin/gi-crystal -+ mkdir bin/ -+ cd lib/gi-crystal && shards build -Dpreview_mt --release --no-debug -+ cd ../.. -+ cp lib/gi-crystal/bin/gi-crystal bin/ && ./bin/gi-crystal - - rtfm: - shards build --release -Dpreview_mt rtfm -@@ -16,10 +18,10 @@ - docsets: crystal-docset gtk-docset - - crystal-docset: -- crystal run src/doc2dash/create_crystal_docset.cr -+ crystal src/doc2dash/create_crystal_docset.cr "@crystal@/share/doc/crystal/api" - - gtk-docset: -- crystal run src/doc2dash/create_gtk_docset.cr -+ crystal src/doc2dash/create_gtk_docset.cr "gtk-doc/" - - test: crystal-docset gtk-docset - crystal spec -@@ -28,8 +30,10 @@ - install -D -m 0755 bin/rtfm $(DESTDIR)$(PREFIX)/bin/rtfm - install -D -m 0644 data/io.github.hugopl.rtfm.desktop $(DESTDIR)$(PREFIX)/share/applications/io.github.hugopl.rtfm.desktop - install -D -m 0644 data/icons/hicolor/scalable/apps/io.github.hugopl.rtfm.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/io.github.hugopl.rtfm.svg -+ gtk4-update-icon-cache --ignore-theme-index $(PREFIX)/share/icons/hicolor - # Settings schema - install -D -m644 data/io.github.hugopl.rtfm.gschema.xml $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/io.github.hugopl.rtfm.gschema.xml -+ glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas - # docsets - mkdir -p $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ - cp -r data/Crystal.docset $(DESTDIR)$(PREFIX)/share/rtfm/docsets/ diff --git a/pkgs/by-name/rt/rtfm/package.nix b/pkgs/by-name/rt/rtfm/package.nix index 3bf066ff18f0..bf5856c57ba5 100644 --- a/pkgs/by-name/rt/rtfm/package.nix +++ b/pkgs/by-name/rt/rtfm/package.nix @@ -2,7 +2,7 @@ stdenv, lib, fetchFromGitHub, - crystal, + crystal_1_14, wrapGAppsHook4, gobject-introspection, desktopToDarwinBundle, @@ -10,45 +10,70 @@ sqlite, libadwaita, gtk4, + glib, pango, - replaceVars, + symlinkJoin, + gitUpdater, + _experimental-update-script-combinators, + runCommand, + crystal2nix, + writeShellScript, }: let - gtk4' = gtk4.override { x11Support = true; }; - pango' = pango.override { withIntrospection = true; }; -in -crystal.buildCrystalPackage rec { - pname = "rtfm"; - version = "0.5.0"; + version = "0.6.0"; src = fetchFromGitHub { owner = "hugopl"; repo = "rtfm"; - rev = "v${version}"; - name = "rtfm"; - hash = "sha256-+s7KXl3+j/BaneOBqVAMJJhmrG6xtcGaHhYnMvUfiVA="; + tag = "v${version}"; + hash = "sha256-KuxGQs7TPn2Lmgk/NjfoRsBtkTY0GC/DOUlQZXCdRXE="; }; - patches = [ - # 1) fixed gi-crystal binding generator command - # 2) fixed docset generator command - # 3) added commands to build gschemas and update icon-cache - (replaceVars ./make.patch { - inherit crystal; - }) - # added chmod +w for copied docs to prevent error: - # `Error opening file with mode 'wb': '.../style.css': Permission denied` - ./enable-write-permissions.patch - ]; - - postPatch = '' - substituteInPlace src/doc2dash/create_gtk_docset.cr \ - --replace-fail 'basedir = Path.new("/usr/share/doc")' 'basedir = Path.new(ARGV[0]? || "gtk-docs")' - ''; + gtk-doc = + let + gtk4' = gtk4.override { x11Support = true; }; + pango' = pango.override { withIntrospection = true; }; + in + symlinkJoin { + name = "gtk-doc"; + paths = [ + gtk4'.devdoc + pango'.devdoc + glib.devdoc + libadwaita.devdoc + webkitgtk_6_0.devdoc + ]; + }; +in +crystal_1_14.buildCrystalPackage { + pname = "rtfm"; + inherit version src; shardsFile = ./shards.nix; copyShardDeps = true; + postPatch = '' + substituteInPlace src/doc2dash/create_gtk_docset.cr \ + --replace-fail 'basedir = Path.new("/usr/share/doc")' 'basedir = Path.new(ARGV[0]? || "${gtk-doc}/share/doc")' \ + --replace-fail 'webkit2gtk-4.0' 'webkitgtk-6.0' + substituteInPlace src/doc2dash/create_crystal_docset.cr \ + --replace-fail 'doc_source = Path.new(ARGV[0]? || "/usr/share/doc/crystal/api")' 'doc_source = Path.new(ARGV[0]? || "${crystal_1_14}/share/doc/crystal/api")' + substituteInPlace src/doc2dash/docset_builder.cr \ + --replace-fail 'File.copy(original, real_dest)' 'File.copy(original, real_dest); File.chmod(real_dest, 0o600)' + substituteInPlace Makefile \ + --replace-fail 'shards install' 'true' + ''; + + preBuild = '' + cd lib/gi-crystal + shards build -Dpreview_mt --release --no-debug + cd ../.. + mkdir bin/ + cp lib/gi-crystal/bin/gi-crystal bin/ + ''; + + buildTargets = [ "all" ]; + nativeBuildInputs = [ wrapGAppsHook4 gobject-introspection @@ -58,37 +83,44 @@ crystal.buildCrystalPackage rec { webkitgtk_6_0 sqlite libadwaita - gtk4' - pango' + gtk4 + pango ]; - buildTargets = [ - "configure" - "rtfm" - "docsets" - ]; - - preBuild = '' - mkdir gtk-doc/ - - for file in "${gtk4'.devdoc}"/share/doc/*; do - ln -s "$file" "gtk-doc/$(basename "$file")" - done - - for file in "${pango'.devdoc}"/share/doc/*; do - ln -s "$file" "gtk-doc/$(basename "$file")" - done - - for file in "${libadwaita.devdoc}"/share/doc/*; do - ln -s "$file" "gtk-doc/$(basename "$file")" - done + postInstall = '' + glib-compile-schemas $out/share/glib-2.0/schemas ''; + passthru = { + updateScript = _experimental-update-script-combinators.sequence [ + (gitUpdater { rev-prefix = "v"; }) + (_experimental-update-script-combinators.copyAttrOutputToFile "rtfm.shardLock" "./shard.lock") + { + command = [ + (writeShellScript "update-lock" "cd $1; ${lib.getExe crystal2nix}") + ./. + ]; + supportedFeatures = [ "silent" ]; + } + { + command = [ + "rm" + "./shard.lock" + ]; + supportedFeatures = [ "silent" ]; + } + ]; + shardLock = runCommand "shard.lock" { inherit src; } '' + cp $src/shard.lock $out + ''; + }; + meta = with lib; { description = "Dash/docset reader with built in documentation for Crystal and GTK APIs"; homepage = "https://github.com/hugopl/rtfm/"; license = licenses.mit; mainProgram = "rtfm"; maintainers = with maintainers; [ sund3RRR ]; + platforms = platforms.unix; }; } diff --git a/pkgs/by-name/rt/rtfm/shards.nix b/pkgs/by-name/rt/rtfm/shards.nix index 79a2eeb2f0db..9fbf14f6e297 100644 --- a/pkgs/by-name/rt/rtfm/shards.nix +++ b/pkgs/by-name/rt/rtfm/shards.nix @@ -6,18 +6,18 @@ }; fzy = { url = "https://github.com/hugopl/fzy.git"; - rev = "6c2395bcdea1889969d0d08c16163c276fe4e473"; - sha256 = "0vpradafkwckfsq7wqrgkpsli7bfmgc27d38q06l1jzq0z0j92rw"; + rev = "v0.6.0"; + sha256 = "1mpw3ridzvqkf807wik6wzwpzcsk0075kifagsfnz38vx1mw2y55"; }; gi-crystal = { url = "https://github.com/hugopl/gi-crystal.git"; - rev = "v0.22.2"; - sha256 = "0bpa1f8iaf97z2kbgjc7nc8km7nd7bppiwna319lm2hvm8m5pw15"; + rev = "v0.24.0"; + sha256 = "0x356xn35008l573qhyl1sdddc9cc5i3bsa4c7865kgq9521ifyh"; }; gtk4 = { url = "https://github.com/hugopl/gtk4.cr.git"; - rev = "v0.16.1"; - sha256 = "1cqkbh072y70l8g0p040vf50k920p32ry1larnwn9mqabd74jwaj"; + rev = "v0.17.0"; + sha256 = "0lv3nvsanxi4g2322zvkf1jxx5zgzaapk228vcw2cl0ja1drm06d"; }; harfbuzz = { url = "https://github.com/hugopl/harfbuzz.cr.git"; @@ -25,7 +25,7 @@ sha256 = "06wgqxwyib5416yp53j2iwcbr3bl4jjxb1flm7z103l365par694"; }; libadwaita = { - url = "https://github.com/geopjr/libadwaita.cr.git"; + url = "https://github.com/hugopl/libadwaita.cr.git"; rev = "cffabb56e911d2a90c53c2fd14d6bd08bf5ac446"; sha256 = "0gcq04vgxg0vff9fcalgzq9phq0y76diihkzhlfn91bdxwkx7rl3"; }; diff --git a/pkgs/by-name/si/sing-box/package.nix b/pkgs/by-name/si/sing-box/package.nix index ede7d61c519a..ee093dc055c2 100644 --- a/pkgs/by-name/si/sing-box/package.nix +++ b/pkgs/by-name/si/sing-box/package.nix @@ -12,13 +12,13 @@ buildGoModule rec { pname = "sing-box"; - version = "1.11.0"; + version = "1.11.1"; src = fetchFromGitHub { owner = "SagerNet"; repo = pname; rev = "v${version}"; - hash = "sha256-or3RklqfrDIC2ZHJ7jDs1y+118/OsJiRKyDt1NCWqfI="; + hash = "sha256-W/b3pAyeTQiBZ5T8u74JITlAfJ5fmWn8DUUTw9tAZTk="; }; vendorHash = "sha256-NWHDEN7aQWR3DXp9nFNhxDXFMeBsCk8/ZzCcT/zgwmI="; diff --git a/pkgs/by-name/sy/syn2mas/package.nix b/pkgs/by-name/sy/syn2mas/package.nix index c39aa512aa43..5a34dacab26e 100644 --- a/pkgs/by-name/sy/syn2mas/package.nix +++ b/pkgs/by-name/sy/syn2mas/package.nix @@ -6,18 +6,18 @@ buildNpmPackage rec { pname = "syn2mas"; - version = "0.12.0"; + version = "0.13.0"; src = fetchFromGitHub { owner = "element-hq"; repo = "matrix-authentication-service"; rev = "v${version}"; - hash = "sha256-QLtyYxV2yXHJtwWgGcyi7gRcKypYoy9Z8bkEuTopVXc="; + hash = "sha256-rFex6stw++xNrcCYnYn3N0HrUQd91DAw9QU0R2MUzyQ="; }; sourceRoot = "${src.name}/tools/syn2mas"; - npmDepsHash = "sha256-pRa5qqLsI8Hx9v5tMPDkehczXZjWWAOjfDfLLh2V6Q4="; + npmDepsHash = "sha256-liwFM3HkZtZTJmaqF/7WvYxf2EKgjNF5xCHP/OxFK/k="; dontBuild = true; diff --git a/pkgs/by-name/th/the-powder-toy/package.nix b/pkgs/by-name/th/the-powder-toy/package.nix index 6f71e976eeff..c152efb70a1d 100644 --- a/pkgs/by-name/th/the-powder-toy/package.nix +++ b/pkgs/by-name/th/the-powder-toy/package.nix @@ -13,25 +13,27 @@ meson, ninja, pkg-config, + python3, SDL2, stdenv, zlib, }: stdenv.mkDerivation rec { pname = "the-powder-toy"; - version = "98.2.365"; + version = "99.0.377"; src = fetchFromGitHub { owner = "The-Powder-Toy"; repo = "The-Powder-Toy"; tag = "v${version}"; - hash = "sha256-S2aUa25EnUfX6ShW6D+wHrsTLxTcCFcZ/uLE9EWGu4Q="; + hash = "sha256-U8qgA/YZ10Vy1uuPtOZ7sEIV3sC2mtmC8y7O9FUE62Y="; }; nativeBuildInputs = [ meson ninja pkg-config + python3 ] ++ lib.optional stdenv.hostPlatform.isLinux copyDesktopItems; buildInputs = [ diff --git a/pkgs/by-name/vi/vistafonts-chs/no-op.conf b/pkgs/by-name/vi/vista-fonts-chs/no-op.conf similarity index 100% rename from pkgs/by-name/vi/vistafonts-chs/no-op.conf rename to pkgs/by-name/vi/vista-fonts-chs/no-op.conf diff --git a/pkgs/by-name/vi/vistafonts-chs/package.nix b/pkgs/by-name/vi/vista-fonts-chs/package.nix similarity index 88% rename from pkgs/by-name/vi/vistafonts-chs/package.nix rename to pkgs/by-name/vi/vista-fonts-chs/package.nix index 70491300ea74..bbac976571e5 100644 --- a/pkgs/by-name/vi/vistafonts-chs/package.nix +++ b/pkgs/by-name/vi/vista-fonts-chs/package.nix @@ -13,16 +13,22 @@ stdenvNoCC.mkDerivation { url = "https://web.archive.org/web/20161221192937if_/http://download.microsoft.com/download/d/6/e/d6e2ff26-5821-4f35-a18b-78c963b1535d/VistaFont_CHS.EXE"; # Alternative mirror: # http://www.eeo.cn/download/font/VistaFont_CHS.EXE - sha256 = "1qwm30b8aq9piyqv07hv8b5bac9ms40rsdf8pwix5dyk8020i8xi"; + hash = "sha256-saMIBEDTt9Ijv8g1nQHRNTG1ykIbHrCxjzdhhRYYleM="; }; nativeBuildInputs = [ cabextract ]; unpackPhase = '' + runHook preUnpack + cabextract --lowercase --filter '*.TTF' $src + + runHook postUnpack ''; installPhase = '' + runHook preInstall + mkdir -p $out/share/fonts/truetype cp *.ttf $out/share/fonts/truetype @@ -31,6 +37,8 @@ stdenvNoCC.mkDerivation { mkdir -p $out/etc/fonts/conf.d substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-msyahei.conf \ --subst-var-by fontname "Microsoft YaHei" + + runHook postInstall ''; meta = { diff --git a/pkgs/by-name/vi/vistafonts-cht/no-op.conf b/pkgs/by-name/vi/vista-fonts-cht/no-op.conf similarity index 100% rename from pkgs/by-name/vi/vistafonts-cht/no-op.conf rename to pkgs/by-name/vi/vista-fonts-cht/no-op.conf diff --git a/pkgs/by-name/vi/vistafonts-cht/package.nix b/pkgs/by-name/vi/vista-fonts-cht/package.nix similarity index 77% rename from pkgs/by-name/vi/vistafonts-cht/package.nix rename to pkgs/by-name/vi/vista-fonts-cht/package.nix index 593df81676f2..eeffdccd0455 100644 --- a/pkgs/by-name/vi/vistafonts-cht/package.nix +++ b/pkgs/by-name/vi/vista-fonts-cht/package.nix @@ -11,16 +11,22 @@ stdenvNoCC.mkDerivation { src = fetchurl { url = "https://download.microsoft.com/download/7/6/b/76bd7a77-be02-47f3-8472-fa1de7eda62f/VistaFont_CHT.EXE"; - sha256 = "sha256-fSnbbxlMPzbhFSQyKxQaS5paiWji8njK7tS8Eppsj6g="; + hash = "sha256-fSnbbxlMPzbhFSQyKxQaS5paiWji8njK7tS8Eppsj6g="; }; nativeBuildInputs = [ cabextract ]; unpackPhase = '' + runHook preUnpack + cabextract --lowercase --filter '*.TTF' $src + + runHook postUnpack ''; installPhase = '' + runHook preInstall + mkdir -p $out/share/fonts/truetype cp *.ttf $out/share/fonts/truetype @@ -29,17 +35,19 @@ stdenvNoCC.mkDerivation { mkdir -p $out/etc/fonts/conf.d substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-msjhenghei.conf \ --subst-var-by fontname "Microsoft JhengHei" + + runHook postInstall ''; - meta = with lib; { + meta = { description = "TrueType fonts from Microsoft Windows Vista For Traditional Chinese (Microsoft JhengHei)"; homepage = "https://www.microsoft.com/typography/fonts/family.aspx"; - license = licenses.unfree; - maintainers = with maintainers; [ atkinschang ]; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ atkinschang ]; # Set a non-zero priority to allow easy overriding of the # fontconfig configuration files. priority = 5; - platforms = platforms.all; + platforms = lib.platforms.all; }; } diff --git a/pkgs/by-name/vi/vistafonts/no-op.conf b/pkgs/by-name/vi/vista-fonts/no-op.conf similarity index 100% rename from pkgs/by-name/vi/vistafonts/no-op.conf rename to pkgs/by-name/vi/vista-fonts/no-op.conf diff --git a/pkgs/by-name/vi/vistafonts/package.nix b/pkgs/by-name/vi/vista-fonts/package.nix similarity index 89% rename from pkgs/by-name/vi/vistafonts/package.nix rename to pkgs/by-name/vi/vista-fonts/package.nix index d6f88cc17710..44d2551ce72b 100644 --- a/pkgs/by-name/vi/vistafonts/package.nix +++ b/pkgs/by-name/vi/vista-fonts/package.nix @@ -11,18 +11,24 @@ stdenvNoCC.mkDerivation { src = fetchurl { url = "mirror://sourceforge/mscorefonts2/cabs/PowerPointViewer.exe"; - sha256 = "07vhjdw8iip7gxk6wvp4myhvbn9619g10j9qvpbzz4ihima57ry4"; + hash = "sha256-xOdTVI0wkv/X3ThJEF4KJtm1oa/kbm5mf+fGiHiTcB8="; }; nativeBuildInputs = [ cabextract ]; unpackPhase = '' + runHook preUnpack + cabextract --lowercase --filter ppviewer.cab $src cabextract --lowercase --filter '*.TTF' ppviewer.cab cabextract --lowercase --filter '*.TTC' ppviewer.cab + + runHook postUnpack ''; installPhase = '' + runHook preInstall + mkdir -p $out/share/fonts/truetype cp *.ttf *.ttc $out/share/fonts/truetype @@ -33,6 +39,8 @@ stdenvNoCC.mkDerivation { substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-''${name,,}.conf \ --subst-var-by fontname $name done + + runHook postInstall ''; meta = { diff --git a/pkgs/by-name/we/weblate/package.nix b/pkgs/by-name/we/weblate/package.nix index fc672746baf2..c5e954134479 100644 --- a/pkgs/by-name/we/weblate/package.nix +++ b/pkgs/by-name/we/weblate/package.nix @@ -68,6 +68,10 @@ python.pkgs.buildPythonApplication rec { ${python.pythonOnBuildForHost.interpreter} manage.py compress ''; + pythonRelaxDeps = [ + "rapidfuzz" + ]; + dependencies = with python.pkgs; [ diff --git a/pkgs/development/python-modules/rapidfuzz/default.nix b/pkgs/development/python-modules/rapidfuzz/default.nix index 26f23a707103..71a7c6188da3 100644 --- a/pkgs/development/python-modules/rapidfuzz/default.nix +++ b/pkgs/development/python-modules/rapidfuzz/default.nix @@ -19,7 +19,7 @@ buildPythonPackage rec { pname = "rapidfuzz"; - version = "3.12.0"; + version = "3.12.1"; pyproject = true; disabled = pythonOlder "3.9"; @@ -28,7 +28,7 @@ buildPythonPackage rec { owner = "maxbachmann"; repo = "RapidFuzz"; tag = "v${version}"; - hash = "sha256-BNhdN6nKAIIA2PXrpvdy35udklotoBAu2ghQFNwGvWE="; + hash = "sha256-33NwGWulBJ7WAMAE0163OJM9kL04FuHa5P7m66PZL6s="; }; postPatch = '' diff --git a/pkgs/servers/irc/solanum/default.nix b/pkgs/servers/irc/solanum/default.nix index ed21b5ab0991..765f9692fb4b 100644 --- a/pkgs/servers/irc/solanum/default.nix +++ b/pkgs/servers/irc/solanum/default.nix @@ -16,13 +16,13 @@ stdenv.mkDerivation rec { pname = "solanum"; - version = "0-unstable-2024-07-24"; + version = "0-unstable-2025-01-29"; src = fetchFromGitHub { owner = "solanum-ircd"; repo = "solanum"; - rev = "4e89f6603d63b2f8dfdec7a83161fb0343236349"; - hash = "sha256-kUgB0Q+U6jx8Xyh1DSv8D7+Q9tC2wK3aaNt4At5chFQ="; + rev = "7289d455e8f640b3a2607d8049de27f9099abe1c"; + hash = "sha256-EQq8l48WgP8PuAyOoY6WU0FM1IHYBQisRojAUmyPOpM="; }; patches = [ diff --git a/pkgs/test/top-level/stage.nix b/pkgs/test/top-level/stage.nix deleted file mode 100644 index 449a36a425ab..000000000000 --- a/pkgs/test/top-level/stage.nix +++ /dev/null @@ -1,128 +0,0 @@ -# run like this: -# nix-build pkgs/test/top-level/stage.nix -{ - localSystem ? { - system = builtins.currentSystem; - }, -}: - -with import ../../top-level { inherit localSystem; }; - -let - # To silence platform specific evaluation errors - discardEvaluationErrors = e: (builtins.tryEval e).success -> e; - - # Basic test for idempotency of the package set, i.e: - # Applying the same package set twice should work and - # not change anything. - isIdempotent = set: discardEvaluationErrors (pkgs.${set}.stdenv == pkgs.${set}.${set}.stdenv); - - # Some package sets should be noops in certain circumstances. - # This is very similar to the idempotency test, but not going - # via the super' overlay. - isNoop = - parent: child: - discardEvaluationErrors ( - (lib.getAttrFromPath parent pkgs).stdenv == (lib.getAttrFromPath parent pkgs).${child}.stdenv - ); - - allMuslExamples = builtins.attrNames ( - lib.filterAttrs (_: system: lib.hasSuffix "-musl" system.config) lib.systems.examples - ); - - allLLVMExamples = builtins.attrNames ( - lib.filterAttrs (_: system: system.useLLVM or false) lib.systems.examples - ); - - # A package set should only change specific configuration, but needs - # to keep all other configuration from previous layers in place. - # Each package set has one or more key characteristics for which we - # test here. Those should be kept, even when applying the "set" package - # set. - isComposable = - set: - ( - # Can't compose two different libcs... - builtins.elem set [ "pkgsLLVMLibc" ] - || discardEvaluationErrors ( - pkgsCross.mingwW64.${set}.stdenv.hostPlatform.config == "x86_64-w64-mingw32" - ) - ) - && ( - # Can't compose two different libcs... - builtins.elem set [ "pkgsLLVMLibc" ] - || discardEvaluationErrors (pkgsCross.mingwW64.${set}.stdenv.hostPlatform.libc == "msvcrt") - ) - && discardEvaluationErrors (pkgsCross.ppc64-musl.${set}.stdenv.hostPlatform.gcc.abi == "elfv2") - && discardEvaluationErrors ( - builtins.elem "trivialautovarinit" pkgs.pkgsExtraHardening.${set}.stdenv.cc.defaultHardeningFlags - ) - && discardEvaluationErrors (pkgs.pkgsLLVM.${set}.stdenv.hostPlatform.useLLVM) - && ( - # Can't compose two different libcs... - builtins.elem set [ - "pkgsMusl" - "pkgsStatic" - ] - || discardEvaluationErrors (pkgs.pkgsLLVMLibc.${set}.stdenv.hostPlatform.isLLVMLibc) - ) - && discardEvaluationErrors (pkgs.pkgsArocc.${set}.stdenv.hostPlatform.useArocc) - && discardEvaluationErrors (pkgs.pkgsZig.${set}.stdenv.hostPlatform.useZig) - && discardEvaluationErrors (pkgs.pkgsLinux.${set}.stdenv.buildPlatform.isLinux) - && ( - # Can't compose two different libcs... - builtins.elem set [ "pkgsLLVMLibc" ] - || discardEvaluationErrors (pkgs.pkgsMusl.${set}.stdenv.hostPlatform.isMusl) - ) - && discardEvaluationErrors (pkgs.pkgsStatic.${set}.stdenv.hostPlatform.isStatic) - && discardEvaluationErrors (pkgs.pkgsi686Linux.${set}.stdenv.hostPlatform.isx86_32) - && discardEvaluationErrors (pkgs.pkgsx86_64Darwin.${set}.stdenv.hostPlatform.isx86_64); -in - -# Appends same defaultHardeningFlags again on each .pkgsExtraHardening - thus not idempotent. -# assert isIdempotent "pkgsExtraHardening"; -# TODO: Remove the isDarwin condition, which currently results in infinite recursion. -# Also see https://github.com/NixOS/nixpkgs/pull/330567#discussion_r1894653309 -assert (stdenv.hostPlatform.isDarwin || isIdempotent "pkgsLLVM"); -# TODO: This currently results in infinite recursion, even on Linux -# assert isIdempotent "pkgsLLVMLibc"; -assert isIdempotent "pkgsArocc"; -assert isIdempotent "pkgsZig"; -assert isIdempotent "pkgsLinux"; -assert isIdempotent "pkgsMusl"; -assert isIdempotent "pkgsStatic"; -assert isIdempotent "pkgsi686Linux"; -assert isIdempotent "pkgsx86_64Darwin"; - -assert isNoop [ "pkgsStatic" ] "pkgsMusl"; -assert lib.all (sys: isNoop [ "pkgsCross" sys ] "pkgsMusl") allMuslExamples; -assert lib.all (sys: isNoop [ "pkgsCross" sys ] "pkgsLLVM") allLLVMExamples; - -assert isComposable "pkgsExtraHardening"; -assert isComposable "pkgsLLVM"; -# TODO: Results in infinite recursion -# assert isComposable "pkgsLLVMLibc"; -assert isComposable "pkgsArocc"; -# TODO: unexpected argument 'bintools' - uncomment once https://github.com/NixOS/nixpkgs/pull/331011 is done -# assert isComposable "pkgsZig"; -assert isComposable "pkgsMusl"; -assert isComposable "pkgsStatic"; -assert isComposable "pkgsi686Linux"; - -# Special cases regarding buildPlatform vs hostPlatform -assert discardEvaluationErrors (pkgsCross.gnu64.pkgsMusl.stdenv.hostPlatform.isMusl); -assert discardEvaluationErrors (pkgsCross.gnu64.pkgsi686Linux.stdenv.hostPlatform.isx86_32); -assert discardEvaluationErrors (pkgsCross.mingwW64.pkgsLinux.stdenv.hostPlatform.isLinux); -assert discardEvaluationErrors ( - pkgsCross.aarch64-darwin.pkgsx86_64Darwin.stdenv.hostPlatform.isx86_64 -); - -# pkgsCross should keep upper cross settings -assert discardEvaluationErrors ( - with pkgsStatic.pkgsCross.gnu64.stdenv.hostPlatform; isGnu && isStatic -); -assert discardEvaluationErrors ( - with pkgsLLVM.pkgsCross.musl64.stdenv.hostPlatform; isMusl && useLLVM -); - -emptyFile diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index b1dd3c48f9a2..cda951863212 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1482,6 +1482,9 @@ mapAliases { viper4linux-gui = throw "'viper4linux-gui' was removed as it is broken and not maintained upstream"; # Added 2024-12-16 viper4linux = throw "'viper4linux' was removed as it is broken and not maintained upstream"; # Added 2024-12-16 virtscreen = throw "'virtscreen' has been removed, as it was broken and unmaintained"; # Added 2024-10-17 + vistafonts = vista-fonts; # Added 2025-02-03 + vistafonts-chs = vista-fonts-chs; # Added 2025-02-03 + vistafonts-cht = vista-fonts-cht; # Added 2025-02-03 vkBasalt = vkbasalt; # Added 2022-11-22 vkdt-wayland = vkdt; # Added 2024-04-19 void = throw "'void' has been removed due to lack of upstream maintenance"; # Added 2025-01-25 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 48aca03fb635..5578ac0e99f7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1667,9 +1667,9 @@ with pkgs; # pkgsCross.aarch64-multiplatform.freshBootstrapTools.build freshBootstrapTools = if stdenv.hostPlatform.isDarwin then callPackage ../stdenv/darwin/make-bootstrap-tools.nix { - localSystem = { config = lib.systems.parse.tripleFromSystem stdenv.buildPlatform; }; + localSystem = stdenv.buildPlatform; crossSystem = - if stdenv.buildPlatform == stdenv.hostPlatform then null else { config = lib.systems.parse.tripleFromSystem stdenv.hostPlatform; }; + if stdenv.buildPlatform == stdenv.hostPlatform then null else stdenv.hostPlatform; } else if stdenv.hostPlatform.isLinux then callPackage ../stdenv/linux/make-bootstrap-tools.nix {} @@ -17722,7 +17722,7 @@ with pkgs; [( { lib, ... }: { config.nixpkgs.pkgs = lib.mkDefault pkgs; - config.nixpkgs.localSystem = lib.mkDefault ({ config = lib.systems.parse.tripleFromSystem stdenv.hostPlatform; }); + config.nixpkgs.localSystem = lib.mkDefault stdenv.hostPlatform; } )] ++ ( if builtins.isList configuration diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 8aa678b43c4d..fd443ac773ff 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -46,11 +46,6 @@ ... } @ args: -# Passing fully elaborated systems to localSystem or crossSystem will break composability -# of package sets. -assert builtins.isAttrs localSystem -> !(localSystem ? parsed); -assert builtins.isAttrs crossSystem -> !(crossSystem ? parsed); - let # Rename the function arguments config0 = config; crossSystem0 = crossSystem; @@ -127,18 +122,22 @@ in let config = lib.showWarnings configEval.config.warnings configEval.config; # A few packages make a new package set to draw their dependencies from. - # Rather than give `all-packages.nix` all the arguments to this function, - # even ones that don't concern it, we give it this function to "re-call" - # nixpkgs, inheriting whatever arguments it doesn't explicitly provide. This - # way, `all-packages.nix` doesn't know more than it needs to. + # (Currently to get a cross tool chain, or forced-i686 package.) Rather than + # give `all-packages.nix` all the arguments to this function, even ones that + # don't concern it, we give it this function to "re-call" nixpkgs, inheriting + # whatever arguments it doesn't explicitly provide. This way, + # `all-packages.nix` doesn't know more than it needs too. # # It's OK that `args` doesn't include default arguments from this file: # they'll be deterministically inferred. In fact we must *not* include them, # because it's important that if some parameter which affects the default is # substituted with a different argument, the default is re-inferred. # - # To put this in concrete terms, we want the provided non-native `localSystem` - # and `crossSystem` arguments to affect the stdenv chosen. + # To put this in concrete terms, this function is basically just used today to + # use package for a different platform for the current platform (namely cross + # compiling toolchains and 32-bit packages on x86_64). In both those cases we + # want the provided non-native `localSystem` argument to affect the stdenv + # chosen. # # NB!!! This thing gets its `config` argument from `args`, i.e. it's actually # `config0`. It is important to keep it to `config0` format (as opposed to the @@ -147,7 +146,7 @@ in let # via `evalModules` is not idempotent. In other words, if you add `config` to # `newArgs`, expect strange very hard to debug errors! (Yes, I'm speaking from # experience here.) - nixpkgsFun = f0: import ./. (args // f0 args); + nixpkgsFun = newArgs: import ./. (args // newArgs); # Partially apply some arguments for building bootstraping stage pkgs # sets. Only apply arguments which no stdenv would want to override. diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 49034a7384f4..64bc2308f6da 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -180,111 +180,168 @@ let ((config.packageOverrides or (super: {})) super); # Convenience attributes for instantitating package sets. Each of - # these will instantiate a new version of allPackages. - otherPackageSets = let - mkPkgs = name: fn: nixpkgsFun (prevArgs: let nixpkgsArgs = fn prevArgs; in nixpkgsArgs // { - overlays = [ - (self': super': { - "${name}" = super'; - }) - ] ++ nixpkgsArgs.overlays or [] ++ prevArgs.overlays or []; - }); - # This is always cross. - mkCrossPkgs = name: crossAttrs: mkPkgs name (prevArgs: { - crossSystem = - (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // crossAttrs; - }); - # This is only cross when we are already cross, otherwise local. - # For the case of "native cross", i.e. pkgsCross.gnu64 on a x86_64-linux system, we need to adjust **both** - # localSystem **and** crossSystem, otherwise they're out of sync. - mkHybridPkgs = name: hybridAttrs: mkPkgs name (prevArgs: let - newSystem = (lib.systems.systemToAttrs (lib.defaultTo prevArgs.localSystem prevArgs.crossSystem or null)) // hybridAttrs; - in { crossSystem = newSystem; } - // lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform) { localSystem = newSystem; } - ); - in self: super: { + # these will instantiate a new version of allPackages. Currently the + # following package sets are provided: + # + # - pkgsCross. where system is a member of lib.systems.examples + # - pkgsMusl + # - pkgsi686Linux + otherPackageSets = self: super: { # This maps each entry in lib.systems.examples to its own package # set. Each of these will contain all packages cross compiled for # that target system. For instance, pkgsCross.raspberryPi.hello, # will refer to the "hello" package built for the ARM6-based # Raspberry Pi. pkgsCross = lib.mapAttrs (n: crossSystem: - nixpkgsFun (prevArgs: { crossSystem = (lib.systems.systemToAttrs (lib.defaultTo { } prevArgs.crossSystem or null)) // crossSystem; })) + nixpkgsFun { inherit crossSystem; }) lib.systems.examples; - # Bootstrap a cross stdenv using the LLVM toolchain. - # This is currently not possible when compiling natively. - pkgsLLVM = mkCrossPkgs "pkgsLLVM" { - useLLVM = true; - linker = "lld"; + pkgsLLVM = nixpkgsFun { + overlays = [ + (self': super': { + pkgsLLVM = super'; + }) + ] ++ overlays; + # Bootstrap a cross stdenv using the LLVM toolchain. + # This is currently not possible when compiling natively, + # so we don't need to check hostPlatform != buildPlatform. + crossSystem = stdenv.hostPlatform // { + useLLVM = true; + linker = "lld"; + }; }; - # Bootstrap a cross stdenv using LLVM libc. - # This is currently not possible when compiling natively. - pkgsLLVMLibc = mkCrossPkgs "pkgsLLVMLibc" { - config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed); - libc = "llvm"; + pkgsLLVMLibc = nixpkgsFun { + overlays = [ (self': super': { + pkgsLLVMLibc = super'; + })] ++ overlays; + # Bootstrap a cross stdenv using LLVM libc. + # This is currently not possible when compiling natively, + # so we don't need to check hostPlatform != buildPlatform. + crossSystem = stdenv.hostPlatform // { + config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed); + libc = "llvm"; + }; }; - # Bootstrap a cross stdenv using the Aro C compiler. - # This is currently not possible when compiling natively. - pkgsArocc = mkCrossPkgs "pkgsArocc" { - useArocc = true; - linker = "lld"; + pkgsArocc = nixpkgsFun { + overlays = [ + (self': super': { + pkgsArocc = super'; + }) + ] ++ overlays; + # Bootstrap a cross stdenv using the Aro C compiler. + # This is currently not possible when compiling natively, + # so we don't need to check hostPlatform != buildPlatform. + crossSystem = stdenv.hostPlatform // { + useArocc = true; + linker = "lld"; + }; }; - # Bootstrap a cross stdenv using the Zig toolchain. - # This is currently not possible when compiling natively. - pkgsZig = mkCrossPkgs "pkgsZig" { - useZig = true; - linker = "lld"; + pkgsZig = nixpkgsFun { + overlays = [ + (self': super': { + pkgsZig = super'; + }) + ] ++ overlays; + # Bootstrap a cross stdenv using the Zig toolchain. + # This is currently not possible when compiling natively, + # so we don't need to check hostPlatform != buildPlatform. + crossSystem = stdenv.hostPlatform // { + useZig = true; + linker = "lld"; + }; }; # All packages built with the Musl libc. This will override the # default GNU libc on Linux systems. Non-Linux systems are not # supported. 32-bit is also not supported. - pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then mkHybridPkgs "pkgsMusl" { - config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed); + pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then nixpkgsFun { + overlays = [ (self': super': { + pkgsMusl = super'; + })] ++ overlays; + ${if stdenv.hostPlatform == stdenv.buildPlatform + then "localSystem" else "crossSystem"} = { + config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed); + }; } else throw "Musl libc only supports 64-bit Linux systems."; # All packages built for i686 Linux. # Used by wine, firefox with debugging version of Flash, ... - pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then mkHybridPkgs "pkgsi686Linux" { - config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // { - cpu = lib.systems.parse.cpuTypes.i686; - }); + pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun { + overlays = [ (self': super': { + pkgsi686Linux = super'; + })] ++ overlays; + ${if stdenv.hostPlatform == stdenv.buildPlatform + then "localSystem" else "crossSystem"} = { + config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // { + cpu = lib.systems.parse.cpuTypes.i686; + }); + }; } else throw "i686 Linux package set can only be used with the x86 family."; # x86_64-darwin packages for aarch64-darwin users to use with Rosetta for incompatible packages - pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then mkHybridPkgs "pkgsx86_64Darwin" { - config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // { - cpu = lib.systems.parse.cpuTypes.x86_64; - }); + pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then nixpkgsFun { + overlays = [ (self': super': { + pkgsx86_64Darwin = super'; + })] ++ overlays; + localSystem = { + config = lib.systems.parse.tripleFromSystem (stdenv.hostPlatform.parsed // { + cpu = lib.systems.parse.cpuTypes.x86_64; + }); + }; } else throw "x86_64 Darwin package set can only be used on Darwin systems."; # If already linux: the same package set unaltered - # Otherwise, return a linux package set for the current cpu architecture string. + # Otherwise, return a natively built linux package set for the current cpu architecture string. # (ABI and other details will be set to the default for the cpu/os pair) pkgsLinux = if stdenv.hostPlatform.isLinux then self - else mkHybridPkgs "pkgsLinux" { - config = lib.systems.parse.tripleFromSystem (lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux").parsed; + else nixpkgsFun { + localSystem = lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux"; }; + # Extend the package set with zero or more overlays. This preserves + # preexisting overlays. Prefer to initialize with the right overlays + # in one go when calling Nixpkgs, for performance and simplicity. + appendOverlays = extraOverlays: + if extraOverlays == [] + then self + else nixpkgsFun { overlays = args.overlays ++ extraOverlays; }; + + # NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB + # of allocations. DO NOT USE THIS IN NIXPKGS. + # + # Extend the package set with a single overlay. This preserves + # preexisting overlays. Prefer to initialize with the right overlays + # in one go when calling Nixpkgs, for performance and simplicity. + # Prefer appendOverlays if used repeatedly. + extend = f: self.appendOverlays [f]; + # Fully static packages. # Currently uses Musl on Linux (couldn’t get static glibc to work). - pkgsStatic = mkCrossPkgs "pkgsStatic" ({ - isStatic = true; - } // lib.optionalAttrs stdenv.hostPlatform.isLinux { - config = lib.systems.parse.tripleFromSystem (makeMuslParsedPlatform stdenv.hostPlatform.parsed); - } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { - gcc = { abi = "elfv2"; } // stdenv.hostPlatform.gcc or {}; + pkgsStatic = nixpkgsFun ({ + overlays = [ (self': super': { + pkgsStatic = super'; + })] ++ overlays; + crossSystem = { + isStatic = true; + config = lib.systems.parse.tripleFromSystem ( + if stdenv.hostPlatform.isLinux + then makeMuslParsedPlatform stdenv.hostPlatform.parsed + else stdenv.hostPlatform.parsed + ); + gcc = lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { abi = "elfv2"; } // + stdenv.hostPlatform.gcc or {}; + }; }); - pkgsExtraHardening = mkPkgs "pkgsExtraHardening" (_: { + pkgsExtraHardening = nixpkgsFun { overlays = [ (self': super': { + pkgsExtraHardening = super'; stdenv = super'.withDefaultHardeningFlags ( super'.stdenv.cc.defaultHardeningFlags ++ [ "shadowstack" @@ -303,25 +360,8 @@ let pcre-cpp = super'.pcre-cpp.override { enableJit = false; }; pcre16 = super'.pcre16.override { enableJit = false; }; }) - ]; - }); - - # Extend the package set with zero or more overlays. This preserves - # preexisting overlays. Prefer to initialize with the right overlays - # in one go when calling Nixpkgs, for performance and simplicity. - appendOverlays = extraOverlays: - if extraOverlays == [] - then self - else nixpkgsFun (prevArgs: { overlays = prevArgs.overlays ++ extraOverlays; }); - - # NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB - # of allocations. DO NOT USE THIS IN NIXPKGS. - # - # Extend the package set with a single overlay. This preserves - # preexisting overlays. Prefer to initialize with the right overlays - # in one go when calling Nixpkgs, for performance and simplicity. - # Prefer appendOverlays if used repeatedly. - extend = f: self.appendOverlays [f]; + ] ++ overlays; + }; }; # The complete chain of package set builders, applied from top to bottom.