Skip to content

Commit

Permalink
feat(flake.nix): Add dmd, ldc and dub as Flake outputs
Browse files Browse the repository at this point in the history
* Add `pkgs/default.nix` file that imports all packages
* Add `dmd`, `ldc` and `dub` to `perSystem.packages` section
* Use `flake-parts.flakeModules.easyOverlay` to derive an overlay

Result:

    > nix flake show

    ...
    ├───overlays
    │   └───default: Nixpkgs overlay
    └───packages
        ├───x86_64-linux
        │   ├───dmd: package 'dmd-2.098.0'
        │   ├───dub: package 'dub-1.27.0'
        │   └───ldc: package 'ldc-1.28.0'
        ...
  • Loading branch information
PetarKirov committed Apr 21, 2023
1 parent b69edf3 commit 56792be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
imports = [./pkgs];
perSystem = {pkgs, ...}: {
devShells.default = import ./shell.nix {inherit pkgs;};
};
Expand Down
23 changes: 23 additions & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{inputs, ...}: {
imports = [inputs.flake-parts.flakeModules.easyOverlay];

perSystem = {
self',
pkgs,
...
}: let
inherit (pkgs) callPackage;
darwinPkgs = {
inherit (pkgs.darwin.apple_sdk.frameworks) Foundation;
};
in {
overlayAttrs = self'.packages;
packages = {
dmd = callPackage ./dmd ({} // darwinPkgs);

ldc = callPackage ./ldc {};

dub = callPackage ./dub {};
};
};
}

0 comments on commit 56792be

Please sign in to comment.