dream2nix/examples/d2n-init-pkgs/flake.nix
Yusuf Bera Ertan 9b6638a1a7
feat: implement makeOutputs that outputs systemless structure (#161)
* feat: return underlying d2n instance if pkgs was passed to init, document init pkgs

* feat: implement makeOutputs

* tests: dont fail if resolveImpure fails

* feat: make init return a dream2nix instance, rework makeFlakeOutputs code

* feat: default to source if config.projectRoot is not specified, update examples and readme

* fix: update the simple template

* docs: clarify init in readme

* docs: change readme numbering to back to 1

* refactor: dont default projectRoot to source

* docs: make extensive example use makeFlakeOutputs, link per-pkgs d2n example in readme

* fix: call loadConfig correctly
2022-06-01 22:53:46 +02:00

46 lines
1.0 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
dream2nix.url = "path:../..";
dream2nix.inputs.nixpkgs.follows = "nixpkgs";
src.url = "github:BurntSushi/ripgrep/13.0.0";
src.flake = false;
};
outputs = inp: let
l = inp.nixpkgs.lib // builtins;
allPkgs =
l.map
(system: inp.nixpkgs.legacyPackages.${system})
["x86_64-linux" "aarch64-linux"];
initD2N = pkgs:
inp.dream2nix.lib.init {
inherit pkgs;
config.projectRoot = ./.;
};
makeOutputs = pkgs: let
outputs = (initD2N pkgs).makeOutputs {
source = inp.src;
settings = [
{
builder = "build-rust-package";
translator = "cargo-lock";
}
];
};
in rec {
packages.${pkgs.system} = outputs.packages;
checks.${pkgs.system} = {
inherit (outputs.packages) ripgrep;
};
};
allOutputs = l.map makeOutputs allPkgs;
outputs = l.foldl' l.recursiveUpdate {} allOutputs;
in
outputs;
}