aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

use `home-manager` inside nixosConfigurations in a Flake #23

Closed aleeusgr closed 1 year ago

aleeusgr commented 1 year ago

I got this:

To use home-manager inside nixosConfigurations in a Flake, put home-manager in your inputs and in your configuration modules import home-manager.nixosModules.home-manager, then you can use it as above.

so I added home-manager to flake.nix:

https://github.com/aleeusgr/nix-things/blob/c6183b2ddf34b4d5f512024bd5fe1729e22fcb70/flake.nix#L29-L34

What should be here:

https://github.com/aleeusgr/nix-things/blob/1879eb8f7e0876f7229626c31e3a7126ead1c3c3/outputs/home-conf.nix#L2-L8

The problem is:

14:40 $ systemctl status "home-manager-$USER.service"
Unit home-manager-alex.service could not be found.

Originally posted by @aleeusgr in https://github.com/aleeusgr/nix-things/issues/11#issuecomment-1336840920

aleeusgr commented 1 year ago

https://nix-community.github.io/home-manager/index.html#sec-install-nixos-module https://mipmip.github.io/home-manager-option-search/

aleeusgr commented 1 year ago

//TODO: https://github.com/aleeusgr/nix-things/blob/1879eb8f7e0876f7229626c31e3a7126ead1c3c3/outputs/home-conf.nix#L53-L77

aleeusgr commented 1 year ago

comparing to https://github.com/harryprayiv/nix-config

flake.nix is similar;

https://github.com/harryprayiv/nix-config/blob/8c589a464114b6e6d8efd5e42804f2e8f2c5a9b6/flake.nix#L54-L68

/outputs/nixos-conf.nix is the same; https://github.com/harryprayiv/nix-config/blob/8c589a464114b6e6d8efd5e42804f2e8f2c5a9b6/outputs/nixos-conf.nix#L7-L14

Look at https://github.com/aleeusgr/nix-things/blob/7d81d2af34cdcbbd3e92ebd66dd871e789480153/flake.nix#L32

aleeusgr commented 1 year ago

https://github.com/divnix/digga

aleeusgr commented 1 year ago

https://github.com/jordanisaacs/homeage

aleeusgr commented 1 year ago

K900 (bcachefs when):

Basically if you want it to be integrated in your NixOS config and not built separately, you want to add home-manager.nixosModules.default into your NixOS config's imports (where home-manager is the flake input) and then set home-manager.users.k900.imports = [ ./home.nix ]

(replace with your username and paths, of course)