MatthewCroughan / nixinate

Another NixOS Deployment Tool - Nixinate your systems 🕶️
MIT License
240 stars 32 forks source link

error: 'apps.nixinate' is not an attribute set #44

Closed mrVanDalo closed 1 year ago

mrVanDalo commented 1 year ago

I get the error when I run nix flake show with the (adjusted) Example from the README. I'm using nix version : nix (Nix) 2.15.1

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
    nixinate.url = "github:matthewcroughan/nixinate";
  };
  outputs = { self, nixpkgs, nixinate }: {
    apps = nixinate.nixinate.x86_64-linux self;
    nixosConfigurations = {
      myMachine = nixpkgs.lib.nixosSystem {
        modules = [
          {
            _module.args.nixinate = {
              host = "itchy.scratchy.com";
              sshUser = "root";
              buildOn = "remote"; # valid args are "local" or "remote"
              substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s"
              hermetic = false;
            };
          }
        ];
      };
    };
  };
}

The error is :

git+file:///home/palo/dev/nixos/nixos-config?dir=nixinate
├───apps
│   └───nixinate
error: 'apps.nixinate' is not an attribute set
CRTified commented 1 year ago

The one thing missing is the system for the nixpkgs.lib.nixosSystem call. While your flake gives the error you show, this here works fine:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
    nixinate.url = "github:matthewcroughan/nixinate";
  };
  outputs = { self, nixpkgs, nixinate }: {
    apps = nixinate.nixinate.x86_64-linux self;
    nixosConfigurations = {
      myMachine = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          {
            _module.args.nixinate = {
              host = "itchy.scratchy.com";
              sshUser = "root";
              buildOn = "remote"; # valid args are "local" or "remote"
              substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s"
              hermetic = false;
            };
          }
        ];
      };
    };
  };
}

With this change, I get:

git+file:///tmp/test
├───apps
│   └───nixinate
│       ├───myMachine: app
│       └───myMachine-dry-run: app
└───nixosConfigurations
    └───myMachine: NixOS configuration
mrVanDalo commented 1 year ago

That works, ... thank you.