summary refs log tree commit diff
path: root/pkgs/os-specific/linux/systemd/default.nix
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-02-02 18:57:21 +0200
committerArtturin <Artturin@artturin.com>2023-02-02 18:57:58 +0200
commit1db242213092dc1ba1038edbe0bb5660d0fb5e00 (patch)
tree7f0ec24086d16b5d258f1d10033d7ff294a336d4 /pkgs/os-specific/linux/systemd/default.nix
parent2142bc8d338fcaa05c739016349d1acce4f4c836 (diff)
downloadnixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.tar
nixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.tar.gz
nixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.tar.bz2
nixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.tar.lz
nixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.tar.xz
nixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.tar.zst
nixpkgs-1db242213092dc1ba1038edbe0bb5660d0fb5e00.zip
systemd: disallowedReferences nativeBuildInputs
add cross to passthru.tests to prevent cross breaking
Diffstat (limited to 'pkgs/os-specific/linux/systemd/default.nix')
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index b1b6644a60e..f1f6bfb6f0a 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -3,6 +3,7 @@
 { stdenv
 , lib
 , nixosTests
+, pkgsCross
 , fetchFromGitHub
 , fetchpatch
 , fetchzip
@@ -63,6 +64,7 @@
 , withKexectools ? lib.meta.availableOn stdenv.hostPlatform kexec-tools
 , kexec-tools
 , bashInteractive
+, bash
 , libmicrohttpd
 , libfido2
 , p11-kit
@@ -139,7 +141,7 @@ let
   #     jq '.created_at|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime'
   releaseTimestamp = "1667246393";
 in
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   inherit pname version;
 
   # We use systemd/systemd-stable for src, and ship NixOS-specific patches inside nixpkgs directly
@@ -362,6 +364,7 @@ stdenv.mkDerivation {
       docbook_xsl
       docbook_xml_dtd_42
       docbook_xml_dtd_45
+      bash
       (buildPackages.python3Packages.python.withPackages (ps: with ps; [ lxml jinja2 ]))
     ]
     ++ lib.optionals withLibBPF [
@@ -382,6 +385,7 @@ stdenv.mkDerivation {
       libuuid
       linuxHeaders
       pam
+      bashInteractive # for patch shebangs
     ]
 
     ++ lib.optional wantGcrypt libgcrypt
@@ -695,6 +699,10 @@ stdenv.mkDerivation {
     mv $out/dont-strip-me $out/lib/systemd/boot/efi
   '';
 
+  disallowedReferences = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform)
+    # 'or p' is for manually specified buildPackages as they dont have __spliced
+    (builtins.map (p: p.__spliced.buildHost or p) finalAttrs.nativeBuildInputs);
+
   passthru = {
     # The interface version prevents NixOS from switching to an
     # incompatible systemd at runtime.  (Switching across reboots is
@@ -708,6 +716,7 @@ stdenv.mkDerivation {
 
     tests = {
       inherit (nixosTests) switchTest;
+      cross = pkgsCross.aarch64-multiplatform.systemd;
     };
   };
 
@@ -722,4 +731,4 @@ stdenv.mkDerivation {
     priority = 10;
     maintainers = with maintainers; [ flokli kloenk mic92 ];
   };
-}
+})