Set the system path to a fixed location.
This commit is contained in:
parent
d5f138f939
commit
ce4b4bcf8b
2 changed files with 64 additions and 11 deletions
|
|
@ -8,10 +8,52 @@
|
|||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
environment.etc."profile.d/system-manager-path.sh".source =
|
||||
pkgs.writeShellScript "system-manager-path.sh" ''
|
||||
export PATH=${lib.makeBinPath config.environment.systemPackages}:''${PATH}
|
||||
'';
|
||||
};
|
||||
config =
|
||||
let
|
||||
pathDir = "/run/system-manager/sw";
|
||||
in
|
||||
{
|
||||
environment.etc = {
|
||||
"profile.d/system-manager-path.sh".source =
|
||||
pkgs.writeText "system-manager-path.sh" ''
|
||||
export PATH=${pathDir}/bin/:''${PATH}
|
||||
'';
|
||||
|
||||
# TODO: figure out how to properly add fish support. We could start by
|
||||
# looking at what NixOS and HM do to set up the fish env.
|
||||
#"fish/conf.d/system-manager-path.fish".source =
|
||||
# pkgs.writeTextFile {
|
||||
# name = "system-manager-path.fish";
|
||||
# executable = true;
|
||||
# text = ''
|
||||
# set -gx PATH "${pathDir}/bin/" $PATH
|
||||
# '';
|
||||
# };
|
||||
};
|
||||
|
||||
systemd.services.system-manager-path = {
|
||||
enable = true;
|
||||
description = "";
|
||||
wantedBy = [ "system-manager.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script =
|
||||
let
|
||||
pathDrv = pkgs.buildEnv {
|
||||
name = "system-manager-path";
|
||||
paths = config.environment.systemPackages;
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
in
|
||||
''
|
||||
mkdir --parents $(dirname "${pathDir}")
|
||||
if [ -L "${pathDir}" ]; then
|
||||
unlink "${pathDir}"
|
||||
fi
|
||||
ln --symbolic --force "${pathDrv}" "${pathDir}"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,12 +50,18 @@ let
|
|||
|
||||
services.nginx.enable = false;
|
||||
|
||||
environment.etc = {
|
||||
foo_new = {
|
||||
text = ''
|
||||
This is just a test!
|
||||
'';
|
||||
environment = {
|
||||
etc = {
|
||||
foo_new = {
|
||||
text = ''
|
||||
This is just a test!
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemPackages = [
|
||||
pkgs.fish
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
|
|
@ -258,9 +264,14 @@ forEachUbuntuImage
|
|||
node1.succeed("/system-manager-profile/bin/activate 2>&1 | tee /tmp/output.log")
|
||||
node1.succeed("grep -vF 'ERROR' /tmp/output.log")
|
||||
node1.wait_for_unit("system-manager.target")
|
||||
node1.wait_for_unit("system-manager-path.service")
|
||||
|
||||
node1.succeed("bash --login -c 'realpath $(which rg) | grep -F ${hostPkgs.ripgrep}/bin/rg'")
|
||||
node1.succeed("bash --login -c 'realpath $(which fd) | grep -F ${hostPkgs.fd}/bin/fd'")
|
||||
|
||||
node1.succeed("${newConfig}/bin/activate 2>&1 | tee /tmp/output.log")
|
||||
node1.succeed("grep -vF 'ERROR' /tmp/output.log")
|
||||
node1.succeed("bash --login -c 'realpath $(which fish) | grep -F ${hostPkgs.fish}/bin/fish'")
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue