mirror of
https://github.com/nix-community/home-manager
synced 2024-11-05 02:39:45 +01:00
targets.darwin: add module
Currently, this module makes sure that `/Applications` directories for packages in `home.packages` get linked into the user's environment.
This commit is contained in:
parent
bd4c2b0651
commit
d3aee544b6
7 changed files with 39 additions and 1 deletions
|
@ -189,6 +189,7 @@ let
|
||||||
(loadModule ./services/xscreensaver.nix { })
|
(loadModule ./services/xscreensaver.nix { })
|
||||||
(loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./systemd.nix { })
|
(loadModule ./systemd.nix { })
|
||||||
|
(loadModule ./targets/darwin.nix { condition = hostPlatform.isDarwin; })
|
||||||
(loadModule ./targets/generic-linux.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./targets/generic-linux.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./xcursor.nix { })
|
(loadModule ./xcursor.nix { })
|
||||||
(loadModule ./xresources.nix { })
|
(loadModule ./xresources.nix { })
|
||||||
|
|
14
modules/targets/darwin.nix
Normal file
14
modules/targets/darwin.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
||||||
|
# Install MacOS applications to the user environment.
|
||||||
|
home.file."Applications/Home Manager Apps".source = let
|
||||||
|
apps = pkgs.buildEnv {
|
||||||
|
name = "home-manager-applications";
|
||||||
|
paths = config.home.packages;
|
||||||
|
pathsToLink = "/Applications";
|
||||||
|
};
|
||||||
|
in "${apps}/Applications";
|
||||||
|
};
|
||||||
|
}
|
|
@ -69,6 +69,8 @@ import nmt {
|
||||||
./modules/programs/zplug
|
./modules/programs/zplug
|
||||||
./modules/programs/zsh
|
./modules/programs/zsh
|
||||||
./modules/xresources
|
./modules/xresources
|
||||||
|
] ++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
|
||||||
|
./modules/targets-darwin
|
||||||
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
||||||
./meta # Suffices to run on one platform.
|
./meta # Suffices to run on one platform.
|
||||||
./modules/misc/debug
|
./modules/misc/debug
|
||||||
|
@ -93,6 +95,6 @@ import nmt {
|
||||||
./modules/services/window-managers/i3
|
./modules/services/window-managers/i3
|
||||||
./modules/services/window-managers/sway
|
./modules/services/window-managers/sway
|
||||||
./modules/systemd
|
./modules/systemd
|
||||||
./modules/targets
|
./modules/targets-linux
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
20
tests/modules/targets-darwin/darwin.nix
Normal file
20
tests/modules/targets-darwin/darwin.nix
Normal file
|
@ -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'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
1
tests/modules/targets-darwin/default.nix
Normal file
1
tests/modules/targets-darwin/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ targets-darwin = ./darwin.nix; }
|
Loading…
Reference in a new issue