diff --git a/nix/lib.nix b/nix/lib.nix index c204d962..a9bd6882 100644 --- a/nix/lib.nix +++ b/nix/lib.nix @@ -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. @@ -73,7 +76,7 @@ let } else { - system = cfg.hostPlatform; + system = getSystem cfg.hostPlatform; }; in import nixpkgs ( @@ -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; }; }; diff --git a/nix/modules/default.nix b/nix/modules/default.nix index 76147858..46c3df7f 100644 --- a/nix/modules/default.nix +++ b/nix/modules/default.nix @@ -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 { @@ -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 "$@" '';