diff --git a/README.md b/README.md index 8b16318bfc6857..990d8a53e202f2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@
@@ -74,7 +74,7 @@ Community contributions are always welcome through GitHub Issues and Pull Requests. For more information about contributing to the project, please visit -the [contributing page](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md). +the [contributing page](CONTRIBUTING.md). # Donations diff --git a/doc/doc-support/package.nix b/doc/doc-support/package.nix index ca4694f3d11c8e..e763f82efd7c92 100644 --- a/doc/doc-support/package.nix +++ b/doc/doc-support/package.nix @@ -5,6 +5,8 @@ lib, stdenvNoCC, callPackage, + devmode, + mkShellNoCC, documentation-highlighter, nixos-render-docs, nixpkgs ? { }, @@ -95,10 +97,14 @@ stdenvNoCC.mkDerivation ( pythonInterpreterTable = callPackage ./python-interpreter-table.nix { }; - shell = callPackage ../../pkgs/tools/nix/web-devmode.nix { - buildArgs = "./."; - open = "/share/doc/nixpkgs/manual.html"; - }; + shell = + let + devmode' = devmode.override { + buildArgs = "./."; + open = "/share/doc/nixpkgs/manual.html"; + }; + in + mkShellNoCC { packages = [ devmode' ]; }; tests.manpage-urls = callPackage ../tests/manpage-urls.nix { }; }; diff --git a/nixos/doc/manual/shell.nix b/nixos/doc/manual/shell.nix index 7765358ddb3280..aeec93118fc01e 100644 --- a/nixos/doc/manual/shell.nix +++ b/nixos/doc/manual/shell.nix @@ -6,8 +6,11 @@ let common = import ./common.nix; inherit (common) outputPath indexPath; + devmode = pkgs.devmode.override { + buildArgs = "../../release.nix -A manualHTML.${builtins.currentSystem}"; + open = "/${outputPath}/${indexPath}"; + }; in -pkgs.callPackage ../../../pkgs/tools/nix/web-devmode.nix { - buildArgs = "../../release.nix -A manualHTML.${builtins.currentSystem}"; - open = "/${outputPath}/${indexPath}"; +pkgs.mkShellNoCC { + packages = [ devmode ]; } diff --git a/nixos/modules/services/development/athens.md b/nixos/modules/services/development/athens.md index 2795930b0a029d..6f8181561913ac 100644 --- a/nixos/modules/services/development/athens.md +++ b/nixos/modules/services/development/athens.md @@ -37,7 +37,7 @@ If you want to prevent Athens from writing to disk, you can instead configure it } ``` -To use the local proxy in Go builds, you can set the proxy as environment variable: +To use the local proxy in Go builds (outside of `nix`), you can set the proxy as environment variable: ```nix { @@ -47,6 +47,21 @@ To use the local proxy in Go builds, you can set the proxy as environment variab } ``` -It is currently not possible to use the local proxy for builds done by the Nix daemon. This might be enabled -by experimental features, specifically [`configurable-impure-env`](https://nixos.org/manual/nix/unstable/contributing/experimental-features#xp-feature-configurable-impure-env), -in upcoming Nix versions. +To also use the local proxy for Go builds happening in `nix` (with `buildGoModule`), the nix daemon can be configured to pass the GOPROXY environment variable to the `goModules` fixed-output derivation. + +This can either be done via the nix-daemon systemd unit: + +```nix +{ + systemd.services.nix-daemon.environment.GOPROXY = "http://localhost:3000"; +} +``` + +or via the [impure-env experimental feature](https://nix.dev/manual/nix/2.24/command-ref/conf-file#conf-impure-env): + +```nix +{ + nix.settings.experimental-features = [ "configurable-impure-env" ]; + nix.settings.impure-env = "GOPROXY=http://localhost:3000"; +} +``` diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix index 1915fef59cc44a..e3fadf592925d8 100644 --- a/nixos/modules/system/boot/systemd/initrd.nix +++ b/nixos/modules/system/boot/systemd/initrd.nix @@ -482,6 +482,9 @@ in { # so NSS can look up usernames "${pkgs.glibc}/lib/libnss_files.so.2" + + # Resolving sysroot symlinks without code exec + "${pkgs.chroot-realpath}/bin/chroot-realpath" ] ++ optionals cfg.package.withCryptsetup [ # fido2 support "${cfg.package}/lib/cryptsetup/libcryptsetup-token-systemd-fido2.so" @@ -522,7 +525,7 @@ in { script = /* bash */ '' set -uo pipefail - export PATH="/bin:${cfg.package.util-linux}/bin" + export PATH="/bin:${cfg.package.util-linux}/bin:${pkgs.chroot-realpath}/bin" # Figure out what closure to boot closure= @@ -543,7 +546,7 @@ in { # Resolve symlinks in the init parameter. We need this for some boot loaders # (e.g. boot.loader.generationsDir). - closure="$(chroot /sysroot ${pkgs.coreutils}/bin/realpath "$closure")" + closure="$(chroot-realpath /sysroot "$closure")" # Assume the directory containing the init script is the closure. closure="$(dirname "$closure")" @@ -578,14 +581,10 @@ in { ]; services.initrd-nixos-activation = { - requires = [ - config.boot.initrd.systemd.services.initrd-find-nixos-closure.name - ]; - after = [ - "initrd-fs.target" - config.boot.initrd.systemd.services.initrd-find-nixos-closure.name - ]; - requiredBy = [ "initrd.target" ]; + after = [ "initrd-switch-root.target" ]; + requiredBy = [ "initrd-switch-root.service" ]; + before = [ "initrd-switch-root.service" ]; + unitConfig.DefaultDependencies = false; unitConfig = { AssertPathExists = "/etc/initrd-release"; RequiresMountsFor = [ diff --git a/nixos/modules/system/etc/etc-activation.nix b/nixos/modules/system/etc/etc-activation.nix index 944920e9233529..733166a9175eb7 100644 --- a/nixos/modules/system/etc/etc-activation.nix +++ b/nixos/modules/system/etc/etc-activation.nix @@ -139,10 +139,10 @@ closure="$(realpath /nixos-closure)" - metadata_image="$(chroot /sysroot ${lib.getExe' pkgs.coreutils "realpath"} "$closure/etc-metadata-image")" + metadata_image="$(${pkgs.chroot-realpath}/bin/chroot-realpath /sysroot "$closure/etc-metadata-image")" ln -s "/sysroot$metadata_image" /etc-metadata-image - basedir="$(chroot /sysroot ${lib.getExe' pkgs.coreutils "realpath"} "$closure/etc-basedir")" + basedir="$(${pkgs.chroot-realpath}/bin/chroot-realpath /sysroot "$closure/etc-basedir")" ln -s "/sysroot$basedir" /etc-basedir ''; }; diff --git a/pkgs/applications/terminal-emulators/kitty/default.nix b/pkgs/applications/terminal-emulators/kitty/default.nix index cab3a2103a546b..70bb01e9346f02 100644 --- a/pkgs/applications/terminal-emulators/kitty/default.nix +++ b/pkgs/applications/terminal-emulators/kitty/default.nix @@ -28,6 +28,8 @@ , go_1_23 , buildGo123Module , nix-update-script +, makeBinaryWrapper +, autoSignDarwinBinariesHook }: with python3Packages; @@ -85,9 +87,11 @@ buildPythonApplication rec { sphinx-inline-tabs go_1_23 fontconfig + makeBinaryWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ imagemagick libicns # For the png2icns tool. + autoSignDarwinBinariesHook ] ++ lib.optionals stdenv.hostPlatform.isLinux [ wayland-scanner ]; diff --git a/pkgs/applications/video/mkvtoolnix/default.nix b/pkgs/applications/video/mkvtoolnix/default.nix index 54fa98268a6f63..a180694e98db9e 100644 --- a/pkgs/applications/video/mkvtoolnix/default.nix +++ b/pkgs/applications/video/mkvtoolnix/default.nix @@ -99,8 +99,7 @@ stdenv.mkDerivation rec { zlib ] ++ optionals withGUI [ cmark ] - ++ optionals stdenv.hostPlatform.isLinux [ qtwayland ] - ++ optionals stdenv.hostPlatform.isDarwin [ libiconv ]; + ++ optionals stdenv.hostPlatform.isLinux [ qtwayland ]; # autoupdate is not needed but it silences a ton of pointless warnings postPatch = '' diff --git a/pkgs/by-name/ba/baidupcs-go/package.nix b/pkgs/by-name/ba/baidupcs-go/package.nix index bc02fbf837290e..42ef4255d7c08b 100644 --- a/pkgs/by-name/ba/baidupcs-go/package.nix +++ b/pkgs/by-name/ba/baidupcs-go/package.nix @@ -1,22 +1,26 @@ { + fetchFromGitHub, buildGo122Module, lib, - fetchFromGitHub, versionCheckHook, }: buildGo122Module rec { pname = "baidupcs-go"; - version = "3.9.5"; + version = "3.9.5-unstable-2024-06-23"; src = fetchFromGitHub { owner = "qjfoidnh"; repo = "BaiduPCS-Go"; - rev = "v${version}"; - hash = "sha256-zNodRQzflOOB3hAeq4KbjRFlHQwknVy+4ucipUcoufY="; + rev = "5612fc337b9556ed330274987a2f876961639cff"; + hash = "sha256-4mCJ5gVHjjvR6HNo47NTJvQEu7cdZZMfO8qQA7Kqzqo="; }; vendorHash = "sha256-msTlXtidxLTe3xjxTOWCqx/epFT0XPdwGPantDJUGpc="; doCheck = false; + ldflags = [ + "-X main.Version=${version}" + ]; + nativeInstallCheckInputs = [ versionCheckHook ]; @@ -24,10 +28,10 @@ buildGo122Module rec { versionCheckProgram = "${placeholder "out"}/bin/${meta.mainProgram}"; meta = { + mainProgram = "BaiduPCS-Go"; maintainers = with lib.maintainers; [ xddxdd ]; description = "Baidu Netdisk commandline client, mimicking Linux shell file handling commands"; homepage = "https://github.com/qjfoidnh/BaiduPCS-Go"; license = lib.licenses.asl20; - mainProgram = "BaiduPCS-Go"; }; } diff --git a/pkgs/by-name/ch/chroot-realpath/package.nix b/pkgs/by-name/ch/chroot-realpath/package.nix new file mode 100644 index 00000000000000..af537cb48e45aa --- /dev/null +++ b/pkgs/by-name/ch/chroot-realpath/package.nix @@ -0,0 +1,21 @@ +{ + lib, + rustPlatform, +}: + +let + cargo = lib.importTOML ./src/Cargo.toml; +in +rustPlatform.buildRustPackage { + pname = cargo.package.name; + version = cargo.package.version; + + src = ./src; + + cargoLock.lockFile = ./src/Cargo.lock; + + meta = { + description = "Output a path's realpath within a chroot."; + maintainers = [ lib.maintainers.elvishjerricco ]; + }; +} diff --git a/pkgs/by-name/ch/chroot-realpath/src/Cargo.lock b/pkgs/by-name/ch/chroot-realpath/src/Cargo.lock new file mode 100644 index 00000000000000..d00f13df1877ab --- /dev/null +++ b/pkgs/by-name/ch/chroot-realpath/src/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "chroot-realpath" +version = "0.1.0" diff --git a/pkgs/by-name/ch/chroot-realpath/src/Cargo.toml b/pkgs/by-name/ch/chroot-realpath/src/Cargo.toml new file mode 100644 index 00000000000000..52348e7596e9c9 --- /dev/null +++ b/pkgs/by-name/ch/chroot-realpath/src/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "chroot-realpath" +version = "0.1.0" +edition = "2021" + +[dependencies] + +[profile.release] +opt-level = "z" diff --git a/pkgs/by-name/ch/chroot-realpath/src/src/main.rs b/pkgs/by-name/ch/chroot-realpath/src/src/main.rs new file mode 100644 index 00000000000000..4e7873bf079880 --- /dev/null +++ b/pkgs/by-name/ch/chroot-realpath/src/src/main.rs @@ -0,0 +1,24 @@ +use std::env; +use std::io::{stdout, Error, ErrorKind, Write}; +use std::os::unix::ffi::OsStrExt; +use std::os::unix::fs; + +fn main() -> std::io::Result<()> { + let args: Vec$1- " +