Compare commits
1 Commits
auth-daemo
...
debian-vm-
| Author | SHA1 | Date | |
|---|---|---|---|
|
3b25fe54e4
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,6 +9,7 @@ result-*
|
|||||||
|
|
||||||
# Nix VM
|
# Nix VM
|
||||||
*.qcow2
|
*.qcow2
|
||||||
|
.nixos-test-history
|
||||||
|
|
||||||
# Packaging
|
# Packaging
|
||||||
!/assets/debian/config.toml
|
!/assets/debian/config.toml
|
||||||
|
|||||||
21
flake.lock
generated
21
flake.lock
generated
@@ -15,6 +15,26 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-vm-test": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1763976673,
|
||||||
|
"narHash": "sha256-QPeI8WR+brwodiy4YNfOnLI7rOHJfFPrGm+xT/HmtT4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-vm-test",
|
||||||
|
"rev": "8611bdd7a49750a880be9ee2ea9f68c53f8c9299",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-vm-test",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768127708,
|
"lastModified": 1768127708,
|
||||||
@@ -34,6 +54,7 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
|
"nix-vm-test": "nix-vm-test",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,12 @@
|
|||||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
crane.url = "github:ipetkov/crane";
|
crane.url = "github:ipetkov/crane";
|
||||||
|
|
||||||
|
nix-vm-test.url = "github:numtide/nix-vm-test";
|
||||||
|
nix-vm-test.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, rust-overlay, crane }:
|
outputs = { self, nixpkgs, rust-overlay, crane, nix-vm-test }:
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
@@ -95,6 +98,8 @@
|
|||||||
muscl = import ./nix/module.nix;
|
muscl = import ./nix/module.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# vmlib = forAllSystems(system: _: _: nix-vm-test.lib.${system});
|
||||||
|
|
||||||
packages = forAllSystems (system: pkgs: _:
|
packages = forAllSystems (system: pkgs: _:
|
||||||
let
|
let
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
@@ -130,6 +135,8 @@
|
|||||||
filteredSource = pkgs.runCommandLocal "filtered-source" { } ''
|
filteredSource = pkgs.runCommandLocal "filtered-source" { } ''
|
||||||
ln -s ${src} $out
|
ln -s ${src} $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
debianVm = import ./nix/debian-vm-configuration.nix { inherit nix-vm-test nixpkgs system pkgs; };
|
||||||
});
|
});
|
||||||
|
|
||||||
checks = forAllSystems (system: pkgs: _: {
|
checks = forAllSystems (system: pkgs: _: {
|
||||||
|
|||||||
49
nix/debian-vm-configuration.nix
Normal file
49
nix/debian-vm-configuration.nix
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{ nix-vm-test, nixpkgs, system, pkgs, ... }:
|
||||||
|
let
|
||||||
|
image = nix-vm-test.lib.${system}.debian.images."13";
|
||||||
|
|
||||||
|
generic = import "${nix-vm-test}/generic" { inherit pkgs nixpkgs; inherit (pkgs) lib; };
|
||||||
|
|
||||||
|
makeVmTestForImage =
|
||||||
|
image:
|
||||||
|
{
|
||||||
|
testScript,
|
||||||
|
sharedDirs ? {},
|
||||||
|
diskSize ? null,
|
||||||
|
config ? { }
|
||||||
|
}:
|
||||||
|
generic.makeVmTest {
|
||||||
|
inherit
|
||||||
|
system
|
||||||
|
testScript
|
||||||
|
sharedDirs;
|
||||||
|
image = nix-vm-test.lib.${system}.debian.prepareDebianImage {
|
||||||
|
inherit diskSize;
|
||||||
|
hostPkgs = pkgs;
|
||||||
|
originalImage = image;
|
||||||
|
};
|
||||||
|
machineConfigModule = config;
|
||||||
|
};
|
||||||
|
|
||||||
|
vmTest = makeVmTestForImage image {
|
||||||
|
diskSize = "10G";
|
||||||
|
sharedDirs = {
|
||||||
|
debDir = {
|
||||||
|
source = "${./.}";
|
||||||
|
target = "/mnt";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
testScript = ''
|
||||||
|
vm.wait_for_unit("multi-user.target")
|
||||||
|
vm.succeed("apt-get update && apt-get -y install mariadb-server build-essential curl")
|
||||||
|
vm.succeed("curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y")
|
||||||
|
vm.succeed("source /root/.cargo/env && cargo install cargo-deb")
|
||||||
|
vm.succeed("cp -r /mnt /root/src && chmod -R +w /root/src")
|
||||||
|
vm.succeed("source /root/.cargo/env && cd /root/src && ./create-deb.sh")
|
||||||
|
'';
|
||||||
|
config.nodes.vm = {
|
||||||
|
virtualisation.memorySize = 8192;
|
||||||
|
virtualisation.cpus = 4;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in vmTest.driverInteractive
|
||||||
Reference in New Issue
Block a user