From f44974320f16c6f33fd521cda6967e019ae7fefb Mon Sep 17 00:00:00 2001 From: Rutherther Date: Thu, 1 Aug 2024 19:54:54 +0200 Subject: [PATCH] docs: update to newest revision --- README.md | 25 +++++++++++++++++++------ modules/home.nix | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 924779a..7a64bc1 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,21 @@ 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. Maybe it would be better to just symlink manually at this point... +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. +`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. +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 @@ -18,6 +25,10 @@ For home files, use `home.file`. The interface is the same as for NixOS `environ { 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 @@ -45,9 +56,11 @@ For home files, use `home.file`. The interface is the same as for NixOS `environ in { packages.${system} = { default = self.packages.${system}.activationPackage; - activationPackage = environment.config.tmpfiles.activationPackage; + activationPackage = environment.config.tmpfiles.instances.home.activationPackage; }; }; } ``` + +Then to activate the files, run `nix run .#activationPackage`. diff --git a/modules/home.nix b/modules/home.nix index f389aed..3c73d93 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -90,6 +90,8 @@ in { target = "${config.home.homeDirectory}/${name}"; }) homeFiles)); + # This is from home-manager, see + # https://github.com/nix-community/home-manager/blob/6e090576c4824b16e8759ebca3958c5b09659ee8/modules/files.nix#L285 home.homeFilesPackage = pkgs.runCommandLocal "home-files" { nativeBuildInputs = [ pkgs.xorg.lndir ]; } -- 2.48.1