dream2nix/flake.nix

61 lines
1.6 KiB
Nix
Raw Normal View History

{
description = "dream2nix: A generic framework for 2nix tools";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
2021-09-14 05:00:29 +03:00
npmlock2nix = { url = "github:nix-community/npmlock2nix"; flake = false; };
};
2021-09-14 05:00:29 +03:00
outputs = { self, nixpkgs, npmlock2nix }:
let
2021-09-14 05:00:29 +03:00
lib = nixpkgs.lib;
supportedSystems = [ "x86_64-linux" ];
forAllSystems = f: lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
2021-09-14 05:00:29 +03:00
dream2nixFor = forAllSystems (system: import ./src rec {
pkgs = nixpkgsFor."${system}";
2021-09-17 15:12:07 +03:00
inherit lib;
2021-09-14 05:00:29 +03:00
externalSources = pkgs.runCommand "dream2nix-imported" {} ''
mkdir -p $out/npmlock2nix
cp ${npmlock2nix}/{internal.nix,LICENSE} $out/npmlock2nix/
'';
});
in
{
overlay = curr: prev: {};
2021-09-16 17:05:31 +03:00
lib.dream2nix = dream2nixFor;
2021-09-13 20:08:28 +03:00
defaultApp = forAllSystems (system: self.apps."${system}".cli);
apps = forAllSystems (system: {
2021-09-13 20:08:28 +03:00
cli = {
"type" = "app";
2021-09-13 20:08:28 +03:00
"program" = builtins.toString (dream2nixFor."${system}".apps.cli);
};
install = {
"type" = "app";
"program" = builtins.toString (dream2nixFor."${system}".apps.install);
};
});
2021-09-16 17:05:31 +03:00
devShell = forAllSystems (system: nixpkgsFor."${system}".mkShell {
buildInputs = with nixpkgsFor."${system}"; [
nixUnstable
];
2021-09-16 17:05:31 +03:00
shellHook = ''
export NIX_PATH=nixpkgs=${nixpkgs}
'';
});
};
}