Merge pull request #256 from numtide/chore/update-nix-vm-test

Update nix-vm-test
This commit is contained in:
Ramses 2025-08-20 23:56:17 +03:00 committed by GitHub
commit c64d185d2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 50 deletions

View file

@ -141,7 +141,7 @@ System Manager is currently only supported on NixOS and Ubuntu. However, it can
} }
``` ```
> \[!WARNING\] > [!WARNING]
> This is unsupported and untested. Use at your own risk. > This is unsupported and untested. Use at your own risk.
## Commercial support ## Commercial support

View file

@ -21,8 +21,8 @@
); );
nix-vm-test-lib = nix-vm-test-lib =
let let
rev = "f01e096295c8ace5f367985e323e3263eb7f9434"; rev = "e34870b8dd2c2d203c05b4f931b8c33eaaf43b81";
sha256 = "sha256:11gqxnhdrpb025wybbb0wmpy2xzjaa6ncs55zbw8i2nzchkzrfvh"; sha256 = "sha256:1qp1fq96kv9i1nj20m25057pfcs1b1c9bj4502xy7gnw8caqr30d";
in in
"${ "${
builtins.fetchTarball { builtins.fetchTarball {

View file

@ -14,53 +14,53 @@
let let
cargoManifest = (lib.importTOML ./Cargo.toml).package; cargoManifest = (lib.importTOML ./Cargo.toml).package;
system-manager-unwrapped = rustPlatform.buildRustPackage { system-manager-unwrapped = rustPlatform.buildRustPackage {
pname = "system-manager"; pname = "system-manager";
version = cargoManifest.version; version = cargoManifest.version;
src = lib.fileset.toSource { src = lib.fileset.toSource {
root = ./.; root = ./.;
fileset = lib.fileset.unions [ fileset = lib.fileset.unions [
./Cargo.toml ./Cargo.toml
./Cargo.lock ./Cargo.lock
./src ./src
./test/rust ./test/rust
];
};
cargoLock.lockFile = ./Cargo.lock;
buildInputs = [ dbus ];
nativeBuildInputs = [
pkg-config
]; ];
nativeCheckInputs = [
clippy
nix
];
preCheck = ''
${lib.getExe cargo} clippy
# Stop the Nix command from trying to create /nix/var/nix/profiles.
#
# https://nix.dev/manual/nix/2.24/command-ref/new-cli/nix3-profile#profiles
export NIX_STATE_DIR=$TMPDIR
'';
}; };
cargoLock.lockFile = ./Cargo.lock;
buildInputs = [ dbus ];
nativeBuildInputs = [
pkg-config
];
nativeCheckInputs = [
clippy
nix
];
preCheck = ''
${lib.getExe cargo} clippy
# Stop the Nix command from trying to create /nix/var/nix/profiles.
#
# https://nix.dev/manual/nix/2.24/command-ref/new-cli/nix3-profile#profiles
export NIX_STATE_DIR=$TMPDIR
'';
};
in in
runCommand "system-manager" runCommand "system-manager"
{ {
nativeBuildInputs = [ makeBinaryWrapper ]; nativeBuildInputs = [ makeBinaryWrapper ];
passthru = { passthru = {
# The unwrapped version takes nix from the PATH, it will fail if nix # The unwrapped version takes nix from the PATH, it will fail if nix
# cannot be found. # cannot be found.
# The wrapped version has a reference to the nix store path, so nix is # The wrapped version has a reference to the nix store path, so nix is
# part of its runtime closure. # part of its runtime closure.
unwrapped = system-manager-unwrapped; unwrapped = system-manager-unwrapped;
}; };
} }
'' ''
makeWrapper \ makeWrapper \
${system-manager-unwrapped}/bin/system-manager \ ${system-manager-unwrapped}/bin/system-manager \
$out/bin/system-manager \ $out/bin/system-manager \
--prefix PATH : ${lib.makeBinPath [ nix ]} --prefix PATH : ${lib.makeBinPath [ nix ]}
'' ''