flake reorg

This commit is contained in:
Robin Appelman 2024-01-03 18:17:20 +01:00
commit 7132e6b277
3 changed files with 22 additions and 13 deletions

View file

@ -19,25 +19,15 @@
(final: prev: {
npmlock2nix = prev.callPackage npmlock2nix {};
})
(import ./overlay.nix)
];
pkgs = import nixpkgs {
inherit system overlays;
};
lib = pkgs.lib;
src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["package.*" "src(/.*)?" "tsconfig.json" ".*.config.js"];
nodeModules = pkgs.npmlock2nix.v2.node_modules {
inherit src;
nodejs = pkgs.nodejs_20;
};
in rec {
packages = rec {
map-boundaries = pkgs.npmlock2nix.v2.build {
inherit src;
installPhase = "cp -r build $out";
buildCommands = [ "npm run build" ];
nodejs = pkgs.nodejs_20;
};
node_modules = nodeModules;
map-boundaries = pkgs.map-boundaries;
default = map-boundaries;
};
devShells.default = pkgs.mkShell {
@ -45,5 +35,8 @@
nodejs_20
];
};
});
})
// {
overlays.default = import ./overlay.nix;
};
}

3
overlay.nix Normal file
View file

@ -0,0 +1,3 @@
prev: final: {
map-boundaries = final.callPackage ./package.nix {};
}

13
package.nix Normal file
View file

@ -0,0 +1,13 @@
{
npmlock2nix,
nodejs_20,
lib,
}: let
src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["package.*" "src(/.*)?" "tsconfig.json" ".*.config.js"];
in
npmlock2nix.v2.build {
inherit src;
installPhase = "cp -r build $out";
buildCommands = ["npm run build"];
nodejs = nodejs_20;
}