Compare commits

..

1 commit

Author SHA1 Message Date
b784c94d42
WIP: Build image from scratch / without NixOS.
An experiment to see if we can minimize the PatOS project even further,
and not have to adapt NixOS packages and config for our needs.
2025-02-14 13:07:01 +01:00
3 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nikstur <nikstur@outlook.com>
Date: Mon, 6 Nov 2023 22:51:38 +0100
Subject: [PATCH] meson.build: do not create systemdstatedir
---
meson.build | 1 -
1 file changed, 1 deletion(-)
diff --git a/meson.build b/meson.build
index bffda86845..cb5dcec0f9 100644
--- a/meson.build
+++ b/meson.build
@@ -2781,7 +2781,6 @@ install_data('LICENSE.GPL2',
install_subdir('LICENSES',
install_dir : docdir)
-install_emptydir(systemdstatedir)
#####################################################################

View file

@ -3,6 +3,7 @@
lib,
pkgs,
stdenv,
targetPackages,
...
}:
let
@ -29,7 +30,12 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-GvRn55grHWR6M+tA86RMzqinuXNpPZzRB4ApuGN/ZvU=";
};
patches = [
./0017-meson.build-do-not-create-systemdstatedir.patch
];
nativeBuildInputs = with pkgs; [
bash
pkg-config
makeBinaryWrapper
gperf
@ -61,6 +67,13 @@ stdenv.mkDerivation (finalAttrs: {
buildPackages.llvmPackages.libllvm
];
outputs = [
"out"
"dev"
];
separateDebugInfo = true;
autoPatchelfFlags = [ "--keep-libc" ];
hardeningDisable = [
@ -113,7 +126,47 @@ stdenv.mkDerivation (finalAttrs: {
mesonBuildType = "release";
doCheck = false; # fails a bunch of tests
preConfigure = ''
mesonFlagsArray+=(-Dntp-servers="0.europe.pool.ntp.org 1.europe.pool.ntp.org 2.europe.pool.ntp.org 3.europe.pool.ntp.org")
export LC_ALL="en_US.UTF-8";
'';
postPatch =
''
substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/"
''
+ ''
substituteInPlace meson.build \
--replace "find_program('clang'" "find_program('${stdenv.cc.targetPrefix}clang'"
''
+ ''
substituteInPlace src/ukify/ukify.py \
--replace \
"'readelf'" \
"'${targetPackages.stdenv.cc.bintools.targetPrefix}readelf'" \
--replace \
"/usr/lib/systemd/boot/efi" \
"$out/lib/systemd/boot/efi"
''
# Finally, patch shebangs in scripts used at build time. This must not patch
# scripts that will end up in the output, to avoid build platform references
# when cross-compiling.
+ ''
shopt -s extglob
patchShebangs tools test src/!(rpm|kernel-install|ukify) src/kernel-install/test-kernel-install.sh
'';
# trigger the test -n "$DESTDIR" || mutate in upstreams build system
preInstall = ''
export DESTDIR=/
'';
mesonFlags = [
"--prefix=${placeholder "out"}"
# Options
# We bump this attribute on every (major) version change to ensure that we
@ -129,6 +182,17 @@ stdenv.mkDerivation (finalAttrs: {
(lib.mesonOption "mode" "release")
(lib.mesonOption "tty-gid" "3") # tty in NixOS has gid 3
(lib.mesonOption "debug-shell" "${pkgs.bashInteractive}/bin/bash")
(lib.mesonOption "pamconfdir" "${placeholder "out"}/etc/pam.d")
(lib.mesonOption "shellprofiledir" "${placeholder "out"}/etc/profile.d")
(lib.mesonOption "kmod-path" "${pkgs.kmod}/bin/kmod")
(lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
(lib.mesonOption "dbussessionservicedir" "${placeholder "out"}/share/dbus-1/services")
(lib.mesonOption "dbussystemservicedir" "${placeholder "out"}/share/dbus-1/system-services")
# pkgconfig
(lib.mesonOption "pkgconfiglibdir" "${placeholder "dev"}/lib/pkgconfig")
(lib.mesonOption "pkgconfigdatadir" "${placeholder "dev"}/share/pkgconfig")
# SBAT
(lib.mesonOption "sbat-distro" "patos")
(lib.mesonOption "sbat-distro-summary" "PatOS")

1
systemd/result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/jw8923rfwly76yb8ynp5r65cvg4g9m0f-systemd-257.3