From d9c7a2fab94797a18c51ed647ffcce9cc739d81c Mon Sep 17 00:00:00 2001 From: willemml Date: Wed, 4 Jan 2023 12:57:34 -0800 Subject: [PATCH] fix applications linking, add vlc --- .#spotify-mac.nix | 1 - apps.nix | 45 ++++++++++++++++++++++++++------------------- flake.lock | 17 ++++++++--------- flake.nix | 12 ++++++++---- home.nix | 2 +- packages.nix | 4 ++-- 6 files changed, 45 insertions(+), 36 deletions(-) delete mode 120000 .#spotify-mac.nix diff --git a/.#spotify-mac.nix b/.#spotify-mac.nix deleted file mode 120000 index dee3511..0000000 --- a/.#spotify-mac.nix +++ /dev/null @@ -1 +0,0 @@ -willem@zeus.16469 \ No newline at end of file diff --git a/apps.nix b/apps.nix index 18fb18d..dd92ebf 100644 --- a/apps.nix +++ b/apps.nix @@ -1,21 +1,28 @@ -{ config, lib, pkgs, ... }: -let - appEnv = pkgs.buildEnv { - name = "home-manager-applications"; - paths = config.home.packages; - pathsToLink = "/Applications"; +{ config, lib, pkgs, mkIf, ... }: + +# see https://github.com/nix-community/home-manager/issues/1341 + +{ + 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" - ''; } diff --git a/flake.lock b/flake.lock index e95540d..0e9f823 100644 --- a/flake.lock +++ b/flake.lock @@ -55,27 +55,26 @@ }, "nixpkgs-willem": { "locked": { - "lastModified": 1672791794, - "narHash": "sha256-mqGPpGmwap0Wfsf3o2b6qHJW1w2kk/I6cGCGIU+3t6o=", - "ref": "master", - "rev": "9813adc7f7c0edd738c6bdd8431439688bb0cb3d", - "revCount": 439706, + "lastModified": 1672862269, + "narHash": "sha256-KKCCD9eRNXmnMi/0jBRwUxfbpztZTKjMryzBpbF0Zjw=", + "ref": "refs/heads/master", + "rev": "f47288240ee522859b93035dc13477b67d60bbb8", + "revCount": 439834, "type": "git", "url": "file:///Users/willem/dev/nixpkgs" }, "original": { - "ref": "master", "type": "git", "url": "file:///Users/willem/dev/nixpkgs" } }, "nur": { "locked": { - "lastModified": 1672854292, - "narHash": "sha256-yEOr5XLUpW7sOYMWIzlBOUMGoJmNaoe5Csot1/f3MvI=", + "lastModified": 1672861477, + "narHash": "sha256-vpOFUoEgirvsZmmhKP6S1B7w7/HU68F6vIcMjfzJp0Q=", "owner": "nix-community", "repo": "NUR", - "rev": "59bac5300ebf4c647eedd86e0403ac7df8ec37fe", + "rev": "e7f5fc0f765054f51948a933576eddee469c99f4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8fb97c0..4bd38ef 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,8 @@ description = "Willem's Home Manager configuration"; 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-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { @@ -12,7 +14,7 @@ }; outputs = - { self, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: + { self, nixpkgs-willem, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: let system = "aarch64-darwin"; @@ -28,6 +30,10 @@ ]; }; + pkgsCustom = import nixpkgs-willem { + inherit system; + }; + nurNoPkgs = import nur { nurpkgs = pkgs; pkgs = throw "nixpkgs eval"; @@ -42,9 +48,7 @@ # Optionally use extraSpecialArgs # to pass through arguments to home.nix - extraSpecialArgs = { - inherit nurNoPkgs; - }; + extraSpecialArgs = { inherit nurNoPkgs pkgsCustom; }; }; }; } diff --git a/home.nix b/home.nix index 4c08fd9..99fad8e 100644 --- a/home.nix +++ b/home.nix @@ -2,7 +2,7 @@ let homeDirectory = config.home.homeDirectory; - emacsCommand = [ "emacsclient" "-c" "-nw" ]; + emacsCommand = "emacsclient -c -nw"; in { imports = [ ./emacs.nix ./launchd.nix ./packages.nix ./programs.nix ./apps.nix ]; diff --git a/packages.nix b/packages.nix index 1f74875..230f54f 100644 --- a/packages.nix +++ b/packages.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, pkgsCustom, ... }: { home.packages = with pkgs; @@ -10,7 +10,7 @@ pinentry_mac iterm2 (pkgs.callPackage ./spotify-mac.nix { }) - ] ++ [ discord ] ++ [ docker docker-compose ] ++ [ + ] ++ [ discord pkgsCustom.vlc ] ++ [ docker docker-compose ] ++ [ zsh-powerlevel10k comma automake