flake: huge rework
Some checks failed
nix / check (push) Failing after 1m15s

flake: fix name conventions
flake: configurations -> lib.preconfiguredModules
flake.packages: rework platform dependency with convient module and
evaluator `lib.collectPackages`
packages.bonfire-docs: convient evaluators `nixosModulesDoc` and
`packagesDoc`
new: packages.postgresql: container image
new: packages.redis: container image
remove: packages.lego: needed dns provider was added to lego and nixpkgs
packages.netgen: broken
This commit is contained in:
L-Nafaryus 2024-07-18 15:49:05 +05:00
parent aced5139a1
commit a4d8f5232e
Signed by: L-Nafaryus
GPG Key ID: 553C97999B363D38
34 changed files with 744 additions and 354 deletions

View File

@ -1,6 +1,6 @@
<p align="center">
<a href="https://github.com/L-Nafaryus/bonfire">
<img src="https://raw.githubusercontent.com/L-Nafaryus/bonfire/master/etc/bonfire-logo.png" width="500px" alt="bonfire-logo"/>
<a href="https://vcs.elnafo.ru/L-Nafaryus/bonfire">
<img src="https://vcs.elnafo.ru/L-Nafaryus/bonfire/raw/branch/master/packages/bonfire-docs/bonfire-logo.png" width="500px" alt="bonfire-logo"/>
</a>
</p>

View File

@ -1,7 +0,0 @@
{
self,
inputs,
...
}: {
bonvim = ./bonvim.nix;
}

View File

@ -2,8 +2,14 @@
description = "Derivation lit";
nixConfig = {
extra-substituters = ["https://bonfire.cachix.org"];
extra-trusted-public-keys = ["bonfire.cachix.org-1:mzAGBy/Crdf8NhKail5ciK7ZrGRbPJJobW6TwFb7WYM="];
extra-substituters = [
"https://cache.elnafo.ru"
"https://bonfire.cachix.org"
];
extra-trusted-public-keys = [
"cache.elnafo.ru:j3VD+Hn+is2Qk3lPXDSdPwHJQSatizk7V82iJ2RP1yo="
"bonfire.cachix.org-1:mzAGBy/Crdf8NhKail5ciK7ZrGRbPJJobW6TwFb7WYM="
];
};
inputs = {
@ -48,67 +54,28 @@
};
};
outputs = {
self,
nixpkgs,
home-manager,
nixos-mailserver,
sops-nix,
crane,
fenix,
catppuccin,
oscuro,
...
} @ inputs: let
lib = import ./lib {inherit (nixpkgs) lib;};
outputs = {self, ...} @ inputs: let
lib = inputs.nixpkgs.lib;
bonLib = import ./lib {inherit lib;};
bonModules = self.nixosModules;
# no bonPkgs, it must be defined by appropriate system + skip a possible infinite recursion
in {
inherit lib;
lib = bonLib;
nixosConfigurations = {
astora = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
./nixosConfigurations/astora
self.nixosModules.bonfire
self.nixosModules.spoofdpi
(import ./nixosModules {
lib = nixpkgs.lib;
self = self;
})
.configModule
];
specialArgs = {inherit self inputs;};
packages = import ./packages {inherit lib bonLib self inputs;};
nixosModules = import ./nixosModules {
inherit lib bonLib self;
check = false;
};
catarina = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-mailserver.nixosModules.mailserver
sops-nix.nixosModules.sops
oscuro.nixosModules.oscuro
./nixosConfigurations/catarina
self.nixosModules.bonfire
self.nixosModules.spoofdpi
self.nixosModules.papermc
self.nixosModules.qbittorrent-nox
(import ./nixosModules {
lib = nixpkgs.lib;
self = self;
})
.configModule
];
specialArgs = {inherit self;};
};
};
nixosConfigurations = import ./nixosConfigurations {inherit lib inputs bonModules bonLib self;};
nixosModules =
lib.importNamedModules
(import ./nixosModules {
lib = nixpkgs.lib;
self = self;
})
.modules;
hydraJobs = {
# filter broken packages ?
packages = lib.filterAttrsRecursive (name: value: !bonLib.isBroken value) self.packages;
};
templates = {
rust = {
@ -117,16 +84,14 @@
};
};
packages = import ./packages {inherit self inputs;};
apps = import ./apps {
inherit self;
inherit (inputs) nixpkgs;
};
apps = import ./apps {inherit self nixpkgs;};
devShells = import ./devShells {inherit self nixpkgs;};
configurations = import ./configurations {inherit self inputs;};
hydraJobs = {
inherit (self) packages;
devShells = import ./devShells {
inherit self;
inherit (inputs) nixpkgs;
};
};
}

View File

@ -1,17 +1,97 @@
{lib, ...}: rec {
maintainers = import ./maintainers.nix;
moduleName = path:
nameFromPath = path:
if builtins.baseNameOf (toString path) == "default.nix"
then builtins.baseNameOf (lib.removeSuffix "/default.nix" (toString path))
else builtins.baseNameOf (lib.removeSuffix ".nix" (toString path));
moduleNames = pathList: map (path: moduleName path) pathList;
preconfiguredModules = lib.listToAttrs (map (path: {
name = nameFromPath path;
value = import path;
})
[
./preconfiguredModules/bonvim.nix
]);
importModules = pathList: map (path: import path) pathList;
isBroken = derivation: derivation ? meta && derivation.meta ? broken && derivation.meta.broken;
importNamedModules = pathList:
lib.listToAttrs (
lib.zipListsWith (name: value: {inherit name value;}) (moduleNames pathList) (importModules pathList)
);
functionType = lib.types.mkOptionType {
name = "function";
check = value: builtins.isFunction value;
};
platformType = lib.types.mkOptionType {
name = "platform";
check = value: builtins.isString value && lib.any (v: v == value) lib.platforms.all;
};
packageType = with lib;
types.submodule {
options = {
source = mkOption {
type = types.oneOf [types.path functionType];
description = "Path to file with expression to build derivation or expression";
};
platforms = mkOption {
type = types.listOf platformType;
description = "List of supported platforms";
};
builder = mkOption {
type = functionType;
description = "Function with platform specific inputs that call final build function";
example = "{pkgs, ...}: pkgs.callPackage";
};
extraArgs = mkOption {
type = types.attrs;
default = {};
description = "Extra arguments passed to builder inputs. Platform is not configured for this arguments";
};
};
};
packagesModuleOptions = {...}:
with lib; {
options = {
packages = mkOption {
type = types.attrsOf packageType;
default = {};
description = "Set of defined packages";
};
};
};
collectPackages = platformInputs: packagesAttrs: let
packages =
(lib.evalModules {
modules = [
packagesModuleOptions
({...}: {
packages = packagesAttrs;
})
];
})
.config
.packages;
packagesList = lib.attrsToList packages;
evaluateDerivation = system: name: package: let
platInputs =
if functionType.check platformInputs
then (platformInputs system) // package.extraArgs
else throw "`plaformInputs` must be a function: `system` -> {...}";
platformBuilder = package.builder platInputs;
derivation = platformBuilder package.source platInputs;
in {${name} = derivation;};
evaluatedPackages = map ({
name,
value,
}:
lib.genAttrs value.platforms (
system: evaluateDerivation system name value
))
packagesList;
in
lib.mapAttrs (name: value: lib.mergeAttrsList value) (lib.zipAttrs evaluatedPackages);
}

View File

@ -14,8 +14,16 @@
experimental-features = ["nix-command" "flakes" "repl-flake"];
trusted-users = ["l-nafaryus"];
allowed-users = ["l-nafaryus"];
substituters = ["https://nix-community.cachix.org"];
trusted-public-keys = ["nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="];
substituters = [
"https://cache.elnafo.ru"
"https://bonfire.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.elnafo.ru:j3VD+Hn+is2Qk3lPXDSdPwHJQSatizk7V82iJ2RP1yo="
"bonfire.cachix.org-1:mzAGBy/Crdf8NhKail5ciK7ZrGRbPJJobW6TwFb7WYM="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
auto-optimise-store = true;
};
gc = {

View File

@ -2,7 +2,7 @@
config,
pkgs,
lib,
self,
bonPkgs,
inputs,
...
}: {
@ -83,6 +83,8 @@
gxplugins-lv2
xtuner
aether-lv2
aeolus
grandorgue
qbittorrent
transmission_3-qt
@ -91,7 +93,7 @@
onlyoffice-bin
jdk
self.packages.${pkgs.system}.ultimmc
bonPkgs.ultimmc
liberation_ttf
@ -120,7 +122,7 @@
wl-clipboard
cliphist
tree
self.packages.${pkgs.system}.bonvim
bonPkgs.bonvim
];
xdg.portal = {

View File

@ -2,11 +2,9 @@
config,
pkgs,
lib,
self,
bonPkgs,
...
}: let
bonfire-pkgs = self.packages.${pkgs.system};
in {
}: {
system.stateVersion = "23.11";
imports = [
@ -23,10 +21,12 @@ in {
trusted-users = ["l-nafaryus"];
allowed-users = ["l-nafaryus" "hydra" "hydra-www"];
substituters = [
"https://cache.elnafo.ru"
"https://bonfire.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.elnafo.ru:j3VD+Hn+is2Qk3lPXDSdPwHJQSatizk7V82iJ2RP1yo="
"bonfire.cachix.org-1:mzAGBy/Crdf8NhKail5ciK7ZrGRbPJJobW6TwFb7WYM="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
@ -139,7 +139,7 @@ in {
"bonfire.elnafo.ru" = {
forceSSL = true;
useACMEHost = "elnafo.ru";
locations."/".root = "${bonfire-pkgs.bonfire-docs}";
locations."/".root = "${bonPkgs.bonfire-docs}";
};
"hydra.elnafo.ru" = {

View File

@ -1,7 +1,6 @@
{
config,
pkgs,
lib,
...
}: {
# Users

View File

@ -0,0 +1,33 @@
{
lib,
inputs,
bonModules,
bonLib,
self,
...
}: {
astora = lib.nixosSystem {
system = "x86_64-linux";
modules = with inputs; [
home-manager.nixosModules.home-manager
bonModules.bonfire
./astora
];
specialArgs = {
inherit inputs;
bonPkgs = self.packages.x86_64-linux;
};
};
catarina = lib.nixosSystem {
system = "x86_64-linux";
modules = with inputs; [
nixos-mailserver.nixosModules.mailserver
sops-nix.nixosModules.sops
oscuro.nixosModules.oscuro
bonModules.bonfire
./catarina
];
specialArgs = {bonPkgs = self.packages.x86_64-linux;};
};
}

View File

@ -1,10 +1,11 @@
{
lib,
check ? true,
bonLib,
self,
check ? true,
...
}: rec {
modules = [
}: let
moduleList = [
./misc/bonfire/default.nix
./services/papermc.nix
./services/qbittorrent-nox.nix
@ -17,11 +18,38 @@
...
}: {
config = {
# Module type checking
# module type checking
_module.check = check;
#_module.args.baseModules = modules;
#_module.args.pkgs = lib.mkDefault pkgs;
_module.args.bonpkgs = self.packages.${pkgs.system};
# extra arguments
_module.args = {
bonPkgs = self.packages.${pkgs.system};
};
};
}
};
importedModules =
map (path: {...}: {
# imports provide path for each module needed for documentation
# inject module configuration
imports = [path configModule];
})
moduleList;
importedModuleNames = map (path: bonLib.nameFromPath path) moduleList;
bonfireModule = {
config,
pkgs,
...
}: {
# collect all modules
imports = importedModules;
};
in
lib.listToAttrs (
lib.zipListsWith (name: value: {inherit name value;}) importedModuleNames importedModules
)
// {
bonfire = bonfireModule;
default = bonfireModule;
}

View File

@ -1,7 +1,7 @@
{
config,
lib,
bonpkgs,
bonPkgs,
...
}:
with lib; let
@ -12,8 +12,8 @@ in {
package = mkOption {
type = types.package;
default = bonpkgs.spoofdpi;
defaultText = literalExpression "bonpkgs.spoofdpi";
default = bonPkgs.spoofdpi;
defaultText = literalExpression "bonPkgs.spoofdpi";
description = "The package to use.";
};

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -14,3 +14,4 @@ no-section-label = true
git-repository-url = "https://vcs.elnafo.ru/L-Nafaryus/bonfire"
git-repository-icon = "fa-git"
cname = "elnafo.ru"
fold.enable = true

View File

@ -1,150 +1,39 @@
{
bonfire,
bonLib,
bonModules,
self,
lib,
pkgs,
...
}: let
version = bonfire.shortRev or bonfire.dirtyShortRev or "unknown";
projectPath = ../../.;
modulesPath = ../../nixosModules;
version = "unknown";
links = [
nixosModulesDoc = import ./nixosModulesDoc.nix {
inherit lib pkgs version;
modules = bonModules;
root = ../../.;
declarations = [
{
hostname = "vcs-elnafo";
name = "elnafo-vcs";
url = "https://vcs.elnafo.ru/L-Nafaryus/bonfire/src/branch/master";
}
{
hostname = "github";
name = "github";
url = "https://github.com/L-Nafaryus/bonfire/blob/master";
}
];
formatDeclaration = declaration:
if lib.hasPrefix (toString modulesPath) (toString declaration)
then let
subpath = lib.removePrefix (toString projectPath + "/") (toString declaration);
in
map ({
hostname,
url,
}: {
url = "${url}/${subpath}";
name = "<${hostname}:bonfire/${subpath}>";
})
links
else
# skip external declarations
lib.singleton declaration;
nixosModules = import modulesPath {
inherit lib;
self = bonfire;
check = false;
projectName = "bonfire";
modulesPrefix = ../../nixosModules;
};
evaluatedModules = lib.evalModules {
modules = nixosModules.modules ++ [nixosModules.configModule];
packagesDoc = import ./packagesDoc.nix {
inherit lib pkgs;
packages = self.packages;
repoUrl = "https://vcs.elnafo.ru/L-Nafaryus/bonfire/src/branch/master";
hydraUrl = "https://hydra.elnafo.ru/job/bonfire/master";
};
optionsDoc = pkgs.nixosOptionsDoc {
options = builtins.removeAttrs evaluatedModules.options [
"_module"
"system"
];
transformOptions = option:
option
// {
declarations = lib.unique (
lib.flatten (map (declaration: formatDeclaration declaration) option.declarations)
++ option.declarations
);
};
documentType = "none";
revision = version;
};
systems = builtins.attrNames bonfire.packages;
derivations = lib.flatten (
map (packages: (
map (name: packages.${name}) (builtins.attrNames packages)
)) (map (system: bonfire.packages.${system}) systems)
);
renderMaintainers = maintainers:
lib.concatStringsSep ", " (
let
maintainer = mt:
if mt ? github
then "[${mt.name}](https://github.com/${mt.github})"
else mt.name;
email = mt:
if mt ? email
then "<[${mt.email}](mailto:${mt.email})>"
else "";
in
map (mt: maintainer mt + email mt) maintainers
);
renderPlatforms = platforms:
if platforms != lib.platforms.none
then
if platforms == lib.platforms.all
then "all"
else lib.concatStringsSep ", " (map (platform: "__${platform}__") platforms)
else "";
renderPackage = drv: ''
## ${drv.pname}
${lib.optionalString (drv.meta ? description) drv.meta.description}
${lib.optionalString (drv.meta ? homepage) "[Homepage](${drv.meta.homepage})"}
Version: __${drv.version}__
${lib.optionalString (drv.meta ? license) "License: [${drv.meta.license.fullName}](${drv.meta.license.url})"}
Outputs: ${lib.concatStringsSep ", " (map (o: "__${o}__") drv.outputs)}
${lib.optionalString (drv.meta ? mainProgram) "Provided programs: __${drv.meta.mainProgram}__"}
${lib.optionalString (drv.meta ? maintainers) "Maintainers: ${renderMaintainers drv.meta.maintainers}"}
${lib.optionalString (drv.meta ? platforms) "Platforms: ${renderPlatforms drv.meta.platforms}"}
'';
renderImage = drv: ''
## ${drv.imageName}
${lib.optionalString (drv.meta ? description) drv.meta.description}
${lib.optionalString (drv.meta ? homepage) "[Homepage](${drv.meta.homepage})"}
Tag: __${drv.imageTag}__
${lib.optionalString (drv.fromImage != null) "From: __${drv.fromImage.imageName}__"}
${lib.optionalString (drv.meta ? license) "License: ${
if lib.isList drv.meta.license
then (map (license: "[${drv.meta.license.fullName}](${drv.meta.license.url})") drv.meta.license)
else "[${drv.meta.license.fullName}](${drv.meta.license.url})"
}"}
${lib.optionalString (drv.meta ? maintainers) "Maintainers: ${renderMaintainers drv.meta.maintainers}"}
${lib.optionalString (drv.meta ? platforms) "Platforms: ${renderPlatforms drv.meta.platforms}"}
'';
packagesDoc =
pkgs.writeText "packages.md"
(lib.concatStringsSep "\n" (map (drv:
if drv ? imageTag
then renderImage drv
else if drv ? pname
then renderPackage drv
else "")
derivations));
in
pkgs.stdenvNoCC.mkDerivation {
pname = "bonfire-docs";
@ -166,9 +55,15 @@ in
buildPhase = ''
runHook preBuild
ln -s ${../../README.md} src/README.md
ln -s ${optionsDoc.optionsCommonMark} src/options/modules.md
ln -s ${packagesDoc} src/packages/packages.md
${lib.concatStringsSep "\n" (map (module_: "ln -s ${module_.commonMarkdown} src/nixosModules/${module_.name}.md") nixosModulesDoc.documentation)}
substituteInPlace src/SUMMARY.md --replace '{{nixosModulesSummary}}' '${lib.concatStringsSep "\n" nixosModulesDoc.summary}'
${lib.concatStringsSep "\n" (map (package_: "ln -s ${package_.commonMarkdown} src/packages/${package_.name}.md") packagesDoc.documentation)}
substituteInPlace src/SUMMARY.md --replace '{{packagesSummary}}' '${lib.concatStringsSep "\n" packagesDoc.summary}'
mdbook build
runHook postBuild
'';
@ -188,9 +83,9 @@ in
};
meta = with lib; {
description = "Bonfire HTML documentation.";
description = "Bonfire documentation.";
license = licenses.mit;
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
platforms = lib.platforms.all;
};
}

View File

@ -0,0 +1,64 @@
{
lib,
pkgs,
modules,
excludedModules ? ["default"],
root ? null,
declarations ? {},
projectName ? "",
modulesPrefix ? "",
version ? "unknown",
}: let
moduleNames = lib.filter (key: builtins.all (restricted: key != restricted) excludedModules) (lib.attrNames modules);
moduleValues = map (key: modules.${key}) moduleNames;
genDeclaration = storeDeclaration: declarations:
map (declaration: let
subpath = lib.removePrefix (toString root + "/") (toString storeDeclaration);
project =
if projectName != ""
then "${projectName}/"
else "";
in {
name = "<${declaration.name}:${project}${subpath}>";
url = "${declaration.url}/${subpath}";
})
declarations;
formatDeclaration = storeDeclaration:
if lib.hasPrefix (toString modulesPrefix) (toString storeDeclaration)
then genDeclaration storeDeclaration declarations
# skip external declarations
else lib.singleton storeDeclaration;
transformOptions = option:
option
// {
declarations = lib.unique (
lib.flatten (map (declaration: formatDeclaration declaration) option.declarations)
++ option.declarations
);
};
genDocumentation = module:
pkgs.nixosOptionsDoc {
options = builtins.removeAttrs (lib.evalModules {modules = [module];}).options [
"_module"
"system"
];
transformOptions = transformOptions;
documentType = "none";
revision = version;
};
in {
documentation =
lib.zipListsWith (name: moduleDocumentation: {
name = name;
commonMarkdown = moduleDocumentation.optionsCommonMark;
})
moduleNames
(map (module: genDocumentation module) moduleValues);
summary = map (name: " - [${name}](nixosModules/${name}.md)") moduleNames;
}

View File

@ -0,0 +1,137 @@
{
lib,
pkgs,
packages,
excludedPackages ? ["default"],
repoUrl ? null,
hydraUrl ? null,
}: let
supportedSystems = builtins.attrNames packages;
derivations = lib.flatten (
map (packages_: (
map (name: packages_.${name}) (builtins.attrNames packages_)
)) (map (system: packages.${system}) supportedSystems)
);
extractName = drv:
if drv ? pname
then drv.pname
else if drv ? imageName
then drv.imageName
else "unknown";
derivationNames = map (drv: extractName drv) derivations;
genDocumentation = drv: let
name = extractName drv;
type =
if drv ? pname
then "package"
else if drv ? imageTag
then "image"
else "unknown";
description = lib.optionalString (drv.meta ? description) drv.meta.description;
homepage = lib.optionalString (drv.meta ? homepage) "[Homepage](${drv.meta.homepage})";
source = lib.optionalString (repoUrl != null) "[Source](${repoUrl}/packages/${name}/default.nix)";
versionOrTag =
if type == "package"
then "Version: __${drv.version}__"
else if type == "image"
then "Tag: __${drv.imageTag}__"
else "";
license = lib.optionalString (drv.meta ? license) "License: ${
if lib.isList drv.meta.license
then (map (license: "[${drv.meta.license.fullName}](${drv.meta.license.url})") drv.meta.license)
else "[${drv.meta.license.fullName}](${drv.meta.license.url})"
}";
maintainers = let
maintainer = mt:
if mt ? github
then "[${mt.name}](https://github.com/${mt.github})"
else mt.name;
email = mt:
if mt ? email
then "<[${mt.email}](mailto:${mt.email})>"
else "";
in
lib.optionalString (drv.meta ? maintainers) ("Maintainers: "
+ lib.concatStringsSep ", " (
map (mt: maintainer mt + email mt) drv.meta.maintainers
));
platforms = lib.optionalString (drv.meta ? platforms && drv.meta.platforms != lib.platforms.none) (
let
# limit package platforms to supported by flake only
filteredPlatforms = lib.intersectLists drv.meta.platforms supportedSystems;
in
"Platforms: "
+ lib.concatStringsSep ", " (map (platform:
if hydraUrl != null
then "[${platform}](${hydraUrl}/packages.${platform}.${name})"
else "__${platform}__")
filteredPlatforms)
);
mainProgram = lib.optionalString (drv.meta ? mainProgram) "Main program: __${drv.meta.mainProgram}__";
outputs = lib.optionalString (drv ? outputs) ("Outputs: " + lib.concatStringsSep ", " (map (o: "__${o}__") drv.outputs));
fromImage = lib.optionalString (drv ? fromImage && drv.fromImage != null) "From: __${drv.fromImage.imageName}__";
stats = let
stats_ = [
(lib.optionalString
(drv.meta ? broken && drv.meta.broken)
" _broken_")
(lib.optionalString
(drv.meta ? unfree && drv.meta.unfree)
" _unfree_")
(lib.optionalString
(drv.meta ? unsupported && drv.meta.unsupported)
" _unsupported_")
(lib.optionalString
(drv.meta ? insecure && drv.meta.insecure)
" _insecure_")
];
in
lib.optionalString (builtins.any (s: s == true) stats_) "[ ${lib.concatStringsSep "," stats_} ]";
in {
commonMarkdown = pkgs.writeText "meta.md" ''
## ${name}
${stats}
${description}
${source} ${lib.optionalString (homepage != "") "| ${homepage}"}
${versionOrTag} ${fromImage}
${mainProgram}
${outputs}
${license}
${maintainers}
${platforms}
'';
};
in {
documentation =
lib.zipListsWith (name: packageDocumentation: {
name = name;
commonMarkdown = packageDocumentation.commonMarkdown;
})
derivationNames
(map (drv: genDocumentation drv) derivations);
summary = map (name: " - [${name}](packages/${name}.md)") derivationNames;
}

View File

@ -2,13 +2,17 @@
[Introduction](README.md)
# Outputs
- [Packages](packages/README.md)
- [packages](packages/packages.md)
{{packagesSummary}}
- [Module options](options/README.md)
- [nixosModules](options/modules.md)
- [NixOS Modules](nixosModules/README.md)
{{nixosModulesSummary}}
- [FAQ](faq.md)
# Trivia
- [Side Notes](notes.md)
- [Contributing](contributing.md)

View File

@ -1,4 +1,4 @@
# Module options
# NixOS modules
First, you need to add this project to your flake inputs:
@ -21,6 +21,10 @@ After, you can use in a NixOS configuration like so
system = "x86_64-linux";
modules = [
bonfire.nixosModules.bonfire
# or default because bonfire is default module
bonfire.nixosModules.default
# or just standalone module
bonfire.nixosModules.bar
...
];
};

View File

@ -1,4 +1,4 @@
# Frequently asked questions and hints
# Side Notes
* How to update and push flake inputs:

View File

@ -0,0 +1,36 @@
# Packages
First, you need to add this project to your flake inputs:
```nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
bonfire.url = "github:L-Nafaryus/bonfire";
};
outputs = { nixpkgs, bonfire, ... }:
{ ... }
}
```
After, you can use in a NixOS configuration like so
```nix
{
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { bonPkgs = bonfire.packages.x86_64-linux; };
modules = [
{ pkgs, bonPkgs, ... }: {
environment.systemPackages = [
pkgs.bar
bonPkgs.baz
];
}
...
];
};
# or pass in your devShells, nixosModules, etc
}
```

View File

@ -1,16 +1,31 @@
{
pkgs,
nixvim-pkgs,
bonconfigs,
fenix-pkgs,
nixvimPkgs,
fenixPkgs,
bonLib,
lib,
...
}:
nixvim-pkgs.makeNixvimWithModule {
}: let
drv = nixvimPkgs.makeNixvimWithModule {
pkgs = pkgs;
module = import bonconfigs.bonvim;
module = bonLib.preconfiguredModules.bonvim;
extraSpecialArgs = {
rustc = fenix-pkgs.complete.rustc;
cargo = fenix-pkgs.complete.cargo;
rust-analyzer = fenix-pkgs.complete.rust-analyzer;
rustc = fenixPkgs.complete.rustc;
cargo = fenixPkgs.complete.cargo;
rust-analyzer = fenixPkgs.complete.rust-analyzer;
};
}
};
in
drv
// {
pname = "bonvim";
version = "unknown";
meta = with lib;
drv.meta
// {
description = "NixVim distribution for NeoVim with a customized collection of plugins inspired by the LazyVim distribution.";
license = licenses.mit;
maintainers = with bonLib.maintainers; [L-Nafaryus];
platforms = platforms.linux;
};
}

View File

@ -1,6 +1,6 @@
{
bonfire,
crane-lib,
bonLib,
craneLib,
lib,
pkgs,
version ? "v0.44.0",
@ -34,12 +34,13 @@
description = "A cargo command for the shuttle platform";
license = licenses.asl20;
homepage = "https://shuttle.rs/";
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
platforms = platforms.x86_64;
};
};
in let
cargoArtifacts = crane-lib.buildDepsOnly pkg;
cargoArtifacts = craneLib.buildDepsOnly pkg;
in
crane-lib.buildPackage (
craneLib.buildPackage (
pkg // {inherit cargoArtifacts;}
)

View File

@ -1,5 +1,5 @@
{
bonfire,
bonLib,
stdenv,
lib,
pkgs,
@ -58,7 +58,7 @@ pkgs.python3.pkgs.buildPythonPackage {
description = "Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies.";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = pkgs.stdenv.isDarwin;
};
}

View File

@ -1,48 +1,98 @@
# self.packages.${system}
#
{
lib,
bonLib,
self,
inputs,
...
}: let
forAllSystems = inputs.nixpkgs.lib.genAttrs ["x86_64-linux"];
nixpkgsFor = forAllSystems (system: import inputs.nixpkgs {inherit system;});
platformInputs = system: rec {
pkgs = inputs.nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
inherit bonLib;
bonModules = self.nixosModules;
bonPkgs = self.packages.${system};
craneLib = inputs.crane.mkLib pkgs;
fenixPkgs = inputs.fenix.packages.${system};
nixvimPkgs = inputs.nixvim.legacyPackages.${system};
};
in
forAllSystems (system: let
pkgs = nixpkgsFor.${system};
bonLib.collectPackages platformInputs {
bonfire-docs = {
source = ./bonfire-docs;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
extraArgs = {inherit self;};
};
bonfire = self;
bonlib = self.lib;
bonpkgs = self.packages.${system};
bonconfigs = self.configurations;
netgen = {
source = ./netgen;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
crane = self.inputs.crane;
crane-lib = self.inputs.crane.mkLib pkgs;
dearpygui = {
source = ./dearpygui;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
fenix = self.inputs.fenix;
fenix-pkgs = self.inputs.fenix.packages.${system};
openfoam = {
source = ./openfoam;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
nixvim-pkgs = self.inputs.nixvim.legacyPackages.${system};
in {
bonfire-docs = pkgs.callPackage ./bonfire-docs {inherit bonfire;};
spoofdpi = {
source = ./spoofdpi;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
netgen = pkgs.callPackage ./netgen {inherit bonfire;};
ultimmc = {
source = ./ultimmc;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.libsForQt5.callPackage;
};
dearpygui = pkgs.callPackage ./dearpygui {inherit bonfire;};
cargo-shuttle = {
source = ./cargo-shuttle;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
openfoam = pkgs.callPackage ./openfoam {inherit bonfire;};
bonvim = {
source = ./bonvim;
platforms = ["x86_64-linux"];
builder = {...}: import;
};
spoofdpi = pkgs.callPackage ./spoofdpi {inherit bonfire;};
# Container images
lego = pkgs.callPackage ./lego {inherit bonfire;};
nix-minimal = {
source = ./nix-minimal;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
ultimmc = pkgs.libsForQt5.callPackage ./ultimmc {inherit bonfire;};
nix-runner = {
source = ./nix-runner;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
cargo-shuttle = pkgs.callPackage ./cargo-shuttle {inherit bonfire crane-lib;};
postgresql = {
source = ./postgresql;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
nix-minimal = pkgs.callPackage ./nix-minimal {inherit bonpkgs bonlib;};
nix-runner = pkgs.callPackage ./nix-runner {inherit bonpkgs bonlib;};
bonvim = import ./bonvim {inherit nixvim-pkgs pkgs bonconfigs fenix-pkgs;};
})
redis = {
source = ./redis;
platforms = ["x86_64-linux"];
builder = {pkgs, ...}: pkgs.callPackage;
};
}

View File

@ -1,41 +0,0 @@
{
bonfire,
lib,
fetchFromGitHub,
buildGoModule,
nixosTests,
version ? "c847ac4a4c55d6a5a457f6ef494cf45a47299e01",
hash ? "sha256-g9OxhM+iNUrAZgM1we8qPsismPy5a0eN654tSYuM/No=",
vendorHash ? "sha256-wG0x86lptEY3x+7kVN7v1XZniliMOxaJ6Y95YS6ivJY=",
...
}:
buildGoModule rec {
pname = "lego";
inherit version;
src = fetchFromGitHub {
owner = "go-acme";
repo = "lego";
rev = version;
hash = hash;
};
inherit vendorHash;
doCheck = false;
subPackages = ["cmd/lego"];
ldflags = [
"-X main.version=${version}"
];
meta = with lib; {
description = "Let's Encrypt client and ACME library written in Go";
license = licenses.mit;
homepage = "https://go-acme.github.io/lego/";
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
};
passthru.tests.lego = nixosTests.acme;
}

View File

@ -1,5 +1,5 @@
{
bonfire,
bonLib,
stdenv,
lib,
pkgs,
@ -69,8 +69,8 @@
description = "NETGEN is an automatic 3d tetrahedral mesh generator";
license = licenses.lgpl21Only;
platforms = platforms.linux;
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
broken = pkgs.stdenv.isDarwin;
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = true;
};
};
in

View File

@ -1,7 +1,7 @@
{
pkgs,
lib,
bonlib,
bonLib,
extraPaths ? [],
...
}: let
@ -145,6 +145,6 @@ in
'';
platforms = platforms.linux;
license = licenses.lgpl21Plus;
maintainers = with bonlib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
};
}

View File

@ -1,15 +1,14 @@
{
pkgs,
lib,
bonpkgs,
bonlib,
bonPkgs,
extraPaths ? [],
...
}:
pkgs.dockerTools.buildImage {
name = "nix-runner";
tag = "latest";
fromImage = bonpkgs.nix-minimal;
fromImage = bonPkgs.nix-minimal;
copyToRoot = pkgs.buildEnv {
name = "image-root";
@ -27,7 +26,7 @@ pkgs.dockerTools.buildImage {
}
// {
meta =
bonpkgs.nix-minimal.meta
bonPkgs.nix-minimal.meta
// {
description = "Image for action runners with a Nix package manager";
longDescription = ''

View File

@ -1,5 +1,5 @@
{
bonfire,
bonLib,
stdenv,
lib,
pkgs,
@ -79,7 +79,7 @@ in let
description = "OpenFOAM is a free, open source CFD software released and developed by OpenFOAM Foundation";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = pkgs.stdenv.isDarwin;
};
};

View File

@ -0,0 +1,58 @@
{
pkgs,
lib,
bonLib,
extraPaths ? [],
...
}: let
user = "postgres";
dataDir = "/var/lib/postgresql";
entryPoint = pkgs.writeTextDir "entrypoint.sh" ''
initdb -U ${user}
postgres -k ${dataDir}
'';
in
pkgs.dockerTools.buildImage {
name = "postgresql";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
pathsToLink = ["/bin" "/etc" "/"];
paths = with pkgs;
[
bash
postgresql
entryPoint
]
++ extraPaths;
};
runAsRoot = with pkgs; ''
#!${runtimeShell}
${dockerTools.shadowSetup}
groupadd -r ${user}
useradd -r -g ${user} --home-dir=${dataDir} ${user}
mkdir -p ${dataDir}
chown -R ${user}:${user} ${dataDir}
'';
config = {
Entrypoint = ["bash" "/entrypoint.sh"];
StopSignal = "SIGINT";
User = "${user}:${user}";
Env = ["PGDATA=${dataDir}"];
WorkingDir = dataDir;
ExposedPorts = {
"5432/tcp" = {};
};
};
}
// {
meta = with lib; {
homepage = "https://www.postgresql.org";
description = "A powerful, open source object-relational database system.";
platforms = platforms.linux;
license = licenses.postgresql;
maintainers = with bonLib.maintainers; [L-Nafaryus];
};
}

View File

@ -0,0 +1,58 @@
{
pkgs,
lib,
bonLib,
extraPaths ? [],
...
}: let
user = "redis";
dataDir = "/var/lib/redis";
entryPoint = pkgs.writeTextDir "entrypoint.sh" ''
redis-server \
--daemonize no \
--dir "${dataDir}"
'';
in
pkgs.dockerTools.buildImage {
name = "redis";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
pathsToLink = ["/bin" "/etc" "/"];
paths = with pkgs;
[
bash
redis
entryPoint
]
++ extraPaths;
};
runAsRoot = with pkgs; ''
#!${runtimeShell}
${dockerTools.shadowSetup}
groupadd -r ${user}
useradd -r -g ${user} --home-dir=${dataDir} ${user}
mkdir -p ${dataDir}
chown -R ${user}:${user} ${dataDir}
'';
config = {
Entrypoint = ["bash" "/entrypoint.sh"];
StopSignal = "SIGINT";
User = "${user}:${user}";
WorkingDir = dataDir;
ExposedPorts = {
"6379/tcp" = {};
};
};
}
// {
meta = with lib; {
homepage = "https://redis.io";
description = "An open source, advanced key-value store.";
platforms = platforms.linux;
license = licenses.bsd3;
maintainers = with bonLib.maintainers; [L-Nafaryus];
};
}

View File

@ -1,5 +1,5 @@
{
bonfire,
bonLib,
lib,
pkgs,
version ? "0.8",
@ -28,7 +28,7 @@ pkgs.buildGoModule {
homepage = "https://github.com/xvzc/SpoofDPI";
description = "A simple and fast anti-censorship tool written in Go";
license = licenses.asl20;
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = false;
mainProgram = "spoof-dpi";
};

View File

@ -1,5 +1,5 @@
{
bonfire,
bonLib,
lib,
stdenv,
fetchFromGitHub,
@ -13,6 +13,7 @@
xorg,
libpulseaudio,
libGL,
...
}:
stdenv.mkDerivation rec {
version = "faf3c966c43465d6f6c245ed78556222240398ee";
@ -78,6 +79,6 @@ stdenv.mkDerivation rec {
description = "Cracked Minecraft Launcher";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with bonfire.lib.maintainers; [L-Nafaryus];
maintainers = with bonLib.maintainers; [L-Nafaryus];
};
}