Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

include NixOS current system bin & sbin paths in DEFAULT_PATH* #25

Closed
wants to merge 1 commit into from

Conversation

andir
Copy link
Member

@andir andir commented Nov 1, 2018

systemd started filtering environment variables of generators and
changes PATH to DEFAULT_PATH. This change adds paths that we are using
to the constants while still allowing fallback to the "standard"
FHS-style locations (e.g. inside constainers, on non-nixos systems, ...).

I am not entirely sure about the impact of this change beyond fixing the PATH that is propagated towards generators (like systemd-fstab-generator).

From the looks of it this is really just touching how systemd itself calls and discovers binaries for things like fsck.

cc @fpletz

systemd started filtering environment variables of generators and
changes PATH to DEFAULT_PATH. This change adds paths that we are using
to the constants while still allowing fallback to the "standard"
FHS-style locations (e.g. inside constainers, on non-nixos systems, ...).
@andir
Copy link
Member Author

andir commented Nov 2, 2018

I tested this by compiling the tested attribute of release-combined.nix on latest 18.09 with the following diff:

diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index 2a17a0a2875..074ba214af8 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -24,10 +24,10 @@ in stdenv.mkDerivation rec {
   # When updating, use https://github.com/systemd/systemd-stable tree, not the development one!
   # Also fresh patches should be cherry-picked from that tree to our current one.
   src = fetchFromGitHub {
-    owner = "NixOS";
+    owner = "andir";
     repo = "systemd";
-    rev = "nixos-v${version}";
-    sha256 = "1rzl0iqrpa4ajvama5k3cb3yc7893c55kzcxkl3cyavpdzsw5505";
+    rev = "e674dcb7e5e5d6c03f59c2f94530de1150c4e913";
+    sha256 = "17jxib7rghprifl4d23y7l76ivlj09cflvv0pliq1a4rkpl7mkfy";
   };
diff --git a/nixos/tests/hibernate.nix b/nixos/tests/hibernate.nix
index 274aa7becc8..18c285297a1 100644
--- a/nixos/tests/hibernate.nix
+++ b/nixos/tests/hibernate.nix
@@ -6,6 +6,7 @@ import ./make-test.nix (pkgs: {
   nodes = {
     machine = { config, lib, pkgs, ... }: with lib; {
       virtualisation.emptyDiskImages = [ config.virtualisation.memorySize ];
+      boot.kernelParams = [ "resume" ];

       systemd.services.backdoor.conflicts = [ "sleep.target" ];

The resume changes are required since logind now expects the kernel commandline to contain the resume or noresume keyword otherwise it doesn't allow hibernation :/

I am not sure what the best way to deal with this is. We could add that to kernelParams whenever we see a non-empty list of swapDevices?

@ckauhaus
Copy link

ckauhaus commented Nov 2, 2018

15:06 <ckauhaus> why can't we pull in fsPackagePath? 
15:06 <ckauhaus> this path is expected to change not so often
15:06 <ckauhaus> this is how it is done today
15:07 <ckauhaus> or do I miss some important point?
15:07 <ckauhaus> I'd rather tolerate a rebuild of the generators when I mess around with fsPackages instead of having systemd whatever happens to be in systemPackages
15:07 <ckauhaus> this is what your PR is going to achieve, right?
15:08 <andi-> It is not a rebuild of generators. It is a rebuild of the entire system (well everything that depends on systemd in some way)
15:08 <ckauhaus> this is what it does today, right?
15:09 <ckauhaus> hmm
15:09 <andi-> no
15:09 <ckauhaus> just wire up the path in the generator units?
15:09 <andi-> there are no units for them
15:09 <andi-> systemd executes everything from the generators directory
15:09 <ckauhaus> so is there really no way of putting the path in some config file instead of compiling it into the binary?
15:10 <andi-> we can add some code to systemd that reads it
15:10 <ckauhaus> would perhaps be a better hack than relying on systemPackages

@andir
Copy link
Member Author

andir commented Nov 2, 2018

I implemented an alternative approach here: https://github.com/andir/systemd/commits/nixos-v239-test

It also passes all release tests on 18.09 so at least the previous regressions are also done.

@ckauhaus
Copy link

ckauhaus commented Nov 5, 2018

I think the alternative approach is better and this ticket should be closed.

@andir andir closed this Dec 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants