From a9f9c2f4ed8cf47b5f28ded9c283f2f343a0fa57 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 9 Sep 2024 14:55:29 +0100 Subject: [PATCH] initial commit --- flake.lock | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 37 ++++++++ script.sh | 7 ++ 3 files changed, 300 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100755 script.sh diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f4ce548 --- /dev/null +++ b/flake.lock @@ -0,0 +1,256 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1688025799, + "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1725234343, + "narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-root": { + "locked": { + "lastModified": 1692742795, + "narHash": "sha256-f+Y0YhVCIJ06LemO+3Xx00lIcqQxSKJHXT/yk1RTKxw=", + "owner": "srid", + "repo": "flake-root", + "rev": "d9a70d9c7a5fd7f3258ccf48da9335e9b47c3937", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "flake-root", + "type": "github" + } + }, + "nix-visualize": { + "flake": false, + "locked": { + "lastModified": 1687577587, + "narHash": "sha256-Z1r8XHszoUnQinl63yXvQG6Czp5HnYNG37AY+EEiT4w=", + "owner": "craigmbooth", + "repo": "nix-visualize", + "rev": "cafaba50cd63ba9c759c56af71fd0d22fd60a548", + "type": "github" + }, + "original": { + "owner": "craigmbooth", + "repo": "nix-visualize", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1725634671, + "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + } + }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1711163522, + "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "sbomnix": "sbomnix", + "systems": "systems", + "treefmt-nix": "treefmt-nix_2" + } + }, + "sbomnix": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts_2", + "flake-root": "flake-root", + "nix-visualize": "nix-visualize", + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix", + "vulnix": "vulnix" + }, + "locked": { + "lastModified": 1724929558, + "narHash": "sha256-3CkgwrPws+7Z+mEJbq4f8SNo2b4hrta+vdCCGoNrpiU=", + "owner": "tiiuae", + "repo": "sbomnix", + "rev": "444ba45f30dad718e51b7043418cff5ef83583ea", + "type": "github" + }, + "original": { + "owner": "tiiuae", + "repo": "sbomnix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "sbomnix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1699786194, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1725271838, + "narHash": "sha256-VcqxWT0O/gMaeWTTjf1r4MOyG49NaNxW4GHTO3xuThE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "9fb342d14b69aefdf46187f6bb80a4a0d97007cd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "vulnix": { + "flake": false, + "locked": { + "lastModified": 1676379453, + "narHash": "sha256-KXvmnaMjv//zd4aSwu4qmbon1Iyzdod6CPms7LIxeVU=", + "owner": "henrirosten", + "repo": "vulnix", + "rev": "ad28b2924027a44a9b81493a0f9de1b0e8641005", + "type": "github" + }, + "original": { + "owner": "henrirosten", + "repo": "vulnix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bc79614 --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + description = "Flake for nix-search-by-maintainer"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + systems.url = "github:nix-systems/default"; + sbomnix.url = "github:tiiuae/sbomnix"; + }; + outputs = inputs @ { + flake-parts, + systems, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = import systems; + perSystem = { + config, + self', + inputs', + pkgs, + system, + ... + }: { + packages = { + default = pkgs.writeShellApplication { + name = "nix-search-by-maintainer"; + runtimeInputs = [inputs'.sbomnix.packages.sbomnix pkgs.csvkit pkgs.gum]; + text = builtins.readFile ./script.sh; + }; + }; + }; + }; +} diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..b9ec255 --- /dev/null +++ b/script.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +EMAIL="$1" +URL=${2:-"github:NixOS/nixpkgs?ref=master"} +gum spin --spinner dot --title "Querying $URL..." -- nixmeta --flakeref="$URL" -o /tmp/nixmeta.csv +csvsql /tmp/nixmeta.csv --query "select * from nixmeta where meta_maintainers_email==\"$EMAIL\"" | gum table -p +rm /tmp/nixmeta.csv