From d3aee544b686a72b2bb7eeb379f72c6b6b2665b7 Mon Sep 17 00:00:00 2001 From: Nicolas Berbiche Date: Fri, 28 Aug 2020 09:42:05 -0400 Subject: targets.darwin: add module Currently, this module makes sure that `/Applications` directories for packages in `home.packages` get linked into the user's environment. --- tests/default.nix | 4 +++- tests/modules/targets-darwin/darwin.nix | 20 ++++++++++++++++++++ tests/modules/targets-darwin/default.nix | 1 + tests/modules/targets-linux/default.nix | 1 + tests/modules/targets-linux/generic-linux.nix | 19 +++++++++++++++++++ tests/modules/targets/default.nix | 1 - tests/modules/targets/generic-linux.nix | 19 ------------------- 7 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 tests/modules/targets-darwin/darwin.nix create mode 100644 tests/modules/targets-darwin/default.nix create mode 100644 tests/modules/targets-linux/default.nix create mode 100644 tests/modules/targets-linux/generic-linux.nix delete mode 100644 tests/modules/targets/default.nix delete mode 100644 tests/modules/targets/generic-linux.nix (limited to 'tests') diff --git a/tests/default.nix b/tests/default.nix index 02afd5a2518..b44e4185fcc 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -69,6 +69,8 @@ import nmt { ./modules/programs/zplug ./modules/programs/zsh ./modules/xresources + ] ++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [ + ./modules/targets-darwin ] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [ ./meta # Suffices to run on one platform. ./modules/misc/debug @@ -93,6 +95,6 @@ import nmt { ./modules/services/window-managers/i3 ./modules/services/window-managers/sway ./modules/systemd - ./modules/targets + ./modules/targets-linux ]); } diff --git a/tests/modules/targets-darwin/darwin.nix b/tests/modules/targets-darwin/darwin.nix new file mode 100644 index 00000000000..511ae87fd98 --- /dev/null +++ b/tests/modules/targets-darwin/darwin.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + darwinTestApp = pkgs.runCommandLocal "target-darwin-example-app" { } '' + mkdir -p $out/Applications + touch $out/Applications/example-app + ''; + +in { + config = { + home.packages = [ darwinTestApp ]; + + nmt.script = '' + assertFileExists 'home-files/Applications/Home Manager Apps/example-app' + ''; + }; +} diff --git a/tests/modules/targets-darwin/default.nix b/tests/modules/targets-darwin/default.nix new file mode 100644 index 00000000000..479f586eef3 --- /dev/null +++ b/tests/modules/targets-darwin/default.nix @@ -0,0 +1 @@ +{ targets-darwin = ./darwin.nix; } diff --git a/tests/modules/targets-linux/default.nix b/tests/modules/targets-linux/default.nix new file mode 100644 index 00000000000..e13617ccb74 --- /dev/null +++ b/tests/modules/targets-linux/default.nix @@ -0,0 +1 @@ +{ targets-generic-linux = ./generic-linux.nix; } diff --git a/tests/modules/targets-linux/generic-linux.nix b/tests/modules/targets-linux/generic-linux.nix new file mode 100644 index 00000000000..d9bb85b651a --- /dev/null +++ b/tests/modules/targets-linux/generic-linux.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + targets.genericLinux.enable = true; + + nmt.script = '' + assertFileExists home-path/etc/profile.d/hm-session-vars.sh + assertFileContains \ + home-path/etc/profile.d/hm-session-vars.sh \ + 'export XDG_DATA_DIRS="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share:/home/hm-user/.nix-profile/share''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"' + assertFileContains \ + home-path/etc/profile.d/hm-session-vars.sh \ + '. "${pkgs.nix}/etc/profile.d/nix.sh"' + ''; + }; +} diff --git a/tests/modules/targets/default.nix b/tests/modules/targets/default.nix deleted file mode 100644 index e13617ccb74..00000000000 --- a/tests/modules/targets/default.nix +++ /dev/null @@ -1 +0,0 @@ -{ targets-generic-linux = ./generic-linux.nix; } diff --git a/tests/modules/targets/generic-linux.nix b/tests/modules/targets/generic-linux.nix deleted file mode 100644 index d9bb85b651a..00000000000 --- a/tests/modules/targets/generic-linux.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -{ - config = { - targets.genericLinux.enable = true; - - nmt.script = '' - assertFileExists home-path/etc/profile.d/hm-session-vars.sh - assertFileContains \ - home-path/etc/profile.d/hm-session-vars.sh \ - 'export XDG_DATA_DIRS="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share:/home/hm-user/.nix-profile/share''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"' - assertFileContains \ - home-path/etc/profile.d/hm-session-vars.sh \ - '. "${pkgs.nix}/etc/profile.d/nix.sh"' - ''; - }; -} -- cgit v1.2.3