From c4365ef01032035c650c1ddd60096f7ebbab4b0d Mon Sep 17 00:00:00 2001 From: Tobias Happ Date: Mon, 3 Oct 2022 14:07:03 +0200 Subject: [PATCH] environment.path: add support for nix profile --- CHANGELOG.md | 1 + README.md | 3 --- modules/environment/path.nix | 8 ++++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a2ea75..d4d4caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Refactored project for flakes usage (still supporting non-flake setups on device, but bootstrap zip ball creation and running tests via fakedroid requires flake setup) +* Add support for `nix profile` managed profiles ## Release 22.05 diff --git a/README.md b/README.md index bd299ad..921f31c 100644 --- a/README.md +++ b/README.md @@ -161,9 +161,6 @@ you shouldn't need a binary cache for that. **Note:** Nix flake support is still experimental at the moment and subject to change. -Do not run `nix profile` because this will render your environment incompatible with `nix-on-droid` as it relies on -`nix-env`. - ### Examples / templates A minimal example could look like the following: diff --git a/modules/environment/path.nix b/modules/environment/path.nix index c987e90..2c9d3a5 100644 --- a/modules/environment/path.nix +++ b/modules/environment/path.nix @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE. +# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. { config, lib, pkgs, ... }: @@ -37,7 +37,11 @@ in config = { build.activation.installPackages = '' - $DRY_RUN_CMD nix-env --install ${cfg.path} + if [[ -e "${config.user.home}/.nix-profile/manifest.json" ]]; then + $DRY_RUN_CMD nix profile install ${cfg.path} + else + $DRY_RUN_CMD nix-env --install ${cfg.path} + fi ''; environment = {