Skip to content

spotdemo4/nur

Repository files navigation

trev's nur

checks vulnerable nur sync

Install

DevShell

{
  nixConfig = {
    extra-substituters = [
      "https://cache.trev.zip/nur"
    ];
    extra-trusted-public-keys = [
      "nur:DoXGy0SJ+5udhvZgtzwEXhQMuOCFN7FSXRmtiZhF1Vw="
    ];
  };

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    nur = {
      url = "github:nix-community/NUR";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    nixpkgs,
    flake-utils,
    nur,
  }:
    flake-utils.lib.eachDefaultSystem (
      system: let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [nur.overlays.default]; # Add the NUR overlay
        };
      in {
        devShells.default = pkgs.mkShell {
          packages = [pkgs.nur.repos.trev.bobgen]; # Use the NUR overlay
        };
      }
    );
}

NixOS

{
  nixConfig = {
    extra-substituters = [
      "https://cache.trev.zip/nur"
    ];
    extra-trusted-public-keys = [
      "nur:DoXGy0SJ+5udhvZgtzwEXhQMuOCFN7FSXRmtiZhF1Vw="
    ];
  };

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nur = {
      url = "github:nix-community/NUR";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, nur }: {
    nixosConfigurations.myConfig = nixpkgs.lib.nixosSystem {
      modules = [
        nur.modules.nixos.default # Add the NUR overlay

        ({ pkgs, ... }: {
          environment.systemPackages = [pkgs.nur.repos.trev.bobgen]; # Use the NUR overlay
        })
      ];
    };
  };
}

Packages

  • bobgen - Generates an ORM for Go based on a database schema
  • protoc-gen-connect-openapi - Plugin for generating OpenAPIv3 from protobufs matching the Connect RPC interface
  • renovate - Cross-platform dependency automation
  • nix-update - Swiss-knife for updating nix packages.
    • Following branch main (unstable)
  • opengrep - Static code analysis engine to find security issues in code
  • bumper - Git version bumper (ie. 0.0.1 -> 0.0.2)
  • shellhook - Shell hook for getting info when entering git repos
  • nix-fix-hash - Fixes incorrect nix package hashes

Libs

  • mkChecks - Utility function to make creating flake checks easier
checks = forSystem ({pkgs, ...}:
  pkgs.nur.repos.trev.lib.mkChecks {
    lint = {
      src = ./.;
      deps = with pkgs; [
        alejandra
        sqlfluff
        revive
      ];
      script = ''
        alejandra -c .
        sqlfluff lint
        revive -config revive.toml -set_exit_status ./...
      '';
    };
});
  • go.moduleToPlatform - Changes the goos & goarch values of a buildGoModule derivation
  • go.moduleToImage - Turns a buildGoModule derivation into a docker image
packages = forSystem (
  {
    pkgs,
    system,
    ...
  }:
    with pkgs.nur.repos.trev.lib; rec {
      default = ts-server."${system}";

      linux-amd64 = go.moduleToPlatform default "linux" "amd64";
      linux-arm64 = go.moduleToPlatform default "linux" "arm64";
      linux-arm = go.moduleToPlatform default "linux" "arm";
      darwin-arm64 = go.moduleToPlatform default "darwin" "arm64";
      windows-amd64 = go.moduleToPlatform default "windows" "amd64";

      linux-amd64-image = go.moduleToImage linux-amd64;
      linux-arm64-image = go.moduleToImage linux-arm64;
      linux-arm-image = go.moduleToImage linux-arm;
    }
);
  • buf.fetchDeps & buf.configHook - Creates a fixed-output derivation containing buf dependencies
pkgs.stdenv.mkDerivation (finalAttrs: {
  pname = "proto";
  version = "1.0.0";
  src = ./.;

  nativeBuildInputs = with pkgs; [
    buf
    pkgs.nur.repos.trev.lib.buf.configHook
  ];

  bufDeps = pkgs.nur.repos.trev.lib.buf.fetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "...";
  };

  doCheck = true;
  checkPhase = ''
    buf lint
  '';
});

About

Trev's Nix User Repository

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •