nixify the project

This commit is contained in:
Chris Kruining 2025-09-18 09:25:20 +02:00
parent 33aaf78f7d
commit 35f95fcac1
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
10 changed files with 5508 additions and 1 deletions

2
.envrc Normal file
View file

@ -0,0 +1,2 @@
# shellcheck shell=bash
use flake

8
.gitignore vendored
View file

@ -26,3 +26,11 @@ gitignore
# System Files
.DS_Store
Thumbs.db
# ---> Nix
# Ignore build outputs from performing a nix-build or `nix build` command
result
result-*
# Ignore automatically generated direnv output
.direnv

1301
bun.lock Normal file

File diff suppressed because it is too large Load diff

BIN
bun.lockb

Binary file not shown.

3996
bun.nix Normal file

File diff suppressed because it is too large Load diff

133
flake.lock generated Normal file
View file

@ -0,0 +1,133 @@
{
"nodes": {
"blueprint": {
"inputs": {
"nixpkgs": [
"bun2nix",
"nixpkgs"
],
"systems": [
"bun2nix",
"systems"
]
},
"locked": {
"lastModified": 1744632722,
"narHash": "sha256-0chvqUV1Kzf8BMQ7MsH3CeicJEb2HeCpwliS77FGyfc=",
"owner": "numtide",
"repo": "blueprint",
"rev": "49bbd5d072b577072f4a1d07d4b0621ecce768af",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "blueprint",
"type": "github"
}
},
"bun2nix": {
"inputs": {
"blueprint": "blueprint",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1758108094,
"narHash": "sha256-ZO7dOTEipchkK/2mX6uAGbe6zQXnvHr40ri6jOztNR4=",
"owner": "baileyluTCD",
"repo": "bun2nix",
"rev": "72c047583edc83e2c2eada6e348dfaa622781331",
"type": "github"
},
"original": {
"owner": "baileyluTCD",
"repo": "bun2nix",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1756770412,
"narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "4524271976b625a4a605beefd893f270620fd751",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1758035966,
"narHash": "sha256-qqIJ3yxPiB0ZQTT9//nFGQYn8X/PBoJbofA7hRKZnmE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8d4ddb19d03c65a36ad8d189d001dc32ffb0306b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"bun2nix": "bun2nix",
"flake-parts": "flake-parts",
"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"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"bun2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1748243702,
"narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View file

@ -0,0 +1,38 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
bun2nix = {
url = "github:baileyluTCD/bun2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
imports = [
./nix/devShells/flake-module.nix
./nix/packages/flake-module.nix
];
perSystem = { lib, self', ... }: {
checks =
let
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
in
packages // devShells;
};
};
}

View file

@ -0,0 +1,11 @@
{ inputs, ... }:
{
perSystem = { pkgs, system, ... }: {
devShells.default = pkgs.mkShellNoCC {
nativeBuildInputs = with pkgs; [
bun
inputs.bun2nix.packages.${system}.default
];
};
};
}

View file

@ -0,0 +1,17 @@
{ self, inputs, ... }:
{
perSystem = { pkgs, self', system, ... }: {
packages = {
default = self'.packages.customer-portal;
customer-portal = inputs.bun2nix.lib.${system}.mkBunDerivation {
pname = "customer-portal";
version = "0.0.1";
index = "app.config.ts";
src = ../..;
bunNix = ./bun.nix;
};
};
};
}

View file

@ -5,7 +5,8 @@
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start",
"version": "vinxi version"
"version": "vinxi version",
"postinstall": "bun2nix -o bun.nix"
},
"dependencies": {
"@solid-primitives/context": "^0.3.2",