New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using home-manager during nixos install #1154
Comments
+1 |
I don't understand what you want to achieve. If you just want your config on the shell to install, you can build your own ISO, which includes home-manager. home-manager needs a directory wich is not auto created at first boot, so you should include an activation Script like This: {
system.activationScripts = {
base-dirs = {
text = ''
mkdir -p /nix/var/nix/profiles/per-user/kloenk
'';
deps = [ ];
};
};
} |
@Kloenk I'm new to this so bear that in mind, but: When installing nixos I boot from external media, prepare the disk, then generate the Perhaps using home-manager at install-time isn't supposed to work, I don't really know. With this ticket I'm trying to find out. |
I'm still not sure what you want to do. You could create a file like this, and execute nix-build to build your own ISO: let
nixos = import <nixpkgs/nixos> {
configuration = { pkgs, lib, ... }: {
imports = [
((fetchTarball
"https://github.com/rycee/home-manager/archive/master.tar.gz")
+ "/nixos")
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
];
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
networking.hostName = "kexec";
users.users.eyeinsky = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" ];
shell = pkgs.fish;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBps9Mp/xZax8/y9fW1Gt73SkskcBux1jDAB8rv0EYUt cardno:000611120054"
];
packages = with pkgs; [
wget
nload
htop
ripgrep
git
gptfdisk
nix-prefetch-git
pass
pass-otp
gopass
sl
neofetch
];
};
# create dirs for home-manager
system.activationScripts = {
base-dirs = {
text = ''
mkdir -p /nix/var/nix/profiles/per-user/kloenk
'';
deps = [ ];
};
};
};
};
in nixos.config.system.build.isoImage |
What I would like to do is have home-manager create the home folder for me. Perhaps this is out of scope, etc. but in general that's what I would like to do. If I do Would this be good new feature to be added? Edit: I use home-manager as a nixos module like this:
I think home-manager is fetched while |
I think this is a duplicate of #948. Home manager populates you home manager. But only after it is ready to install things. The home directory itself is created by nixos, if you set users.users.name.isNormalsUser = true. nixos-install and nixos-rebuild do very similar things. And if you run nixos-rebuild boot, your homemanager also doesn't get started. |
I'm still not clear as to whether having home-manager enabled as a module in your Meaning in a brand new install, still in the live ISO, having |
@austinbutler strictly speaking: no. But I never tried what @Kloenk proposed above: to create the profile folder manually ( |
Is the idea creating Where I am at right now is home-manager works for configuring the live ISO itself, but I get a strange "file or folder not found" error when trying to install NixOS from the booted live ISO USB. The file not found is a VS Code extension, and it references |
If Home Manager is installed side-by-side with NixOS, I think you would need to chroot /mnt for the install script / flake configuration to work correctly. |
I'm using it as a module in both the live ISO and the installed system. It kept complaining about the same VS Code extension (even though the same config works fine on my other systems that share the same config), so for now I've commented out the VS Code home-manager config and am re-running the install. It's still running and hasn't died yet... |
Well it did work. I guess the file not found error was maybe a red herring. After installation I rebooted, logged in as root, then checked and the normal user folder existed and has my tmux.conf in it as expected. I did not have to use the creating a profile file workaround as suggested earlier, which I was assuming was the case since it seemed a fix had been merged a while back. To sum up, I was able to make a live ISO that configured some things for the default nixos user and I was also able to install NixOS with home manager as a module. Does that mean this issue can be closed? |
@austinbutler Just to sum up/clarify, you were installing NixOS, had booted from a USD stick, had a configuration.nix ready with a line |
For the ISO I have this in {
imports = [
((fetchTarball
"https://github.com/rycee/home-manager/archive/master.tar.gz") + "/nixos")
];
} Then the normal |
@austinbutler You made the ISO to boot&install from yourself? Do you think that is required for home-manager to work at install time? (I.e can't I just install home-manager while being booted from the ISO?) |
Yeah I created my own ISO. I don't know whether it's required unfortunately. |
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting. If you are the original author of the issue
If you are not the original author of the issue
Memorandum on closing issuesIf you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort. |
1 similar comment
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting. If you are the original author of the issue
If you are not the original author of the issue
Memorandum on closing issuesIf you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort. |
is it possible to use home-manager during installing nixos from an usb stick? I.e when I have booted from an usb stick and the to-be-root is mounted to
/mnt
?The text was updated successfully, but these errors were encountered: