From 887edfb73a5ac7627df8702ba54667cd5664774b Mon Sep 17 00:00:00 2001 From: willemml Date: Wed, 8 Feb 2023 13:08:49 -0800 Subject: [PATCH] move darwin pkgs to system conf, add alias to build overlays --- home/darwin/launchd.nix | 1 - home/packages.nix | 14 +------------- home/programs.nix | 1 + overlays/chromium-mac.nix | 10 +++++----- overlays/darwin-zsh-completions.nix | 4 ++-- overlays/default.nix | 1 + overlays/firefox-mac.nix | 4 ++-- overlays/freecad-mac.nix | 4 ++-- overlays/pinentry-mac.nix | 13 +++++++++++++ overlays/pinentry-touchid.nix | 6 +++--- overlays/qbittorrent-mac.nix | 4 ++-- overlays/spotify-mac.nix | 2 +- overlays/vlc-mac.nix | 10 +++++----- system/darwin.nix | 21 ++++++++++++++++++--- 14 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 overlays/pinentry-mac.nix diff --git a/home/darwin/launchd.nix b/home/darwin/launchd.nix index c32ff9e..a5e62d9 100644 --- a/home/darwin/launchd.nix +++ b/home/darwin/launchd.nix @@ -45,7 +45,6 @@ StandardOutPath = "${config.home.homeDirectory}/Library/Logs/spotifyd-stdout.log"; StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/spotifyd-stderr.log"; - }; }; }; diff --git a/home/packages.nix b/home/packages.nix index b555890..e3cb606 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -1,19 +1,7 @@ { pkgs, lib, ... }: let - darwin = with pkgs; [ - colima - coreutils - freecad-mac - gnused - iterm2 - pinentry-touchid - pinentry_mac - qbittorrent-mac - spoof-mac - spotify-mac - vlc-mac - ]; + darwin = with pkgs; [ ]; linux = with pkgs; [ vlc qbittorrent freecad spotify ]; pass-extended = pkgs.pass.withExtensions (exts: [ exts.pass-genphrase exts.pass-otp exts.pass-import ]); python-wp = pkgs.python310.withPackages (p: with p; [ setuptools pyaml requests latexify-py ]); diff --git a/home/programs.nix b/home/programs.nix index dc64768..42bf3eb 100644 --- a/home/programs.nix +++ b/home/programs.nix @@ -196,6 +196,7 @@ np = "nix-shell -p"; org = "z ${config.home.sessionVariables.ORGDIR}"; ubc = "z ${config.home.sessionVariables.UBCDIR}"; + nbpkgs = "nix-build --arg pkgs 'import {}'"; }; }; diff --git a/overlays/chromium-mac.nix b/overlays/chromium-mac.nix index effa8dc..6889533 100644 --- a/overlays/chromium-mac.nix +++ b/overlays/chromium-mac.nix @@ -1,4 +1,4 @@ -{ stdenv, pkgs, fetchurl, ... }: +{ pkgs }: let versions = { @@ -6,26 +6,26 @@ let x86_64-darwin = "1101350"; }; - version = versions.${stdenv.hostPlatform.system}; + version = versions.${pkgs.stdenv.hostPlatform.system}; pname = "chromium"; appName = "Chromium"; srcs = { - aarch64-darwin = fetchurl { + aarch64-darwin = pkgs.fetchurl { url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/${version}/chrome-mac.zip"; sha256 = "sha256-LlbYlJmFLzyHIiygofa0Btm7NAOvWXXhmbjMHldVoGo="; name = "${pname}_aarch64_${version}.zip"; }; - x86_64-darwin = fetchurl { + x86_64-darwin = pkgs.fetchurl { url = "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/${version}/chrome-mac.zip"; sha256 = "sha256-O+OnjakEpjCRbSjDysEA6RKKaKaSMw+LSO2ZLcxz2vM="; name = "${pname}_x86_64_${version}.zip"; }; }; - src = srcs.${stdenv.hostPlatform.system}; + src = srcs.${pkgs.stdenv.hostPlatform.system}; in import ./mk-mac-binpkg.nix { inherit pkgs src pname appName version; diff --git a/overlays/darwin-zsh-completions.nix b/overlays/darwin-zsh-completions.nix index 7f4b473..9fc863b 100644 --- a/overlays/darwin-zsh-completions.nix +++ b/overlays/darwin-zsh-completions.nix @@ -1,8 +1,8 @@ # taken from nix-darwin repo # https://github.com/LnL7/nix-darwin/blob/87b9d090ad39b25b2400029c64825fc2a8868943/modules/examples/lnl.nix -{ pkgs, stdenv, ... }: +{ pkgs }: -stdenv.runCommand "darwin-zsh-completions-0.0.0" +pkgs.runCommand "darwin-zsh-completions-0.0.0" { preferLocalBuild = true; } '' mkdir -p $out/share/zsh/site-functions diff --git a/overlays/default.nix b/overlays/default.nix index 5eb498d..599fc5d 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -3,6 +3,7 @@ self: super: { darwin-zsh-completions = import ./darwin-zsh-completions.nix { pkgs = super; }; firefox-mac = super.callPackage ./firefox-mac.nix { pkgs = super; }; freecad-mac = super.callPackage ./freecad-mac.nix { pkgs = super; }; + pinentry-mac = super.callPackage ./pinentry-mac.nix { pkgs = super; }; pinentry-touchid = super.callPackage ./pinentry-touchid.nix { pkgs = super; }; qbittorrent-mac = super.callPackage ./qbittorrent-mac.nix { pkgs = super; }; spotify-mac = super.callPackage ./spotify-mac.nix { pkgs = super; }; diff --git a/overlays/firefox-mac.nix b/overlays/firefox-mac.nix index da0d68a..fb46761 100644 --- a/overlays/firefox-mac.nix +++ b/overlays/firefox-mac.nix @@ -1,10 +1,10 @@ -{ pkgs, fetchurl, ... }: +{ pkgs }: let version = "109.0.1"; pname = "firefox"; appName = "Firefox"; - src = fetchurl { + src = pkgs.fetchurl { url = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-CA/Firefox%20${version}.dmg"; sha256 = "sha256-V/8W3qqYhJmte2tq/ZSPtYChdhv8WFQoSORYRaxva9Y="; diff --git a/overlays/freecad-mac.nix b/overlays/freecad-mac.nix index 873ea5b..14777d3 100644 --- a/overlays/freecad-mac.nix +++ b/overlays/freecad-mac.nix @@ -1,4 +1,4 @@ -{ pkgs, fetchurl, ... }: +{ pkgs }: let version = "0.20.2"; @@ -6,7 +6,7 @@ let appName = "FreeCAD"; pname = "freecad"; - src = fetchurl { + src = pkgs.fetchurl { url = "https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg"; sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c="; diff --git a/overlays/pinentry-mac.nix b/overlays/pinentry-mac.nix new file mode 100644 index 0000000..7079648 --- /dev/null +++ b/overlays/pinentry-mac.nix @@ -0,0 +1,13 @@ +{ pkgs }: + +pkgs.stdenv.mkDerivation { + name = "pinentry-mac"; + src = pkgs.pinentry_mac; + installPhase = '' +# -*-sh-*- + +mkdir -p "$out/bin" + +cp "$src/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac" "$out/bin/pinentry-mac" +''; +} diff --git a/overlays/pinentry-touchid.nix b/overlays/pinentry-touchid.nix index b123718..c8995dd 100644 --- a/overlays/pinentry-touchid.nix +++ b/overlays/pinentry-touchid.nix @@ -1,8 +1,8 @@ -{ stdenv, pkgs, fetchFromGitHub, ... }: +{ pkgs }: -stdenv.mkDerivation { +pkgs.stdenv.mkDerivation { name = "pinentry-touchid"; - src = fetchFromGitHub { + src = pkgs.fetchFromGitHub { owner = "jorgelbg"; repo = "pinentry-touchid"; rev = "1170eb6bc7b23313aee622887b47b77be6e5fb5f"; diff --git a/overlays/qbittorrent-mac.nix b/overlays/qbittorrent-mac.nix index 56806cd..c32c771 100644 --- a/overlays/qbittorrent-mac.nix +++ b/overlays/qbittorrent-mac.nix @@ -1,11 +1,11 @@ -{ pkgs, fetchurl, ... }: +{ pkgs }: let version = "4.4.5"; appName = "qBittorrent"; pname = "qbittorrent"; - src = fetchurl { + src = pkgs.fetchurl { url = "https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg"; sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM="; diff --git a/overlays/spotify-mac.nix b/overlays/spotify-mac.nix index 531bacc..d634253 100644 --- a/overlays/spotify-mac.nix +++ b/overlays/spotify-mac.nix @@ -1,4 +1,4 @@ -{ stdenv, pkgs, fetchurl, ... }: +{ pkgs }: let appName = "Spotify"; diff --git a/overlays/vlc-mac.nix b/overlays/vlc-mac.nix index 9677d23..25312f3 100644 --- a/overlays/vlc-mac.nix +++ b/overlays/vlc-mac.nix @@ -1,26 +1,26 @@ -{ stdenv, pkgs, fetchurl, ... }: +{ pkgs }: let appName = "VLC"; pname = "vlc"; version = "3.0.18"; srcs = { - aarch64-darwin = fetchurl { + aarch64-darwin = pkgs.fetchurl { url = "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg"; sha256 = "sha256-mcJZvbxSIf1QgX9Ri3Dpv57hdeiQdDkDyYB7x3hmj0c="; name = "${pname}_aarch64_${version}.dmg"; }; - x86_64-darwin = fetchurl { + x86_64-darwin = pkgs.fetchurl { url = "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg"; sha256 = "sha256-iO3N/Os70vaANn2QCdOKDBR/p1jy3TleQ0EsHgjOHMs="; name = "${pname}_x86_64_${version}.dmg"; }; }; - src = srcs.${stdenv.hostPlatform.system}; + src = srcs.${pkgs.stdenv.hostPlatform.system}; in import ./mk-mac-binpkg.nix { - inherit stdenv pkgs fetchurl src pname appName version; + inherit pkgs src pname appName version; } diff --git a/system/darwin.nix b/system/darwin.nix index b736da3..3ec251e 100644 --- a/system/darwin.nix +++ b/system/darwin.nix @@ -17,7 +17,20 @@ environment.loginShell = "${pkgs.zsh}/bin/zsh -l"; environment.variables.SHELL = "${pkgs.zsh}/bin/zsh"; environment.variables.LANG = "en_US.UTF-8"; - environment.systemPackages = with pkgs; [ ]; + environment.systemPackages = with pkgs; [ + colima + coreutils + darwin-zsh-completions + freecad-mac + gnused + iterm2 + pinentry-touchid + pinentry-mac + qbittorrent-mac + spoof-mac + spotify-mac + vlc-mac + ]; nix = { extraOptions = '' @@ -31,9 +44,11 @@ }; programs.bash.enable = true; - + + programs.man.enable = true; + programs.nix-index.enable = true; - + programs.zsh.enable = true; programs.zsh.enableBashCompletion = true; programs.zsh.enableFzfCompletion = true;