refactor: flake

This commit is contained in:
emily 2024-08-15 23:57:31 +02:00 committed by April John
parent 4e6e3425ce
commit f678d51542
2 changed files with 60 additions and 42 deletions

View file

@ -1,37 +1,36 @@
{
description = "JavaScript example flake for Zero to Nix";
description = "Lysand Server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-compat }:
let
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bun
nodejs
nodePackages.typescript
nodePackages.typescript-language-server
nix-ld
];
};
});
outputs = { self, nixpkgs, flake-utils }: {
hydraJobs = {
inherit (self) packages;
};
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in {
packages = {
versiajs = pkgs.callPackage ./nix/package.nix {};
default = self.packages.${system}.versiajs;
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bun
nodejs
nodePackages.typescript
nodePackages.typescript-language-server
nix-ld
];
};
};
});
}