1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-11-13 04:56:53 +03:00

installer: add post check

This commit is contained in:
Daiderd Jordan 2018-01-16 23:51:39 +01:00
parent d4b34322c5
commit c2728318fb
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
3 changed files with 34 additions and 11 deletions

View File

@ -7,13 +7,6 @@ matrix:
- nix-build ./release.nix -I darwin=. -A tests
- nix-build ./release.nix -I darwin=. -A examples.simple
- yes | nix-shell -A installer
- /run/current-system/sw/bin/darwin-rebuild switch -I darwin=$HOME/.nix-defexpr/channels/darwin -I darwin-config=$HOME/.nixpkgs/darwin-configuration.nix
- yes | nix-shell -A uninstaller
- os: osx
osx_image: xcode7.3 # 10.11
script:
- nix-build ./release.nix -I darwin=. -A tests
- nix-build ./release.nix -I darwin=. -A examples.simple
- yes | nix-shell -A installer
- nix-shell -A installer.check
- /run/current-system/sw/bin/darwin-rebuild switch -I darwin=$HOME/.nix-defexpr/channels/darwin -I darwin-config=$HOME/.nixpkgs/darwin-configuration.nix
- yes | nix-shell -A uninstaller

View File

@ -5,7 +5,7 @@ with lib;
{
imports = [ <user-darwin-config> ];
# NOTE: don't set this outside of the instaler.
# NOTE: don't set this outside of the installer.
users.nix.configureBuildUsers = true;
users.knownGroups = [ "nixbld" ];
users.knownUsers = [ "nixbld1" "nixbld2" "nixbld3" "nixbld4" "nixbld5" "nixbld6" "nixbld7" "nixbld8" "nixbld9" "nixbld10" ];

View File

@ -1,4 +1,4 @@
{ stdenv, nix, pkgs }:
{ stdenv, writeScript, nix, pkgs }:
let
nixPath = stdenv.lib.concatStringsSep ":" [
@ -21,7 +21,6 @@ stdenv.mkDerivation {
'';
shellHook = ''
#!/usr/bin/env bash
set -e
action=switch
@ -76,4 +75,35 @@ stdenv.mkDerivation {
echo >&2
exit
'';
passthru.check = stdenv.mkDerivation {
name = "run-darwin-test";
shellHook = ''
set -e
echo >&2 "running installer tests..."
echo >&2
echo >&2 "checking configuration.nix"
test -f ~/.nixpkgs/darwin-configuration.nix
test -w ~/.nixpkgs/darwin-configuration.nix
echo >&2 "checking darwin channel"
readlink ~/.nix-defexpr/channels/darwin
test -e ~/.nix-defexpr/channels/darwin
echo >&2 "checking /etc"
readlink /etc/static
test -e /etc/static
grep /etc/static/bashrc /etc/bashrc
grep -v nix-daemon.sh /etc/profile
echo >&2 "checking /run/current-system"
readlink /run
test -e /run
readlink /run/current-system
test -e /run/current-system
echo >&2 "checking profile"
readlink /nix/var/nix/profiles/system
test -e /nix/var/nix/profiles/system
echo >&2 ok
exit
'';
};
}