From 33eda39c79aca78fb9b259485c74f51381ce007d Mon Sep 17 00:00:00 2001 From: willemml Date: Fri, 17 Mar 2023 09:13:17 -0700 Subject: [PATCH] add meta values to apps, add overlays.nix --- apps/chromium-mac.nix | 13 +++++ apps/freecad-mac.nix | 20 ++++++++ apps/pinentry-mac.nix | 9 +++- apps/pinentry-touchid.nix | 50 +++++++++++++++++++ apps/qbittorrent-mac.nix | 11 +++- apps/spotify-mac.nix | 11 +++- apps/vlc-mac.nix | 6 +++ flake-parts/default.nix | 3 +- flake-parts/overlays.nix | 14 ++++++ overlays/darwin.nix | 11 ---- overlays/default.nix | 11 ---- overlays/pinentry-touchid.nix | 41 --------------- .../darwin-zsh-completions.nix | 4 +- packages/default.nix | 4 ++ {overlays => packages}/org-auctex.nix | 6 +-- testing.nix | 9 ---- 16 files changed, 142 insertions(+), 81 deletions(-) create mode 100644 apps/pinentry-touchid.nix create mode 100644 flake-parts/overlays.nix delete mode 100644 overlays/darwin.nix delete mode 100644 overlays/default.nix delete mode 100644 overlays/pinentry-touchid.nix rename {overlays => packages}/darwin-zsh-completions.nix (93%) create mode 100644 packages/default.nix rename {overlays => packages}/org-auctex.nix (74%) delete mode 100644 testing.nix diff --git a/apps/chromium-mac.nix b/apps/chromium-mac.nix index 0b0fb63..1833c65 100644 --- a/apps/chromium-mac.nix +++ b/apps/chromium-mac.nix @@ -31,6 +31,19 @@ lib.mk-mac-binpkg { inherit pkgs src pname appName version; srcsubdir = "chrome-mac"; + meta = with pkgs.lib; { + description = "An open source web browser from Google."; + longDescription = '' + Chromium is an open source web browser from Google that aims to build a + safer, faster, and more stable way for all Internet users to experience + the web. It has a minimalist user interface and provides the vast majority + of source code for Google Chrome (which has some additional features). + ''; + homepage = "https://www.chromium.org/"; + license = licenses.bsd3; + platforms = platforms.linux; + mainProgram = "chromium"; + }; } ); diff --git a/apps/freecad-mac.nix b/apps/freecad-mac.nix index b84480e..dab3b1f 100644 --- a/apps/freecad-mac.nix +++ b/apps/freecad-mac.nix @@ -38,6 +38,26 @@ runHook postInstall ''; + meta = with pkgs.lib; { + homepage = "https://www.freecadweb.org/"; + description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler"; + longDescription = '' + FreeCAD is an open-source parametric 3D modeler made primarily to design + real-life objects of any size. Parametric modeling allows you to easily + modify your design by going back into your model history and changing its + parameters. + FreeCAD allows you to sketch geometry constrained 2D shapes and use them + as a base to build other objects. It contains many components to adjust + dimensions or extract design details from 3D models to create high quality + production ready drawings. + FreeCAD is designed to fit a wide range of uses including product design, + mechanical engineering and architecture. Whether you are a hobbyist, a + programmer, an experienced CAD user, a student or a teacher, you will feel + right at home with FreeCAD. + ''; + license = licenses.lgpl2Plus; + platforms = platforms.darwin; + }; }; systems = [ "aarch64-darwin" "x86_64-darwin" ]; } diff --git a/apps/pinentry-mac.nix b/apps/pinentry-mac.nix index b07df20..2a2dc37 100644 --- a/apps/pinentry-mac.nix +++ b/apps/pinentry-mac.nix @@ -9,7 +9,14 @@ cp "$src/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac" "$out/bin/pinentry-mac" ''; + + meta = { + description = "Pinentry for GPG on Mac"; + license = pkgs.lib.licenses.gpl2Plus; + homepage = "https://github.com/GPGTools/pinentry-mac"; + platforms = pkgs.lib.platforms.darwin; + }; }; - + systems = [ "aarch64-darwin" "x86_64-darwin" ]; } diff --git a/apps/pinentry-touchid.nix b/apps/pinentry-touchid.nix new file mode 100644 index 0000000..a74230b --- /dev/null +++ b/apps/pinentry-touchid.nix @@ -0,0 +1,50 @@ +{ + definition = lib: pkgs: pkgs.stdenv.mkDerivation { + name = "pinentry-touchid"; + src = pkgs.fetchFromGitHub { + owner = "jorgelbg"; + repo = "pinentry-touchid"; + rev = "1170eb6bc7b23313aee622887b47b77be6e5fb5f"; + sha256 = "sha256-asLFY7ztRKXEFsetB3Ym/0tJ1BBOn0yYpL8MIn1Z//0="; + }; + + nativeBuildInputs = with pkgs; [ + go + gopls + gotools + darwin.apple_sdk.frameworks.CoreFoundation + darwin.apple_sdk.frameworks.Foundation + darwin.apple_sdk.frameworks.LocalAuthentication + ]; + + sourceRoot = "."; + + buildPhase = '' + unset GOROOT + + export GOPATH="/tmp/gopath-$(echo $RANDOM | md5sum | head -c 20)" + export GOCACHE="/tmp/gocache-$(echo $RANDOM | md5sum | head -c 20)" + + export NIX_LDFLAGS="-F${pkgs.darwin.apple_sdk.frameworks.CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_LDFLAGS"; + + cd source + + go mod download + go build + ''; + + installPhase = '' + mkdir -p $out/bin + mv pinentry-touchid $out/bin/pinentry-touchid + ''; + + meta = { + description = "Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain."; + license = pkgs.lib.licenses.asl20; + homepage = "https://github.com/jorgelbg/pinentry-touchid"; + platforms = pkgs.lib.platforms.darwin; + }; + }; + + systems = [ "aarch64-darwin" "x86_64-darwin" ]; +} diff --git a/apps/qbittorrent-mac.nix b/apps/qbittorrent-mac.nix index a6c8329..e3bcedc 100644 --- a/apps/qbittorrent-mac.nix +++ b/apps/qbittorrent-mac.nix @@ -11,7 +11,16 @@ sha256 = "sha256-9h+gFAEU0tKrltOjnOKLfylbbBunGZqvPzQogdP9uQM="; }; in - lib.mk-mac-binpkg { inherit pkgs src pname appName version; }; + lib.mk-mac-binpkg { + inherit pkgs src pname appName version; + meta = with pkgs.lib; { + description = "Featureful free software BitTorrent client"; + homepage = "https://www.qbittorrent.org/"; + changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog"; + license = licenses.gpl2Plus; + platforms = platforms.darwin; + }; + }; systems = [ "aarch64-darwin" "x86_64-darwin" ]; } diff --git a/apps/spotify-mac.nix b/apps/spotify-mac.nix index 92ecb4e..59b01df 100644 --- a/apps/spotify-mac.nix +++ b/apps/spotify-mac.nix @@ -11,7 +11,16 @@ name = "spotify-mac.dmg"; }; in - lib.mk-mac-binpkg { inherit pkgs src pname appName version; }; + lib.mk-mac-binpkg { + inherit pkgs src pname appName version; + meta = with pkgs.lib; { + homepage = "https://www.spotify.com/"; + description = "Play music from the Spotify music service"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.unfree; + platforms = platforms.darwin; + }; + }; systems = [ "aarch64-darwin" "x86_64-darwin" ]; } diff --git a/apps/vlc-mac.nix b/apps/vlc-mac.nix index 9b95817..c64b8ba 100644 --- a/apps/vlc-mac.nix +++ b/apps/vlc-mac.nix @@ -22,6 +22,12 @@ in lib.mk-mac-binpkg { inherit pkgs src pname appName version; + meta = with pkgs.lib; { + description = "Cross-platform media player and streaming server"; + homepage = "http://www.videolan.org/vlc/"; + license = licenses.lgpl21Plus; + platforms = platforms.darwin; + }; }; systems = [ "aarch64-darwin" "x86_64-darwin" ]; diff --git a/flake-parts/default.nix b/flake-parts/default.nix index 9a5055b..48c788d 100644 --- a/flake-parts/default.nix +++ b/flake-parts/default.nix @@ -1,7 +1,8 @@ { imports = [ + ./apps.nix ./home-manager ./lib - ./apps.nix + ./overlays.nix ]; } diff --git a/flake-parts/overlays.nix b/flake-parts/overlays.nix new file mode 100644 index 0000000..48460cc --- /dev/null +++ b/flake-parts/overlays.nix @@ -0,0 +1,14 @@ +{ self, inputs, lib, ... }: + +{ + flake.overlays = { + default = final: prev: ( + let + appsDir = self.lib.importDirToAttrs ../apps; + builtApps = lib.mapAttrs (name: value: value.definition self.lib prev) appsDir; + packages = import ../packages final prev; + in + builtApps // packages + ); + }; +} diff --git a/overlays/darwin.nix b/overlays/darwin.nix deleted file mode 100644 index 599fc5d..0000000 --- a/overlays/darwin.nix +++ /dev/null @@ -1,11 +0,0 @@ -self: super: { - chromium-mac = super.callPackage ./chromium-mac.nix { pkgs = 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; }; - vlc-mac = super.callPackage ./vlc-mac.nix { pkgs = super; }; -} diff --git a/overlays/default.nix b/overlays/default.nix deleted file mode 100644 index cd18ed4..0000000 --- a/overlays/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -self: super: { - tree-sitter-grammars = super.tree-sitter-grammars // { - tree-sitter-python = super.tree-sitter-grammars.tree-sitter-python.overrideAttrs (_: { - nativeBuildInputs = [ super.nodejs super.tree-sitter ]; - configurePhase = '' - tree-sitter generate --abi 13 src/grammar.json - ''; - }); - }; - org-auctex = super.callPackage ./org-auctex.nix { pkgs = super; }; -} diff --git a/overlays/pinentry-touchid.nix b/overlays/pinentry-touchid.nix deleted file mode 100644 index 52a83e4..0000000 --- a/overlays/pinentry-touchid.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ pkgs ? import {} }: - -pkgs.stdenv.mkDerivation { - name = "pinentry-touchid"; - src = pkgs.fetchFromGitHub { - owner = "jorgelbg"; - repo = "pinentry-touchid"; - rev = "1170eb6bc7b23313aee622887b47b77be6e5fb5f"; - sha256 = "sha256-asLFY7ztRKXEFsetB3Ym/0tJ1BBOn0yYpL8MIn1Z//0="; - }; - - nativeBuildInputs = with pkgs; [ - go - gopls - gotools - darwin.apple_sdk.frameworks.CoreFoundation - darwin.apple_sdk.frameworks.Foundation - darwin.apple_sdk.frameworks.LocalAuthentication - ]; - - sourceRoot = "."; - - buildPhase = '' - unset GOROOT - - export GOPATH="/tmp/gopath-$(echo $RANDOM | md5sum | head -c 20)" - export GOCACHE="/tmp/gocache-$(echo $RANDOM | md5sum | head -c 20)" - - export NIX_LDFLAGS="-F${pkgs.darwin.apple_sdk.frameworks.CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_LDFLAGS"; - - cd source - - go mod download - go build - ''; - - installPhase = '' - mkdir -p $out/bin - mv pinentry-touchid $out/bin/pinentry-touchid - ''; -} diff --git a/overlays/darwin-zsh-completions.nix b/packages/darwin-zsh-completions.nix similarity index 93% rename from overlays/darwin-zsh-completions.nix rename to packages/darwin-zsh-completions.nix index c465bb2..0248c05 100644 --- a/overlays/darwin-zsh-completions.nix +++ b/packages/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 ? import {} }: +{ runCommand }: -pkgs.runCommand "darwin-zsh-completions-0.0.0" +runCommand "darwin-zsh-completions-0.0.0" { preferLocalBuild = true; } '' mkdir -p $out/share/zsh/site-functions diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 0000000..40924a7 --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,4 @@ +_final: prev: { + org-auctex = prev.callPackage ./org-auctex.nix {}; + darwin-zsh-completions = prev.callPackage ./darwin-zsh-completions.nix {}; +} diff --git a/overlays/org-auctex.nix b/packages/org-auctex.nix similarity index 74% rename from overlays/org-auctex.nix rename to packages/org-auctex.nix index 10b46c3..7f8792a 100644 --- a/overlays/org-auctex.nix +++ b/packages/org-auctex.nix @@ -1,10 +1,10 @@ -{ pkgs }: +{ fetchFromGitHub, emacsPackages }: -pkgs.emacsPackages.trivialBuild { +emacsPackages.trivialBuild { pname = "org-auctex"; version = "e1271557b9f36ca94cabcbac816748e7d0dc989c"; - src = pkgs.fetchFromGitHub { + src = fetchFromGitHub { owner = "karthink"; repo = "org-auctex"; rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c"; diff --git a/testing.nix b/testing.nix deleted file mode 100644 index fd611fb..0000000 --- a/testing.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ withSystem, ... }: -{ - flake = { - packages.aarch64-darwin.test = (withSystem "aarch64-darwin" ({ pkgs, ... }: pkgs.writeScriptBin "runme" '' - echo "I am currently being run!" - '')); - }; - -}