refactor: flake

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

View file

@ -1,26 +1,30 @@
{ {
"nodes": { "nodes": {
"flake-compat": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1710146030,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "owner": "numtide",
"revCount": 57, "repo": "flake-utils",
"type": "tarball", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" "type": "github"
}, },
"original": { "original": {
"type": "tarball", "owner": "numtide",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" "repo": "flake-utils",
"type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1723320709, "lastModified": 1723703277,
"narHash": "sha256-DeKCsLQsS58D8TB/cTjXs2x8XMvsyv2JVxcF0Hu6pu8=", "narHash": "sha256-nk0RaUB5f68BwtXAYy3WAjqFhVKqIl9Z89RGycTa2vk=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e1d92cda6fd1bcec60e4938ce92fcee619eea793", "rev": "8b908192e64224420e2d59dfd9b2e4309e154c5d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -32,9 +36,24 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -1,28 +1,27 @@
{ {
description = "JavaScript example flake for Zero to Nix"; description = "Lysand Server";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 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 }: outputs = { self, nixpkgs, flake-utils }: {
hydraJobs = {
inherit (self) packages;
};
} // flake-utils.lib.eachDefaultSystem (system:
let let
# Systems supported pkgs = import nixpkgs {
allSystems = [ inherit system;
"x86_64-linux" # 64-bit Intel/AMD Linux };
"aarch64-linux" # 64-bit ARM Linux in {
"x86_64-darwin" # 64-bit Intel macOS packages = {
"aarch64-darwin" # 64-bit ARM macOS versiajs = pkgs.callPackage ./nix/package.nix {};
]; default = self.packages.${system}.versiajs;
};
# Helper to provide system-specific attributes devShells = {
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
bun bun
@ -32,6 +31,6 @@
nix-ld nix-ld
]; ];
}; };
});
}; };
});
} }