Refactor helpers & overlay

This commit is contained in:
Fern Garden 2025-08-26 09:53:37 +08:00
parent d19c81dfb4
commit 7417d91809
2 changed files with 136 additions and 171 deletions

View file

@ -12,64 +12,38 @@ with inputs.nixpkgs.lib; {
suite ? "", suite ? "",
docker ? false, docker ? false,
hostModules ? [], hostModules ? [],
}: let }:
# System architecture.
system = platform;
# Secrets directory.
secrets = builtins.toString inputs.secrets;
# Extra modules to import.
extraModules =
hostModules # Host-specific modules.
++ optionals (docker == true) [./suites/server/docker] # Enable docker if required.
++ (filesystem.listFilesRecursive ./modules); # Custom modules.
# nixpkgs config.
pkgs = import nixpkgs {
inherit system;
config = {
# Allow installation of proprietary software.
allowUnfree = true;
# Allow the installation of packages marked as insecure in nixpkgs.
permittedInsecurePackages = [
"dotnet-sdk-6.0.428" # For WebOne.
"dotnet-runtime-6.0.36" # For WebOne.
];
};
# Import my overlay.
overlays = [
(import ./overlay.nix {inherit inputs system;})
];
};
# deploy-rs overlay.
deployPkgs = import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlays.default
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
lib = super.deploy-rs.lib;
};
})
];
};
in
{ {
nixosConfigurations.${hostname} = nixosSystem { nixosConfigurations.${hostname} = nixosSystem rec {
inherit system pkgs; # Architecture.
system = platform;
# nixpkgs config.
pkgs = import nixpkgs {
inherit system;
config = {
# Allow installation of proprietary software.
allowUnfree = true;
# Allow the installation of packages marked as insecure in nixpkgs.
permittedInsecurePackages = [
"dotnet-sdk-6.0.428" # For WebOne.
"dotnet-runtime-6.0.36" # For WebOne.
];
};
# Import my overlays.
overlays = [
(import ./overlay.nix {inherit nixpkgs-unstable nixpkgs-pr-feishin;})
];
};
specialArgs = { specialArgs = {
# Make some variables accesible to modules. # Pass hostname & inputs to config.
inherit inherit inputs hostname;
inputs
hostname # Secrets directory.
secrets secrets = builtins.toString inputs.secrets;
;
}; };
modules = modules =
@ -105,11 +79,26 @@ with inputs.nixpkgs.lib; {
}; };
} }
] ]
++ extraModules; ++ hostModules # Host-specific modules.
++ optionals (docker == true) [./suites/server/docker] # Enable docker if required.
++ (filesystem.listFilesRecursive ./modules); # Custom modules.
}; };
} }
// optionalAttrs (strings.hasPrefix "server" suite) { // optionalAttrs (strings.hasPrefix "server" suite) {
deploy.nodes.${hostname} = { deploy.nodes.${hostname} = let
deployPkgs = import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlays.default
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
lib = super.deploy-rs.lib;
};
})
];
};
in {
hostname = "${hostname}.local"; hostname = "${hostname}.local";
profiles.system = { profiles.system = {
user = "root"; user = "root";

View file

@ -1,121 +1,97 @@
{ {
inputs, nixpkgs-unstable,
system, nixpkgs-pr-feishin,
... ...
}: }: final: prev: let
with inputs; pkgs-unstable = import nixpkgs-unstable {inherit (prev) config system;};
final: prev: let pkgs-pr-feishin = import nixpkgs-pr-feishin {inherit (prev) config system;};
pkgsConfig = { in {
inherit system; ## My packages ##
config.allowUnfree = true;
};
pkgs-unstable = import nixpkgs-unstable pkgsConfig; webone = prev.pkgs.callPackage ./packages/webone {}; # WebOne HTTP proxy.
pkgs-pr-feishin = import nixpkgs-pr-feishin pkgsConfig; yazi-flavour-kanagawa-dragon = prev.pkgs.callPackage ./packages/yazi-flavour-kanagawa-dragon {}; # Kanagawa theme for yazi.
in { cups-dymo = prev.pkgs.callPackage ./packages/cups-dymo {}; # Dymo label printer drivers.
# My packages.
webone = prev.pkgs.callPackage ./packages/webone {}; # WebOne HTTP proxy.
yazi-flavour-kanagawa-dragon = prev.pkgs.callPackage ./packages/yazi-flavour-kanagawa-dragon {}; # Kanagawa theme for yazi.
cups-dymo = prev.pkgs.callPackage ./packages/cups-dymo {}; # Dymo label printer drivers.
# Kanagawa Dragon theme for tmux. # Kanagawa Dragon theme for tmux.
tmuxPlugins = tmuxPlugins =
prev.tmuxPlugins prev.tmuxPlugins
// { // {
kanagawa = prev.tmuxPlugins.mkTmuxPlugin { kanagawa = prev.tmuxPlugins.mkTmuxPlugin {
pluginName = "kanagawa"; pluginName = "kanagawa";
rtpFilePath = "kanagawa.tmux"; rtpFilePath = "kanagawa.tmux";
version = "2025-06-01"; version = "2025-06-01";
src = prev.fetchFromGitHub { src = prev.fetchFromGitHub {
owner = "Nybkox"; owner = "Nybkox";
repo = "tmux-kanagawa"; repo = "tmux-kanagawa";
rev = "9124a8887587f784aaec94b97631255a4e70b8a0"; rev = "9124a8887587f784aaec94b97631255a4e70b8a0";
hash = "sha256-ZueH5KjPD0SaReuWJOq1FGpjEFXg216BzeXL64o74MU="; hash = "sha256-ZueH5KjPD0SaReuWJOq1FGpjEFXg216BzeXL64o74MU=";
};
};
};
## Unstable channel. ##
protonmail-desktop = pkgs-unstable.protonmail-desktop; # Protonmail desktop client.
rockbox-utility = pkgs-unstable.rockbox-utility; # Rockbox installer.
# Fluffychat.
fluffychat =
(pkgs-unstable
// {
overlay = [
(final: prev: {
fluffychat = prev.fluffychat.overrideAttrs (prevAttrs: {
desktopItems = [
((builtins.elemAt prevAttrs.desktopItems 0).override {startupWMClass = "fluffychat";})
];
});
})
];
}).fluffychat;
## Pull requests. ##
# Feishin music player.
feishin =
(pkgs-pr-feishin
// {
overlay = [
(final: prev: {
feishin = prev.feishin.overrideAttrs (prevAttrs: rec {
pname = "feishin";
version = "0.18.0";
src = prev.fetchFromGitHub {
owner = "jeffvli";
repo = "feishin";
rev = "v${version}";
hash = "sha256-4gcS7Vd7LSpEByO2Hlk6nb8V2adBPh5XwWGCu2lwOA4=";
};
pnpmDeps = prev.pnpm_10.fetchDeps {
inherit pname version src;
hash = "sha256-1MGxrUcfvazxAubaYAsQuulUKm05opWOIC7oaLzjr7o=";
};
});
})
];
}).feishin;
## Modifications ##
# PrismLauncher with Temurin JRE;
prismlauncher = prev.prismlauncher.override {
jdks = [
prev.pkgs.temurin-jre-bin
];
};
# Custom iosevka build.
iosevka = prev.iosevka.override {
set = "Custom";
privateBuildPlan = {
family = "IosevkaCustom";
spacing = "term";
serifs = "sans";
noCvSs = false;
exportGlyphNames = true;
variants.inherits = "ss05";
weights = {
Regular = {
shape = 400;
menu = 400;
css = 400;
};
Bold = {
shape = 700;
menu = 700;
css = 700;
};
}; };
}; };
}; };
}
## Unstable channel. ##
protonmail-desktop = pkgs-unstable.protonmail-desktop;
rockbox-utility = pkgs-unstable.rockbox-utility;
fluffychat = pkgs-unstable.fluffychat.overrideAttrs (prevAttrs: {
desktopItems = [
((builtins.elemAt prevAttrs.desktopItems 0).override {startupWMClass = "fluffychat";})
];
});
## Pull requests. ##
feishin = pkgs-pr-feishin.feishin.overrideAttrs (prevAttrs: rec {
pname = "feishin";
version = "0.18.0";
src = prev.fetchFromGitHub {
owner = "jeffvli";
repo = "feishin";
rev = "v${version}";
hash = "sha256-4gcS7Vd7LSpEByO2Hlk6nb8V2adBPh5XwWGCu2lwOA4=";
};
pnpmDeps = prev.pnpm_10.fetchDeps {
inherit pname version src;
hash = "sha256-1MGxrUcfvazxAubaYAsQuulUKm05opWOIC7oaLzjr7o=";
};
});
## Modifications ##
# PrismLauncher with Temurin JRE;
prismlauncher = prev.prismlauncher.override {
jdks = [
prev.pkgs.temurin-jre-bin
];
};
# Custom iosevka build.
iosevka = prev.iosevka.override {
set = "Custom";
privateBuildPlan = {
family = "IosevkaCustom";
spacing = "term";
serifs = "sans";
noCvSs = false;
exportGlyphNames = true;
variants.inherits = "ss05";
weights = {
Regular = {
shape = 400;
menu = 400;
css = 400;
};
Bold = {
shape = 700;
menu = 700;
css = 700;
};
};
};
};
}