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 ? "",
docker ? false,
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 {
inherit system pkgs;
nixosConfigurations.${hostname} = nixosSystem rec {
# 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 = {
# Make some variables accesible to modules.
inherit
inputs
hostname
secrets
;
# Pass hostname & inputs to config.
inherit inputs hostname;
# Secrets directory.
secrets = builtins.toString inputs.secrets;
};
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) {
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";
profiles.system = {
user = "root";

View file

@ -1,121 +1,97 @@
{
inputs,
system,
nixpkgs-unstable,
nixpkgs-pr-feishin,
...
}:
with inputs;
final: prev: let
pkgsConfig = {
inherit system;
config.allowUnfree = true;
};
}: final: prev: let
pkgs-unstable = import nixpkgs-unstable {inherit (prev) config system;};
pkgs-pr-feishin = import nixpkgs-pr-feishin {inherit (prev) config system;};
in {
## My packages ##
pkgs-unstable = import nixpkgs-unstable pkgsConfig;
pkgs-pr-feishin = import nixpkgs-pr-feishin pkgsConfig;
in {
# 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.
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.
tmuxPlugins =
prev.tmuxPlugins
// {
kanagawa = prev.tmuxPlugins.mkTmuxPlugin {
pluginName = "kanagawa";
rtpFilePath = "kanagawa.tmux";
version = "2025-06-01";
src = prev.fetchFromGitHub {
owner = "Nybkox";
repo = "tmux-kanagawa";
rev = "9124a8887587f784aaec94b97631255a4e70b8a0";
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;
};
# Kanagawa Dragon theme for tmux.
tmuxPlugins =
prev.tmuxPlugins
// {
kanagawa = prev.tmuxPlugins.mkTmuxPlugin {
pluginName = "kanagawa";
rtpFilePath = "kanagawa.tmux";
version = "2025-06-01";
src = prev.fetchFromGitHub {
owner = "Nybkox";
repo = "tmux-kanagawa";
rev = "9124a8887587f784aaec94b97631255a4e70b8a0";
hash = "sha256-ZueH5KjPD0SaReuWJOq1FGpjEFXg216BzeXL64o74MU=";
};
};
};
}
## 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;
};
};
};
};
}