oddlama / nix-topology

🍁 Generate infrastructure and network diagrams directly from your NixOS configurations
https://oddlama.github.io/nix-topology
MIT License
576 stars 25 forks source link

Can't render topology via nix build #31

Closed maxutka99 closed 4 months ago

maxutka99 commented 4 months ago

I use flake.nix from example in readme nixos-rebuild successfully build the system configuration

% nix build .#topology.self.config.output error: flake 'path:/home/gnt/src/gnc-topology' does not provide attribute 'packages.x86_64-linux.topology.self.config.output', 'legacyPackages.x86_64-linux.topology.self.config.output' or 'topology.self.config.output'

oddlama commented 4 months ago

Can you show your full flake? This looks like you didn't actually include the relevant output in your configuration

maxutka99 commented 4 months ago
{
  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nix-topology.url = "github:oddlama/nix-topology";
    nix-topology.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, flake-utils, nixpkgs, nix-topology, home-manager, ... }: {
    # Example. Use your own hosts and add the module to them
    nixosConfigurations.ryzen = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ./hosts/ryzen
        home-manager.nixosModules.home-manager {
            home-manager = {
#            extraSpecialArgs = { inherit inputs; };
            useGlobalPkgs = true;
            useUserPackages = true;
          };
        }
        nix-topology.nixosModules.default
      ];
    };
  }
  // flake-utils.lib.eachDefaultSystem (system: rec {
    pkgs = import nixpkgs {
      inherit system;
      overlays = [ nix-topology.overlays.default ];
    };

    topology = import nix-topology {
      inherit pkgs;
      modules = [
        # Your own file to define global topology. Works in principle like a nixos module but uses different options.
        ./topology.nix
        # Inline module to inform topology of your existing NixOS hosts.
        { nixosConfigurations = self.nixosConfigurations; }
      ];
    };
  });
}
oddlama commented 4 months ago

Ah you probably want to run nix build .#topology.x86_64-linux.config.output

maxutka99 commented 4 months ago

thanks, now it works