Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nix/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ let
Set `allowUnsupportedNixpkgs = true;` in `makeSystemConfig` to bypass this check.
'';

# Returns the system string from a nixpkgs.
getSystem = cfg: if cfg.hostPlatform ? system then cfg.hostPlatform.system else cfg.hostPlatform;

self = {
# Function that can be used when defining inline modules to get better location
# reporting in module-system errors.
Expand Down Expand Up @@ -73,7 +76,7 @@ let
}
else
{
system = cfg.hostPlatform;
system = getSystem cfg.hostPlatform;
};
in
import nixpkgs (
Expand Down Expand Up @@ -106,7 +109,7 @@ let
system-manager = pkgs.callPackage ./packages/wrapper.nix {
system-manager-unwrapped = pkgs.callPackage ../package.nix { };
};
userborn = userborn.packages.${config.nixpkgs.hostPlatform}.default;
userborn = userborn.packages.${getSystem config.nixpkgs}.default;
};
};

Expand Down
7 changes: 5 additions & 2 deletions nix/modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
{
nixpkgs = {
buildPlatform = lib.mkOption {
type = types.str;
type = with types; either str attrs;
example = "x86_64-linux";
default = config.nixpkgs.hostPlatform;
description = "The platform on which we are building the system configuration.";
};

hostPlatform = lib.mkOption {
Expand Down Expand Up @@ -265,7 +266,9 @@
'';

deactivationScript = pkgs.writeShellScript "deactivate" ''
export PATH="$PATH:${lib.makeBinPath [ config.services.userborn.package ]}"
export PATH="$PATH:${
lib.makeBinPath (lib.optionals config.services.userborn.enable [ config.services.userborn.package ])
}"
${system-manager}/bin/system-manager-engine deactivate "$@"
'';

Expand Down