# vim: ft=nix : { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; flake-utils.url = "github:numtide/flake-utils/main"; nix-filter.url = "github:numtide/nix-filter/main"; cq = { url = "github:vinszent/cq-flake/main"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; }; description = "clef: kicad shared data and utils"; outputs = { self, nixpkgs, flake-utils, ... } @ inputs: (flake-utils.lib.eachDefaultSystem (system: { packages = let packages = nixpkgs.legacyPackages.${system}.callPackages ./nix/pkgs {}; pkgs = import nixpkgs { inherit system; overlays = with self.overlays; [ kicad nix-filter (final: prev: packages) ]; }; clef = pkgs.callPackage ./nix; in packages // { inherit clef; default = clef; }; devShells.default = let pkgs = import nixpkgs { inherit system; overlays = with self.overlays; [ kicad ]; }; in pkgs.mkShell { name = "devshell"; version = self.rev or "dirty"; packages = with pkgs; [ kicad kikit ]; }; } )) // { overlays = let base = (import ./overlays.nix { inherit inputs; }); in base // { # clef built against its own nixpkgs import with its required overlay # deps (kicad, occt). # # _This will cause another evaluation of nixpkgs_, which is generally # undesirable. However, this provides for the most hassle-free way to # use clef, as you don't need to include all of the overlay dependencies # in your nixpkgs. default = final: prev: { inherit (self.packages.${prev.system}) clef; }; # No overlay dependencies included -- clef will not work by default. # You can replicate overlays.default with: # # import nixpkgs { overlays = with clef.overlays; [ freestanding kicad nix-filter ]; } # # Assuming you've pinned clef's nixpkgs to the same version as yours. # This functionality is provided to give you an option freestanding = final: prev: (prev.callPackage ./nix/pkgs {}) { clef = prev.callPackage ./nix; }; }; }; }