environment.path: add support for nix profile

This commit is contained in:
Tobias Happ 2022-10-03 14:07:03 +02:00
parent 2d73773ed7
commit c4365ef010
3 changed files with 7 additions and 5 deletions

View file

@ -10,6 +10,7 @@
* Refactored project for flakes usage (still supporting non-flake setups on * Refactored project for flakes usage (still supporting non-flake setups on
device, but bootstrap zip ball creation and running tests via fakedroid device, but bootstrap zip ball creation and running tests via fakedroid
requires flake setup) requires flake setup)
* Add support for `nix profile` managed profiles
## Release 22.05 ## Release 22.05

View file

@ -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. **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 ### Examples / templates
A minimal example could look like the following: A minimal example could look like the following:

View file

@ -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, ... }: { config, lib, pkgs, ... }:
@ -37,7 +37,11 @@ in
config = { config = {
build.activation.installPackages = '' build.activation.installPackages = ''
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} $DRY_RUN_CMD nix-env --install ${cfg.path}
fi
''; '';
environment = { environment = {