summary refs log blame commit diff
path: root/nixos/tests/containers-custom-pkgs.nix
blob: 47509892e52e226d98873c48a31c73d23b6a3c68 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                      
                                  



                                 







                                      
        
      
    

                 

                                           
                                                                                                                          


     
import ./make-test-python.nix ({ pkgs, lib, ...} : let

  customPkgs = pkgs // {
    hello = pkgs.hello.overrideAttrs(old: {
      name = "custom-hello";
    });
  };

in {
  name = "containers-custom-pkgs";
  meta = with lib.maintainers; {
    maintainers = [ adisbladis ];
  };

  machine = { ... }: {
    containers.test = {
      autoStart = true;
      pkgs = customPkgs;
      config = {pkgs, config, ... }: {
        environment.systemPackages = [
          pkgs.hello
        ];
      };
    };
  };

  testScript = ''
    machine.wait_for_unit("default.target")
    machine.succeed(
        "test $(nixos-container run test -- readlink -f /run/current-system/sw/bin/hello) = ${customPkgs.hello}/bin/hello"
    )
  '';
})