2023-10-31 14:26:26 +03:00
|
|
|
{
|
2024-06-28 19:29:28 +03:00
|
|
|
# This example flake.nix is pretty generic and the same for all
|
|
|
|
# examples, except when they define devShells or extra packages.
|
|
|
|
description = "Dream2nix example flake";
|
2023-10-31 14:26:26 +03:00
|
|
|
|
2024-06-28 19:29:28 +03:00
|
|
|
# We import the latest commit of dream2nix main branch and instruct nix to
|
|
|
|
# re-use the nixpkgs revision referenced by dream2nix.
|
|
|
|
# This is what we test in CI with, but you can generally refer to any
|
|
|
|
# recent nixpkgs commit here.
|
2023-10-31 14:26:26 +03:00
|
|
|
inputs = {
|
|
|
|
dream2nix.url = "github:nix-community/dream2nix";
|
|
|
|
nixpkgs.follows = "dream2nix/nixpkgs";
|
|
|
|
};
|
|
|
|
|
2024-06-28 19:29:28 +03:00
|
|
|
outputs = {
|
2023-10-31 14:26:26 +03:00
|
|
|
self,
|
|
|
|
dream2nix,
|
|
|
|
nixpkgs,
|
|
|
|
}: let
|
2024-06-28 19:29:28 +03:00
|
|
|
# A helper that helps us define the attributes below for
|
|
|
|
# all systems we care about.
|
|
|
|
eachSystem = nixpkgs.lib.genAttrs [
|
|
|
|
"aarch64-darwin"
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
2023-10-31 14:26:26 +03:00
|
|
|
in {
|
2024-06-28 19:29:28 +03:00
|
|
|
packages = eachSystem (system: {
|
|
|
|
# For each system, we define our default package
|
|
|
|
# by passing in our desired nixpkgs revision plus
|
|
|
|
# any dream2nix modules needed by it.
|
|
|
|
default = dream2nix.lib.evalModules {
|
|
|
|
packageSets.nixpkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
modules = [
|
|
|
|
# Import our actual package definiton as a dream2nix module from ./default.nix
|
|
|
|
./default.nix
|
|
|
|
{
|
|
|
|
# Aid dream2nix to find the project root. This setup should also works for mono
|
|
|
|
# repos. If you only have a single project, the defaults should be good enough.
|
|
|
|
paths.projectRoot = ./.;
|
|
|
|
# can be changed to ".git" or "flake.nix" to get rid of .project-root
|
|
|
|
paths.projectRootFile = "flake.nix";
|
|
|
|
paths.package = ./.;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
2023-10-31 14:26:26 +03:00
|
|
|
};
|
|
|
|
}
|