feature(config): Allow pkgs config

This commit is contained in:
DashieTM 2025-11-01 23:19:25 +01:00
parent 96cf0a24c1
commit b39db82a29
8 changed files with 104 additions and 52 deletions

View file

@ -165,6 +165,37 @@ nixosConfigurations =
inputs.dashNix.dashNixLib.buildSystems { root = ./.; inherit additionalInputs; };
```
## Configuring pkgs
While DashNix offers a default pkgs config, you may want to permit an unsecure packages or add an overlay to them.
You can configure both stable and unstable pkgs the following way:
```nix
currentSystem = "x86_64-linux";
permittedPackages = [
"some package"
];
config = {
system = currentSystem;
config = {
allowUnfree = true;
permittedInsecurePackages = permittedPackages;
};
};
unstableBundle = {
pkgs = inputs.unstable;
inherit config;
};
inputs.dashNix.dashNixLib.buildSystems {
root = ./.;
inherit unstableBundle;
}
```
With this you could also change your input to something different should you wish to do so.
Note that overriding inputs via the flake still works,
this way however ensures you can also configure the inputs.
## Stable/Unstable
Sometimes you want to differentiate between systems that are stable and unstable, e.g. for servers and desktops/laptops.

View file

@ -59,47 +59,27 @@
currentSystem = "x86_64-linux";
permittedPackages = [
"olm-3.2.16"
# well done dotnet...
# this is just for omnisharp
"dotnet-core-combined"
"dotnet-wrapped-combined"
"dotnet-combined"
"dotnet-sdk-6.0.428"
"dotnet-sdk-wrapped-6.0.428"
"dotnet-sdk-6.0.136"
"dotnet-sdk-wrapped-6.0.136"
"dotnet-sdk-7.0.120"
"dotnet-sdk-wrapped-7.0.120"
"dotnet-sdk-7.0.410"
"dotnet-sdk-wrapped-7.0.410"
"jitsi-meet-1.0.8043"
"nextcloud-27.1.11"
];
stable = import ./lib/importPkgs.nix {
inherit inputs permittedPackages currentSystem;
pkgs = inputs.stable;
};
unstable = import ./lib/importPkgs.nix {
inherit inputs permittedPackages currentSystem;
pkgs = inputs.unstable;
};
pkgsDarkreader = import ./lib/importPkgs.nix {
inherit inputs permittedPackages currentSystem;
pkgs = inputs.pkgsDarkreader;
};
importPkgsFn = import ./lib/importPkgs.nix;
defaultConfigureFn = pkgs:
importPkgsFn {
inherit inputs currentSystem permittedPackages pkgs;
};
stable = defaultConfigureFn inputs.stable;
unstable = defaultConfigureFn inputs.unstable;
pkgsDarkreader = defaultConfigureFn inputs.pkgsDarkreader;
in rec {
dashNixLib = import ./lib {
inherit
self
inputs
unstable
stable
permittedPackages
;
dashNixAdditionalProps = {
inherit pkgsDarkreader;
};
system = currentSystem;
inherit (inputs.unstable) lib;
};
docs = import ./docs {
inherit inputs;

View file

@ -1,13 +1,35 @@
{
inputs,
lib,
unstable,
self,
stable,
system,
permittedPackages,
dashNixAdditionalProps ? {},
...
}: {
}: let
defaultConfig = {
config = {
allowUnfree = true;
permittedInsecurePackages = permittedPackages;
};
overlays = [
inputs.nur.overlays.default
inputs.chaoticNyx.overlays.cache-friendly
];
inherit system;
};
mkPkgs = {
pkgs,
config,
}: let
overlays =
if (config ? overlays)
then config.overlays
else [];
comnbinedConfig = config // {overlays = overlays ++ defaultConfig.overlays;};
in
import pkgs comnbinedConfig;
in {
/*
*
# buildSystems
@ -75,9 +97,27 @@
];
},
additionalInputs ? {},
unstableBundle ? {},
stableBundle ? {},
overridePkgs ? false,
...
}:
}: let
unstableInput = unstableBundle.pkgs or inputs.unstable;
stableInput = stableBundle.pkgs or inputs.stable;
unstableConfig = unstableBundle.config or defaultConfig;
stableConfig = stableBundle.config or defaultConfig;
unstablePkgs = mkPkgs {
pkgs = unstableInput;
config = unstableConfig;
};
stablePkgs = mkPkgs {
pkgs = stableInput;
config = stableConfig;
};
inputlib = unstableInput.lib;
inherit (unstablePkgs) lib;
in
builtins.listToAttrs (
map
(name: {
@ -94,27 +134,28 @@
additionalHomeConfig
system
root
stable
unstable
additionalInputs
dashNixAdditionalProps
lib
;
stable = stablePkgs;
unstable = unstablePkgs;
pkgs = lib.mkForce (
if overridePkgs
then stable
else unstable
then stablePkgs
else unstablePkgs
);
alternativePkgs =
if overridePkgs
then unstable
else stable;
then unstablePkgs
else stablePkgs;
hostName = name;
homeMods = mods.home;
additionalHomeMods = additionalMods.home;
mkDashDefault = import ./override.nix {inherit lib;};
};
in
inputs.unstable.lib.nixosSystem {
inputlib.nixosSystem {
modules =
[
{_module.args = args;}
@ -122,8 +163,8 @@
]
++ mods.nixos
++ additionalMods.nixos
++ inputs.unstable.lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig
++ inputs.unstable.lib.optional (builtins.pathExists mod) mod;
++ lib.optional (builtins.pathExists additionalNixosConfig) additionalNixosConfig
++ lib.optional (builtins.pathExists mod) mod;
};
})
(

View file

@ -87,7 +87,7 @@
pkgs.intel-media-driver)
(lib.mkIf config.mods.gpu.vapi.enable pkgs.libvdpau-va-gl)
(lib.mkIf config.mods.gpu.vapi.enable pkgs.libva)
(lib.mkIf config.mods.gpu.vapi.enable pkgs.vaapiVdpau)
(lib.mkIf config.mods.gpu.vapi.enable pkgs.libva-vdpau-driver)
(lib.mkIf (config.mods.gpu.intelgpu.enable || config.mods.gpu.amdgpu.enable) pkgs.mesa)
];
rocmPackages = [

View file

@ -102,11 +102,11 @@
(lib.mkIf config.mods.homePackages.orcaSlicer orca-slicer)
(lib.mkIf config.mods.homePackages.vesktop vesktop)
(lib.mkIf config.mods.homePackages.nextcloudClient nextcloud-client)
(lib.mkIf (!isNull config.mods.homePackages.matrixClient) config.mods.homePackages.matrixClient)
(lib.mkIf (!isNull config.mods.homePackages.mailClient) config.mods.homePackages.mailClient)
(lib.mkIf (config.mods.homePackages.matrixClient != null) config.mods.homePackages.matrixClient)
(lib.mkIf (config.mods.homePackages.mailClient != null) config.mods.homePackages.mailClient)
(lib.mkIf (
# NOTE: This should be package, but nix doesn't have that....
builtins.isAttrs config.mods.homePackages.browser && !isNull config.mods.homePackages.browser
builtins.isAttrs config.mods.homePackages.browser && config.mods.homePackages.browser != null
)
config.mods.homePackages.browser)
adw-gtk3
@ -128,10 +128,10 @@
nh
nix-index
playerctl
poppler_utils
poppler-utils
pulseaudio
libsForQt5.qt5ct
qt6ct
qt6Packages.qt6ct
fcp
ripgrep
rm-improved

View file

@ -4,6 +4,7 @@
pkgs,
inputs,
options,
mkDashDefault,
...
}: let
inherit (config.conf) username;
@ -263,8 +264,7 @@ in {
config = lib.mkIf (config.mods.ironbar.enable || config.mods.hypr.hyprland.useIronbar) (
lib.optionalAttrs (options ? programs.ironbar) {
programs.ironbar = {
# TODO broken
# package = mkDashDefault pkgs.ironbar;
package = mkDashDefault pkgs.ironbar;
enable = true;
style =
if config.mods.ironbar.useDefaultCss

View file

@ -94,7 +94,7 @@
zathura
evince
libreoffice-fresh
onlyoffice-bin
onlyoffice-desktopeditors
pdftk
pdfpc
polylux2pdfpc

View file

@ -91,7 +91,7 @@ in {
};
emoji = {
package = pkgs.noto-fonts-emoji;
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
};