# Solving Imperative to Declarative for nix-env

**URL:** https://discourse.nixos.org/t/solving-imperative-to-declarative-for-nix-env/57260
**Category:** Development
**Created:** [December 11, 2024, 1:12pm UTC](https://discourse.nixos.org/t/solving-imperative-to-declarative-for-nix-env/57260 "2024-12-11T13:12:12Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![rnhmjoj](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rnhmjoj/32/1792_2.png) [@rnhmjoj](https://discourse.nixos.org/u/rnhmjoj)
#### Post date: [December 14, 2024, 9:00am UTC](https://discourse.nixos.org/t/solving-imperative-to-declarative-for-nix-env/57260/15 "2024-12-14T09:00:37Z")

</div>

> I’d also like to have a better way to manage environments on Non-NixOS systems. Home-Manager is often too much for new users and the ergonomics of nix-env and nix profile are not terribly good.

You can use nix-env in a declarative fashion to manage an environment much like home-manager but without all the complexity of NixOS modules. See this:

> [@First time trying NixOS, random questions](https://discourse.nixos.org/t/first-time-trying-nixos-random-questions/32677/11):
>
> It’s little known, but you can install packages declaratively even with nix-env. It’s much simpler than setting up home-manager. Here’s how: create a packages.nix file with with import \<nixpkgs\> {}; [hello # packages here] run nix-env -irf packages.nix: packages listed in the file will be installed, all packages not listed will be removed. change packages.nix, rerun the command and the changes will be applied.

---

_[View the full topic](https://discourse.nixos.org/t/solving-imperative-to-declarative-for-nix-env/57260)._
