diff --git a/.#programs.nix b/.#programs.nix deleted file mode 120000 index 75cbfbe..0000000 --- a/.#programs.nix +++ /dev/null @@ -1 +0,0 @@ -willem@zeus.44981 \ No newline at end of file diff --git a/flake.lock b/flake.lock index c96950d..56270bb 100644 --- a/flake.lock +++ b/flake.lock @@ -53,22 +53,6 @@ "type": "github" } }, - "nixpkgs-willem": { - "locked": { - "lastModified": 1672945252, - "narHash": "sha256-vkZYxDq8Bdt5JhZCcV4nniqaIsiYW3DAiuNXClFWcGA=", - "owner": "willemml", - "repo": "nixpkgs", - "rev": "4d11054d40eeeb77400d8cd71966d1bf3098d449", - "type": "github" - }, - "original": { - "owner": "willemml", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, "nur": { "locked": { "lastModified": 1672872270, @@ -89,7 +73,6 @@ "home-manager": "home-manager", "nixpkgs-22_11": "nixpkgs-22_11", "nixpkgs-unstable": "nixpkgs-unstable", - "nixpkgs-willem": "nixpkgs-willem", "nur": "nur" } }, diff --git a/flake.nix b/flake.nix index 9f4f7b5..afcd0be 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,6 @@ description = "Willem's Home Manager configuration"; inputs = { - 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 = { @@ -13,7 +12,7 @@ }; outputs = - { self, nixpkgs-willem, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: + { self, nixpkgs-unstable, nixpkgs-22_11, home-manager, nur, ... }@inputs: let system = "aarch64-darwin"; @@ -29,10 +28,6 @@ ]; }; - pkgsCustom = import nixpkgs-willem { - inherit system; - }; - nurNoPkgs = import nur { nurpkgs = pkgs; pkgs = throw "nixpkgs eval"; @@ -47,7 +42,7 @@ # Optionally use extraSpecialArgs # to pass through arguments to home.nix - extraSpecialArgs = { inherit nurNoPkgs pkgsCustom; }; + extraSpecialArgs = { inherit nurNoPkgs; }; }; }; } diff --git a/home.nix b/home.nix index 6a2558e..b5a12ff 100644 --- a/home.nix +++ b/home.nix @@ -1,6 +1,8 @@ { config, pkgs, lib, inputs, ... }: let + inherit (pkgs) stdenv; + inherit (lib) mkIf; emacsCommand = "emacsclient -c -nw"; homeDirectory = config.home.homeDirectory; in { @@ -16,7 +18,7 @@ in { builders-use-substitutes = true ''; - home.file.".gnupg/gpg-agent.conf".text = '' + home.file.".gnupg/gpg-agent.conf".text = mkIf stdenv.isDarwin '' pinentry-program "${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac" ''; diff --git a/launchd.nix b/launchd.nix index 5e46e37..8c166d9 100644 --- a/launchd.nix +++ b/launchd.nix @@ -1,7 +1,7 @@ { lib, config, pkgs, ... }: { - launchd = { + launchd = lib.mkIf pkgs.stdenv.isDarwin { enable = true; agents.emacs = { diff --git a/packages.nix b/packages.nix index bab7b66..d911bf9 100644 --- a/packages.nix +++ b/packages.nix @@ -1,19 +1,22 @@ -{ config, lib, pkgs, pkgsCustom, ... }: +{ pkgs, lib, ... }: -{ +let + darwin = with pkgs; [ + colima + coreutils + gnused + iterm2 + karabiner-elements + pinentry_mac + spoof-mac + (pkgs.callPackage ./packages/qbittorrent-mac.nix { inherit pkgs; }) + (pkgs.callPackage ./packages/spotify-mac.nix { inherit pkgs; }) + (pkgs.callPackage ./packages/vlc-mac.nix { inherit pkgs; }) + ]; + linux = with pkgs; [ vlc qbittorrent ]; +in { home.packages = with pkgs; [ - colima - coreutils - gnused - iterm2 - karabiner-elements - pinentry_mac - spoof-mac - zoom-us - (pkgs.callPackage ./spotify-mac.nix { inherit config lib pkgs; }) - ] ++ [ discord pkgsCustom.vlc pkgsCustom.qbittorrent ] - ++ [ docker docker-compose ] ++ [ autoconf automake bash @@ -21,6 +24,9 @@ cmake comma curl + discord + docker + docker-compose fd gawk htop @@ -28,15 +34,19 @@ nix-review nmap openssh + pass pv ripgrep rsync rustup tldr + units unp unrar unzip wget yq - ]; + zoom-us + ] ++ lib.optionals stdenv.isLinux linux + ++ lib.optionals stdenv.isDarwin darwin; } diff --git a/packages/qbittorrent-mac.nix b/packages/qbittorrent-mac.nix new file mode 100644 index 0000000..71151ac --- /dev/null +++ b/packages/qbittorrent-mac.nix @@ -0,0 +1,33 @@ +{ stdenv, pkgs, fetchurl, ... }: + +let + version = "4.4.5"; + appName = "qBittorrent"; + pname = "qbittorrent"; +in stdenv.mkDerivation { + inherit pname; + name = pname; + + src = fetchurl { + url = + "https://phoenixnap.dl.sourceforge.net/project/qbittorrent/qbittorrent-mac/qbittorrent-${version}/qbittorrent-${version}.dmg"; + sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM="; + }; + + nativeBuildInputs = [ pkgs.undmg pkgs.makeWrapper ]; + + sourceRoot = "."; + + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + cp -r "${appName}.app" $out/Applications + + # wrap executable to $out/bin + mkdir -p $out/bin + makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${pname}" "$out/bin/${pname}" + + runHook postInstall + ''; +} diff --git a/spotify-mac.nix b/packages/spotify-mac.nix similarity index 96% rename from spotify-mac.nix rename to packages/spotify-mac.nix index a538612..c26b3b0 100644 --- a/spotify-mac.nix +++ b/packages/spotify-mac.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, config, pkgs, ... }: +{ stdenv, pkgs, ... }: stdenv.mkDerivation { name = "spotify-mac-app"; diff --git a/packages/vlc-mac.nix b/packages/vlc-mac.nix new file mode 100644 index 0000000..0dfc98a --- /dev/null +++ b/packages/vlc-mac.nix @@ -0,0 +1,39 @@ +{ stdenv, pkgs, fetchurl, ... }: + +let + version = "3.0.18"; + srcs = { + aarch64-darwin = fetchurl { + url = + "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-arm64.dmg"; + sha256 = "sha256-mcJZvbxSIf1QgX9Ri3Dpv57hdeiQdDkDyYB7x3hmj0c="; + }; + x86_64-darwin = fetchurl { + url = + "http://get.videolan.org/vlc/${version}/macosx/vlc-${version}-intel64.dmg"; + sha256 = "sha256-iO3N/Os70vaANn2QCdOKDBR/p1jy3TleQ0EsHgjOHMs="; + }; + }; + pname = "vlc"; +in stdenv.mkDerivation { + name = pname; + + src = srcs.${stdenv.hostPlatform.system}; + + nativeBuildInputs = [ pkgs.undmg pkgs.makeWrapper ]; + + sourceRoot = "."; + + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + cp -r "VLC.app" $out/Applications + + # wrap executable to $out/bin + mkdir -p $out/bin + makeWrapper "$out/Applications/VLC.app/Contents/MacOS/VLC" "$out/bin/vlc" + + runHook postInstall + ''; +} diff --git a/programs.nix b/programs.nix index aa3178f..2c50a0c 100644 --- a/programs.nix +++ b/programs.nix @@ -112,6 +112,10 @@ export PATH=${pkgs.pinentry_mac.out}/Applications/pinentry-mac.app/Contents/MacOS:$PATH export GPG_TTY=$(tty) eval $(gpg-agent --daemon -q 2>/dev/null) + + function gsearch() { + open -a Safari "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')" + } ''; dotDir = ".config/zsh"; history = { @@ -128,6 +132,7 @@ hms = "home-manager switch"; cd = "z"; l = "ls -1"; + web = "open -a Safari"; }; };