Nixpkgs/Reviewing changes: Difference between revisions

imported>Artturin
flakes doesn't allow relative path inputs anymore
imported>Artturin
add cross-compiling of modules
Line 129: Line 129:
       type = "app";
       type = "app";
       program = "${self.defaultPackage.x86_64-linux}/bin/run-nixos-vm";
       program = "${self.defaultPackage.x86_64-linux}/bin/run-nixos-vm";
    };
  };
}
</syntaxhighlight>
==== Testing the cross-compilation of modules ====
For example
an improved version can be found at https://github.com/NixOS/nixpkgs/pull/142273#issuecomment-948225922
<syntaxHighlight lang=console>
$ nix build .#nixosConfigurations.nixos.config.services.xserver.displayManager.sessionData.desktops
</syntaxHighlight>
<syntaxhighlight lang="nix">
{
  inputs = {
    nixpkgs.url = "github:ju1m/nixpkgs/display-managers";
  };
  outputs = inputs@{ self, nixpkgs }: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ({ pkgs, lib, config, ... }: {
          nixpkgs.crossSystem = lib.systems.examples.aarch64-multiplatform;
          services.xserver = {
            enable = true;
            desktopManager.session = [
              { name = "home-manager";
                start = ''
                  ${pkgs.runtimeShell} $HOME/.hm-xsession &
                  waitPID=$!
                '';
                bgSupport = true;
              }
            ];
          };
        })
      ];
     };
     };
   };
   };
}
}
</syntaxhighlight>
</syntaxhighlight>