mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
add support for default configuration in flake.nix
This commit is contained in:
parent
ffac515cfb
commit
6a345626c0
9 changed files with 51 additions and 13 deletions
17
tests/on-device/config-flake-default.nix
Normal file
17
tests/on-device/config-flake-default.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
description = "nix-on-droid configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05";
|
||||
nix-on-droid.url = "<<FLAKE_URL>>";
|
||||
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { nix-on-droid, ... }: {
|
||||
nixOnDroidConfigurations = {
|
||||
default = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
modules = [ ./nix-on-droid.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
|
||||
load lib
|
||||
|
||||
@test 'flake example works' {
|
||||
function flake_example() {
|
||||
local flake_url="$1"
|
||||
local flake_file_name="$2"
|
||||
|
||||
# assertions to verify initial state is as expected
|
||||
assert_command vi
|
||||
assert_no_command unzip
|
||||
|
|
@ -15,10 +18,10 @@ load lib
|
|||
> ~/.config/nixpkgs/nix-on-droid.nix
|
||||
|
||||
_sed "s|<<FLAKE_URL>>|$FLAKE_URL|g" \
|
||||
"$ON_DEVICE_TESTS_DIR/config-flake.nix" \
|
||||
"$ON_DEVICE_TESTS_DIR/$flake_file_name" \
|
||||
> ~/.config/nixpkgs/flake.nix
|
||||
|
||||
nix-on-droid switch --flake ~/.config/nixpkgs#device
|
||||
nix-on-droid switch --flake "$flake_url"
|
||||
|
||||
# test presence of several crucial commands
|
||||
assert_command nix-on-droid nix-shell bash
|
||||
|
|
@ -32,3 +35,11 @@ load lib
|
|||
assert_command vi
|
||||
assert_no_command unzip
|
||||
}
|
||||
|
||||
@test 'flake example works' {
|
||||
flake_example ~/.config/nixpkgs#device config-flake.nix
|
||||
}
|
||||
|
||||
@test 'flake with default config works' {
|
||||
flake_example ~/.config/nixpkgs config-flake-default.nix
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue