github.com/replit/upm@v0.0.0-20240423230255-9ce4fc3ea24c/flake.nix (about)

     1  {
     2    description = "Universal Package Manager";
     3    inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
     4    # nix-editor is a dev dependency in this project. At Replit, we use
     5    # nix-editor directly too, so nix-editor is already in the
     6    # environment.
     7    inputs.nix-editor.url = "github:replit/nix-editor";
     8    inputs.nix-editor.inputs.nixpkgs.follows = "nixpkgs";
     9  
    10    inputs.build-go-cache.url = "github:numtide/build-go-cache";
    11    inputs.build-go-cache.inputs.nixpkgs.follows = "nixpkgs";
    12  
    13    outputs = {
    14      self,
    15      nixpkgs,
    16      nix-editor,
    17      build-go-cache,
    18    }: let
    19      systems = [
    20        "aarch64-darwin"
    21        "aarch64-linux"
    22        "x86_64-darwin"
    23        "x86_64-linux"
    24      ];
    25      eachSystem = nixpkgs.lib.genAttrs systems;
    26      rev =
    27        if self ? rev
    28        then "0.0.0-${builtins.substring 0 7 self.rev}"
    29        else "0.0.0-dirty";
    30    in {
    31      packages = eachSystem (system:
    32        import ./nix {
    33          inherit self nixpkgs rev system nix-editor;
    34          inherit (build-go-cache.legacyPackages.${system}) buildGoCache;
    35        });
    36      devShells = eachSystem (system: {
    37        default = self.packages.${system}.devShell;
    38      });
    39      formatter = eachSystem (system: self.packages.${system}.fmt);
    40    };
    41  }