1
0
forked from nikkuss/pkgs

add(flake.nix): bun2nix

This commit is contained in:
2026-06-07 18:21:56 +01:00
parent 5ae28029ef
commit e23169c699
2 changed files with 159 additions and 79 deletions
Generated
+82 -1
View File
@@ -1,8 +1,52 @@
{ {
"nodes": { "nodes": {
"bun2nix": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1778446047,
"narHash": "sha256-oQvcadh2BCkrog+SGrG6YffKJrveYpjj3TdQJWaKhaM=",
"owner": "nix-community",
"repo": "bun2nix",
"rev": "f2bc12af1a6369648aac41041ceeaa0b866599c6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "bun2nix",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"bun2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1777988971,
"narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@@ -36,6 +80,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"bun2nix": "bun2nix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
@@ -54,6 +99,42 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"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": 1775636079,
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",
+21 -22
View File
@@ -4,48 +4,49 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
# Added for oh-my-pi
bun2nix.url = "github:nix-community/bun2nix";
bun2nix.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs = {
{
self, self,
nixpkgs, nixpkgs,
bun2nix,
flake-utils, flake-utils,
}@inputs: } @ inputs: (
(nixpkgs.lib.recursiveUpdate nixpkgs.lib.recursiveUpdate
(flake-utils.lib.eachSystem (
flake-utils.lib.eachSystem
[ [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
] ]
( (
system: system: let
let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [bun2nix.overlays.default];
config = { config = {
allowUnfree = true; allowUnfree = true;
}; };
}; };
inherit (pkgs) lib; inherit (pkgs) lib;
scope = lib.makeScope pkgs.newScope (final: self.overlays.default (pkgs // final) pkgs); scope = lib.makeScope pkgs.newScope (final: self.overlays.default (pkgs // final) pkgs);
recursePackage = recursePackage = name: pkg: let
name: pkg:
let
isDrv = lib.isDerivation pkg; isDrv = lib.isDerivation pkg;
isAttrs = lib.isAttrs pkg; isAttrs = lib.isAttrs pkg;
isSameSystem = lib.meta.availableOn pkgs.stdenv.hostPlatform pkg; isSameSystem = lib.meta.availableOn pkgs.stdenv.hostPlatform pkg;
in in
if !isSameSystem then if !isSameSystem
[ ] then []
else if isDrv then else if isDrv
[ then [
(lib.nameValuePair name pkg) (lib.nameValuePair name pkg)
] ]
else if isAttrs then else if isAttrs
lib.mapAttrsToList (nameNew: subPkg: recursePackage "${name}-${nameNew}" subPkg) pkg then lib.mapAttrsToList (nameNew: subPkg: recursePackage "${name}-${nameNew}" subPkg) pkg
else else [];
[ ];
flatPackages = builtins.listToAttrs ( flatPackages = builtins.listToAttrs (
lib.lists.flatten (lib.mapAttrsToList (name: pkg: recursePackage name pkg) scope) lib.lists.flatten (lib.mapAttrsToList (name: pkg: recursePackage name pkg) scope)
); );
@@ -69,8 +70,7 @@
# packageSets = lib.filterAttrsRecursive (k: v: v != null && k != "override") ( # packageSets = lib.filterAttrsRecursive (k: v: v != null && k != "override") (
# lib.mapAttrs (name: pkg: recursePackageSets pkg) scope # lib.mapAttrs (name: pkg: recursePackageSets pkg) scope
# ); # );
in in {
{
overlays = final: prev: flatPackages; overlays = final: prev: flatPackages;
packages = flatPackages; packages = flatPackages;
checks = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") workingPackages; checks = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") workingPackages;
@@ -82,8 +82,7 @@
) )
{ {
overlays = { overlays = {
default = default = final: prev: ((import "${nixpkgs}/pkgs/top-level/by-name-overlay.nix" ./pkgs/by-name) final prev);
final: prev: ((import "${nixpkgs}/pkgs/top-level/by-name-overlay.nix" ./pkgs/by-name) final prev);
}; };
} }
); );