mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
Compare commits
2 commits
40b8c7465f
...
27696cac81
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27696cac81 | ||
|
|
a25bb0ab27 |
2 changed files with 26 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ let
|
||||||
rawModule = evalModules {
|
rawModule = evalModules {
|
||||||
modules = [ configModule ] ++ nodModules;
|
modules = [ configModule ] ++ nodModules;
|
||||||
specialArgs = extraSpecialArgs;
|
specialArgs = extraSpecialArgs;
|
||||||
|
class = "nixOnDroid";
|
||||||
};
|
};
|
||||||
|
|
||||||
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);
|
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);
|
||||||
|
|
|
||||||
25
tests/on-device/config-class.bats
Normal file
25
tests/on-device/config-class.bats
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Copyright (c) 2023, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||||
|
|
||||||
|
load lib
|
||||||
|
|
||||||
|
@test 'successfully loads a config with _class="nixOnDroid"' {
|
||||||
|
# set up / build / activate the configuration
|
||||||
|
echo '{ config.system.stateVersion = "24.05"; _class = "nixOnDroid"; }' > ~/.config/nixpkgs/nix-on-droid.nix
|
||||||
|
_sed -e "s|<<FLAKE_URL>>|$FLAKE_URL|g" -e "s|<<SYSTEM>>|$(detect_system)|g" \
|
||||||
|
"$ON_DEVICE_TESTS_DIR/config-flake.nix" \
|
||||||
|
> ~/.config/nixpkgs/flake.nix
|
||||||
|
|
||||||
|
nix-on-droid switch --flake ~/.config/nixpkgs#device
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'fails to load a config with _class="nixos"' {
|
||||||
|
# set up / build / activate the configuration
|
||||||
|
echo '{ config.system.stateVersion = "24.05"; _class = "nixos"; }' > ~/.config/nixpkgs/nix-on-droid.nix
|
||||||
|
_sed -e "s|<<FLAKE_URL>>|$FLAKE_URL|g" -e "s|<<SYSTEM>>|$(detect_system)|g" \
|
||||||
|
"$ON_DEVICE_TESTS_DIR/config-flake.nix" \
|
||||||
|
> ~/.config/nixpkgs/flake.nix
|
||||||
|
|
||||||
|
# check that networking.hosts can't map localhost
|
||||||
|
run nix-on-droid switch --flake ~/.config/nixpkgs#device
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue