Update Nix flake, refactor Darwin app aliases and use it for system and

home config. Remove qutebrowser, mousecat, move some apps from brew ->
nixpkgs, add firefox to mac
This commit is contained in:
Martin Larsson 2025-07-13 16:25:17 +02:00
parent 677baf3d71
commit de7f2ff31f
6 changed files with 95 additions and 82 deletions

81
flake.lock generated
View file

@ -22,16 +22,16 @@
"brew-src": { "brew-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1749511373, "lastModified": 1751910772,
"narHash": "sha256-7u1TdHQaUCzzgf/n8T3bQosuYXyNBEPU/3WQQqozE5o=", "narHash": "sha256-jQNdIkq2iRDNWskd5f8kX6q9BO/CBSXhMH41WNRft8E=",
"owner": "Homebrew", "owner": "Homebrew",
"repo": "brew", "repo": "brew",
"rev": "7b4ef99fed96966269ee35994407fa4c06097a4d", "rev": "700d67a85e0129ab8a893ff69246943479e33df1",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "Homebrew", "owner": "Homebrew",
"ref": "4.5.6", "ref": "4.5.9",
"repo": "brew", "repo": "brew",
"type": "github" "type": "github"
} }
@ -151,11 +151,11 @@
"zon2nix": "zon2nix" "zon2nix": "zon2nix"
}, },
"locked": { "locked": {
"lastModified": 1751840395, "lastModified": 1752328988,
"narHash": "sha256-g93h5xxNUDZha8ppkNbYKYOem9aPJc0IqdwpHNyKMzo=", "narHash": "sha256-07BUaMjLkaSjUgVhlSrbODF+OZHCck5PeGvbtq6wQaA=",
"owner": "ghostty-org", "owner": "ghostty-org",
"repo": "ghostty", "repo": "ghostty",
"rev": "78e861b50ea88aa7e9cfb5362364f40f47943088", "rev": "b5000dcd94b75d745dacbcd3d4bfaf181d288671",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -171,11 +171,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751824240, "lastModified": 1752402455,
"narHash": "sha256-aDDC0CHTlL7QDKWWhdbEgVPK6KwWt+ca0QkmHYZxMzI=", "narHash": "sha256-mCHfZhQKdTj2JhCFcqfOfa3uKZbwUkPQbd0/zPnhOE8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "fd9e55f5fac45a26f6169310afca64d56b681935", "rev": "bf893ad4cbf46610dd1b620c974f824e266cd1df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -203,11 +203,11 @@
"homebrew-cask": { "homebrew-cask": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1751821182, "lastModified": 1752406759,
"narHash": "sha256-E5YKU/HJLstUz1T2aQhjVpGnh5xr7KbQ/FyKq1HPoVM=", "narHash": "sha256-p7b4Ip0wKFS6YacLjrzri2h6p52blGHOzylb+Cg0sRg=",
"owner": "homebrew", "owner": "homebrew",
"repo": "homebrew-cask", "repo": "homebrew-cask",
"rev": "b96f8b9b46ba3f49b82767dc469b459a92a080fc", "rev": "baf53b769e2febbe32f62ac3754cf5898be997fc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -219,11 +219,11 @@
"homebrew-core": { "homebrew-core": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1751824569, "lastModified": 1752402389,
"narHash": "sha256-FnecbUxCRzxfq6BfHJbY72/TIsoiJLqySTBT80OvdWU=", "narHash": "sha256-OYgOxxtJE/eK7I3HJj5N9kUXlASyij+l80hbohDxeAs=",
"owner": "homebrew", "owner": "homebrew",
"repo": "homebrew-core", "repo": "homebrew-core",
"rev": "1d376783e883c6d15239fec91faba7ffcd289794", "rev": "9c488c37fe89cb176e9a1dff5835baf214fcffb5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -232,22 +232,6 @@
"type": "github" "type": "github"
} }
}, },
"homebrew-nikitabobko": {
"flake": false,
"locked": {
"lastModified": 1746359410,
"narHash": "sha256-hXcquTkyfKZw2p8bAE4Yh6we8xeAZbwNHhQtoK6SMU4=",
"owner": "nikitabobko",
"repo": "homebrew-tap",
"rev": "6714dd2c19455643dbe754e6ec8454a86b3000d1",
"type": "github"
},
"original": {
"owner": "nikitabobko",
"repo": "homebrew-tap",
"type": "github"
}
},
"neovim": { "neovim": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
@ -293,11 +277,11 @@
"brew-src": "brew-src" "brew-src": "brew-src"
}, },
"locked": { "locked": {
"lastModified": 1749952250, "lastModified": 1752160973,
"narHash": "sha256-V2ix0knpdJXirQ+4pjbnggjdSALTsFWGIP/NDpaQkdU=", "narHash": "sha256-BCC8KB7TEtwv7vZN1WDu870tRbXtzUcmF9xNr6ws5Wc=",
"owner": "zhaofengli-wip", "owner": "zhaofengli-wip",
"repo": "nix-homebrew", "repo": "nix-homebrew",
"rev": "37126f06f4890f019af3d7606ce5d30a457afcd0", "rev": "69c1aa2f136f3c3326d9b6770e0eb54f12832971",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -312,11 +296,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1749574455, "lastModified": 1752199438,
"narHash": "sha256-fm2/8KPOYvvIAnNVtjDlTt/My00lIbZQ+LMrfQIWVzs=", "narHash": "sha256-xSBMmGtq8K4Qv80TMqREmESCAsRLJRHAbFH2T/2Bf1Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "917af390377c573932d84b5e31dd9f2c1b5c0f09", "rev": "d34d9412556d3a896e294534ccd25f53b6822e80",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -360,27 +344,27 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1749173751, "lastModified": 1751792365,
"narHash": "sha256-ENY3y3v6S9ZmLDDLI3LUT8MXmfXg/fSt2eA4GCnMVCE=", "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ed29f002b6d6e5e7e32590deb065c34a31dc3e91", "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-24.11", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1751637120, "lastModified": 1751984180,
"narHash": "sha256-xVNy/XopSfIG9c46nRmPaKfH1Gn/56vQ8++xWA8itO4=", "narHash": "sha256-LwWRsENAZJKUdD3SpLluwDmdXY9F45ZEgCb0X+xgOL0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5c724ed1388e53cc231ed98330a60eb2f7be4be3", "rev": "9807714d6944a957c2e036f84b0ff8caf9930bc0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -398,11 +382,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751824066, "lastModified": 1752402434,
"narHash": "sha256-bh/3BURJLJHUT0gpsR3NDkLVSme/dfoqv7EdXnxlAJo=", "narHash": "sha256-lC/l4YJckdmYm5AbT82Z6tZdhlha3LVupR463Bp5P+I=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "c6a24385d1e517bb1d901d63148828c8cfdff3dd", "rev": "b8f1b91334cb6ab7a5c6edd9a15068cdd6a91d04",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -419,7 +403,6 @@
"homebrew-bundle": "homebrew-bundle", "homebrew-bundle": "homebrew-bundle",
"homebrew-cask": "homebrew-cask", "homebrew-cask": "homebrew-cask",
"homebrew-core": "homebrew-core", "homebrew-core": "homebrew-core",
"homebrew-nikitabobko": "homebrew-nikitabobko",
"neovim": "neovim", "neovim": "neovim",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nix-homebrew": "nix-homebrew", "nix-homebrew": "nix-homebrew",

View file

@ -42,10 +42,6 @@
url = "github:homebrew/homebrew-bundle"; url = "github:homebrew/homebrew-bundle";
flake = false; flake = false;
}; };
homebrew-nikitabobko = {
url = "github:nikitabobko/homebrew-tap";
flake = false;
};
}; };
outputs = outputs =
@ -63,7 +59,6 @@
homebrew-core, homebrew-core,
homebrew-cask, homebrew-cask,
homebrew-bundle, homebrew-bundle,
homebrew-nikitabobko,
... ...
}: }:
let let
@ -197,7 +192,6 @@
"homebrew/core" = homebrew-core; "homebrew/core" = homebrew-core;
"homebrew/cask" = homebrew-cask; "homebrew/cask" = homebrew-cask;
"homebrew/bundle" = homebrew-bundle; "homebrew/bundle" = homebrew-bundle;
"nikitabobko/tap" = homebrew-nikitabobko;
}; };
mutableTaps = true; mutableTaps = true;
}; };

View file

@ -1,5 +1,6 @@
{ {
pkgs, pkgs,
lib,
config, config,
... ...
}: }:
@ -13,12 +14,26 @@ let
]; ];
in in
{ {
imports = [
./common/firefox.nix
];
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
gawk gawk
discord discord
bitwarden-cli aerospace
mas
raycast
]; ];
file = utils.mk_symlinks { inherit config dotfiles; }; file = utils.mk_symlinks { inherit config dotfiles; };
activation.applications = utils.mkAppAliasHome {
derivationName = "home-applications";
appsPath = config.home.packages;
outputDir = "${config.home.homeDirectory}/Applications/Nix";
pkgs = pkgs;
lib = lib;
};
}; };
} }

View file

@ -53,7 +53,6 @@ in
mako mako
bitwarden-cli bitwarden-cli
sway-audio-idle-inhibit sway-audio-idle-inhibit
qutebrowser
ffmpeg ffmpeg
imv imv
]; ];

View file

@ -1,9 +1,13 @@
{ {
pkgs, pkgs,
config, config,
lib,
self, self,
... ...
}: }:
let
utils = import ../utils.nix;
in
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -15,12 +19,9 @@
enable = true; enable = true;
casks = [ casks = [
"ghostty" "ghostty"
"nikitabobko/tap/aerospace"
"qutebrowser"
"shortcat"
]; ];
brews = [ brews = [
"mas" "bitwarden-cli"
]; ];
masApps = { }; masApps = { };
onActivation.cleanup = "zap"; onActivation.cleanup = "zap";
@ -68,25 +69,13 @@
remapCapsLockToEscape = true; remapCapsLockToEscape = true;
swapLeftCtrlAndFn = false; swapLeftCtrlAndFn = false;
}; };
activationScripts.applications.text =
let activationScripts.applications.text = utils.mkAppAliasSystem {
env = pkgs.buildEnv { derivationName = "system-applications";
name = "system-applications"; appsPath = config.environment.systemPackages;
paths = config.environment.systemPackages; outputDir = "/Applications/Nix";
pathsToLink = "/Applications"; pkgs = pkgs;
}; lib = lib;
in };
pkgs.lib.mkForce ''
# Set up applications
echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
}; };
} }

View file

@ -1,4 +1,4 @@
{ rec {
mk_symlinks = mk_symlinks =
{ {
config, config,
@ -13,4 +13,37 @@
}; };
}) dotfiles }) dotfiles
); );
mkAppAliasSystem = args: args.pkgs.lib.mkForce (mkAppAliasScriptContent args);
mkAppAliasHome =
args: args.lib.hm.dag.entryAfter [ "writeBoundary" ] (mkAppAliasScriptContent args);
# Darwin System / Home Manager expects activation scripts in different formats
# This only return the script body, use the other two functions in the config.
mkAppAliasScriptContent =
{
derivationName,
appsPath,
outputDir,
pkgs,
lib,
}:
let
env = pkgs.buildEnv {
name = derivationName;
paths = appsPath;
pathsToLink = "/Applications";
};
in
''
echo "Setting up macOS .app aliases..." >&2
rm -rf "${outputDir}"
mkdir -p "${outputDir}"
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
${pkgs.mkalias}/bin/mkalias "$src" "${outputDir}/$app_name"
done
'';
} }