# Nix tmpactivator This is mostly for learning purposes. This is a lightweight home directory activator with home-manager like interface to home file linking. ## How this works Internally a `tmpfiles.d` file is made. This file is then activated using `systemd-tmpfiles` command. It's of course possible to put this file to normal locations that are ran on system startup to activate it on boot. `config.tmpfiles.activationPackage` is the package you want to use for activation. The binary file to activate is `bin/activate`. To remove the files use `bin/deactivate`. CAUTION: the deactivation will remove even files that were not created by the tool. Activation will override files that already exist and were not created by this tool! Make sure that you are not going to override anything. ## Options For home files, use `home.file`. The interface is the same as for NixOS `environment.etc`. `home.user` and `home.group` should be configured. `home.homeDirectory` is exposed as well and is set to `/home/${config.home.user}` by default. ## Example flake ```nix { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.tmpactivator.url = "github:Rutherther/nix-tmpactivator"; # I recommend using tmpactivator with your nixpkgs revision. # Tmpactivator is using things from nixpkgs that do not change # so often. inputs.tmpactivator.inputs.nixpkgs.follows = "nixpkgs"; outputs = { self, nixpkgs, tmpactivator }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; environment = tmpactivator.lib.mkTmpActivator { inherit pkgs; modules = [ { home = { user = "ruther"; group = "users"; file."testing".text = "Hello world!"; }; systemd.services.test = { script = '' echo "Hello world!" ''; }; } ]; }; in { packages.${system} = { default = self.packages.${system}.activationPackage; activationPackage = environment.config.tmpfiles.instances.home.activationPackage; }; }; } ``` Then to activate the files, run `nix run .#activationPackage`.