fix applications linking, add vlc

This commit is contained in:
willemml 2023-01-04 12:57:34 -08:00
parent 8246e5ff3e
commit d9c7a2fab9
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
6 changed files with 45 additions and 36 deletions

View file

@ -1 +0,0 @@
willem@zeus.16469

View file

@ -1,21 +1,28 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, mkIf, ... }:
let
appEnv = pkgs.buildEnv { # see https://github.com/nix-community/home-manager/issues/1341
name = "home-manager-applications";
paths = config.home.packages; {
pathsToLink = "/Applications"; disabledModules = [ "targets/darwin/linkapps.nix" ];
home.activation = lib.mkIf pkgs.stdenv.isDarwin {
copyApplications = let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
baseDir="$HOME/Applications/Home Manager Apps"
if [ -d "$baseDir" ]; then
rm -rf "$baseDir"
fi
mkdir -p "$baseDir"
for appFile in ${apps}/Applications/*; do
target="$baseDir/$(basename "$appFile")"
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
done
'';
}; };
in {
home.activation.addApplications = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# Install MacOS applications to the user environment.
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
[ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS"
$DRY_RUN_CMD mkdir -p "$HM_APPS"
# .app dirs need to be actual directories for Finder to detect them as Apps.
# In the env of Apps we build, the .apps are symlinks. We pass all of them as
# arguments to cp and make it dereference those using -H
$DRY_RUN_CMD cp --archive -H --dereference ${appEnv}/Applications/* "$HM_APPS"
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
'';
} }

17
flake.lock generated
View file

@ -55,27 +55,26 @@
}, },
"nixpkgs-willem": { "nixpkgs-willem": {
"locked": { "locked": {
"lastModified": 1672791794, "lastModified": 1672862269,
"narHash": "sha256-mqGPpGmwap0Wfsf3o2b6qHJW1w2kk/I6cGCGIU+3t6o=", "narHash": "sha256-KKCCD9eRNXmnMi/0jBRwUxfbpztZTKjMryzBpbF0Zjw=",
"ref": "master", "ref": "refs/heads/master",
"rev": "9813adc7f7c0edd738c6bdd8431439688bb0cb3d", "rev": "f47288240ee522859b93035dc13477b67d60bbb8",
"revCount": 439706, "revCount": 439834,
"type": "git", "type": "git",
"url": "file:///Users/willem/dev/nixpkgs" "url": "file:///Users/willem/dev/nixpkgs"
}, },
"original": { "original": {
"ref": "master",
"type": "git", "type": "git",
"url": "file:///Users/willem/dev/nixpkgs" "url": "file:///Users/willem/dev/nixpkgs"
} }
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1672854292, "lastModified": 1672861477,
"narHash": "sha256-yEOr5XLUpW7sOYMWIzlBOUMGoJmNaoe5Csot1/f3MvI=", "narHash": "sha256-vpOFUoEgirvsZmmhKP6S1B7w7/HU68F6vIcMjfzJp0Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "59bac5300ebf4c647eedd86e0403ac7df8ec37fe", "rev": "e7f5fc0f765054f51948a933576eddee469c99f4",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -2,6 +2,8 @@
description = "Willem's Home Manager configuration"; description = "Willem's Home Manager configuration";
inputs = { inputs = {
nixpkgs-willem.url = "git+file:///Users/willem/dev/nixpkgs";
#nixpkgs-willem.url = "github:willemml/nixpkgs/master";
nixpkgs-22_11.url = "github:NixOS/nixpkgs/nixos-22.11"; nixpkgs-22_11.url = "github:NixOS/nixpkgs/nixos-22.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = { home-manager = {
@ -12,7 +14,7 @@
}; };
outputs = outputs =
{ self, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: { self, nixpkgs-willem, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs:
let let
system = "aarch64-darwin"; system = "aarch64-darwin";
@ -28,6 +30,10 @@
]; ];
}; };
pkgsCustom = import nixpkgs-willem {
inherit system;
};
nurNoPkgs = import nur { nurNoPkgs = import nur {
nurpkgs = pkgs; nurpkgs = pkgs;
pkgs = throw "nixpkgs eval"; pkgs = throw "nixpkgs eval";
@ -42,9 +48,7 @@
# Optionally use extraSpecialArgs # Optionally use extraSpecialArgs
# to pass through arguments to home.nix # to pass through arguments to home.nix
extraSpecialArgs = { extraSpecialArgs = { inherit nurNoPkgs pkgsCustom; };
inherit nurNoPkgs;
};
}; };
}; };
} }

View file

@ -2,7 +2,7 @@
let let
homeDirectory = config.home.homeDirectory; homeDirectory = config.home.homeDirectory;
emacsCommand = [ "emacsclient" "-c" "-nw" ]; emacsCommand = "emacsclient -c -nw";
in { in {
imports = imports =
[ ./emacs.nix ./launchd.nix ./packages.nix ./programs.nix ./apps.nix ]; [ ./emacs.nix ./launchd.nix ./packages.nix ./programs.nix ./apps.nix ];

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, pkgsCustom, ... }:
{ {
home.packages = with pkgs; home.packages = with pkgs;
@ -10,7 +10,7 @@
pinentry_mac pinentry_mac
iterm2 iterm2
(pkgs.callPackage ./spotify-mac.nix { }) (pkgs.callPackage ./spotify-mac.nix { })
] ++ [ discord ] ++ [ docker docker-compose ] ++ [ ] ++ [ discord pkgsCustom.vlc ] ++ [ docker docker-compose ] ++ [
zsh-powerlevel10k zsh-powerlevel10k
comma comma
automake automake