From 3f92b3f13ba6ff567db8b192815ffb02234bc179 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Fri, 22 Dec 2023 19:28:01 +0800 Subject: [PATCH] activationSripts: add previous var value (closes #6) --- flake.nix | 21 ++++++++++++--------- not-os.patch | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 not-os.patch diff --git a/flake.nix b/flake.nix index d7ca700..9a67a71 100644 --- a/flake.nix +++ b/flake.nix @@ -8,17 +8,20 @@ outputs = { self, nixpkgs, not-os }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; - not-os-patches = [ - { - # Zynq image various fixes and cleanup - url = "https://patch-diff.githubusercontent.com/raw/cleverca22/not-os/pull/28.patch"; - sha256 = "sha256-EnYb95QfwHmUHfbCT9tL291mC8Tze0Koadb11arvTDY="; - } - ]; - patched-not-os = pkgs.applyPatches { + + patched-not-os = let + remote-patches = [ + { + # Zynq image various fixes and cleanup + url = "https://patch-diff.githubusercontent.com/raw/cleverca22/not-os/pull/28.patch"; + sha256 = "sha256-EnYb95QfwHmUHfbCT9tL291mC8Tze0Koadb11arvTDY="; + } + ]; + local-patches = [ ./not-os.patch ]; + in pkgs.applyPatches { name = "not-os-patched"; src = not-os; - patches = map pkgs.fetchpatch not-os-patches; + patches = map pkgs.fetchpatch remote-patches ++ local-patches; }; gnu-platform = "arm-none-eabi"; diff --git a/not-os.patch b/not-os.patch new file mode 100644 index 0000000..05e9093 --- /dev/null +++ b/not-os.patch @@ -0,0 +1,28 @@ +diff --git a/base.nix b/base.nix +index 7eaee32..b5a61ee 100644 +--- a/base.nix ++++ b/base.nix +@@ -155,7 +155,23 @@ with lib; + # dummy to make setup-etc happy + ''; + system.activationScripts.etc = stringAfter [ "users" "groups" ] config.system.build.etcActivationCommands; ++ # Re-apply deprecated var value due to systemd preference in recent nixpkgs ++ # See https://github.com/NixOS/nixpkgs/commit/59e37267556eb917146ca3110ab7c96905b9ffbd ++ system.activationScripts.var = lib.mkForce '' ++ # Various log/runtime directories. + ++ mkdir -p /var/tmp ++ chmod 1777 /var/tmp ++ ++ # Empty, immutable home directory of many system accounts. ++ mkdir -p /var/empty ++ # Make sure it's really empty ++ ${pkgs.e2fsprogs}/bin/chattr -f -i /var/empty || true ++ find /var/empty -mindepth 1 -delete ++ chmod 0555 /var/empty ++ chown root:root /var/empty ++ ${pkgs.e2fsprogs}/bin/chattr -f +i /var/empty || true ++ ''; + # nix-build -A system.build.toplevel && du -h $(nix-store -qR result) --max=0 -BM|sort -n + system.build.toplevel = pkgs.runCommand "not-os" { + activationScript = config.system.activationScripts.script; \ No newline at end of file