NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.87k stars 364 forks source link

build fails if home directory does not exist on local machine [nixops 1.7] #1419

Closed ymarkus closed 3 years ago

ymarkus commented 4 years ago

Sorry, accidentally pressed the enter key while writing the title.

So, I'm trying to deploy to a machine where I create the user "vmail". Here's the relevant code:

{ [...]
  users = {
    groups = {
      vmail = {};
    };
    users.vmail = {
      home = /home/vmail;
      group = "vmail";
      createHome = true;
      isSystemUser = true;
      shell = /run/current-system/sw/bin/nologin;
    };
  };
[...] }

If the path /home/vmail is not present on my local machine the build fails with the following error:

building all machine configurations...
error: getting attributes of path '/home/vmail': No such file or directory
(use '--show-trace' to show detailed location information)
Traceback (most recent call last):
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/bin/..nixops-wrapped-wrapped", line 991, in <module>
    args.op()
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/bin/..nixops-wrapped-wrapped", line 412, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1052, in run_with_notify
    f()
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in <lambda>
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1003, in _deploy
    self.configs_path = self.build_configs(dry_run=dry_run, repair=repair, include=include, exclude=exclude)
  File "/nix/store/j3vqsivlfjw0jxdxvbgqqz1mapfram2h-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 671, in build_configs
    raise Exception("unable to build all machine configurations")
Exception: unable to build all machine configurations

if I run # mkdir /home/vmail on my local machine before running deploy, it works without issues.

ymarkus commented 4 years ago

Some more information: local machine:

❯ nixops --version
NixOps 1.7
❯ nix --version
nix (Nix) 2.3.7
❯ nixos-version
20.09.1721.896270d629e (Nightingale)

remote machine:

❯ nixos-version
20.09.1818.98e46cec92f (Nightingale)
❯ nix --version
nix (Nix) 2.3.7
ymarkus commented 3 years ago

Just revisited this and found my error: Didn't quote the home path: /home/vmail. Closing this.