diff options
Diffstat (limited to 'clef/flake.nix')
| -rw-r--r-- | clef/flake.nix | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/clef/flake.nix b/clef/flake.nix new file mode 100644 index 0000000..66e350f --- /dev/null +++ b/clef/flake.nix @@ -0,0 +1,81 @@ +# 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 + pkgs = import nixpkgs { + inherit system; + + overlays = with self.overlays; [ + kicad + nix-filter + ]; + }; + + clef = pkgs.callPackage ./nix; + in { + 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 (cadquery, 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: { + clef = self.packages.${prev.system}.default; + }; + + # 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: { + clef = prev.callPackage ./nix; + }; + }; + }; +} |
