Simplify and improve flake.nix

This commit is contained in:
thiloho
2023-09-23 15:16:14 +02:00
parent 5ec13fc044
commit 9422522877
2 changed files with 27 additions and 37 deletions

View File

@@ -1,39 +1,28 @@
{
description = "JavaScript development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs }:
let
# Systems supported
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
nodejs_20
tree
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = nixpkgs.legacyPackages.${system};
});
in
{
packages = forAllSystems ({ pkgs }: {
default = pkgs.buildNpmPackage {
name = "build-aurora-blog";
buildInputs = with pkgs; [
nodejs_20
];
src = ./.;
npmDepsHash = "sha256-hIfaaeKbS+Whav575OyIX1c9GoL6qks12zhHZB2w9IA=";
npmBuild = "npm run build";
installPhase = ''
mkdir $out
cp -r dist/* $out
'';
};
});
};
packages.${system}.default = pkgs.buildNpmPackage {
name = "build-aurora-blog";
buildInputs = with pkgs; [
nodejs_20
];
src = ./.;
npmDepsHash = "sha256-hIfaaeKbS+Whav575OyIX1c9GoL6qks12zhHZB2w9IA=";
npmBuild = "npm run build";
installPhase = ''
mkdir $out
cp -r dist/* $out
'';
};
};
}