rework overlays handling

This commit is contained in:
Daylin Morgan 2024-09-10 16:31:26 -05:00
parent b66236553f
commit a559ac1c79
Signed by: daylin
GPG key ID: 950D13E9719334AD
7 changed files with 37 additions and 71 deletions

View file

@ -3,23 +3,21 @@ let
lib = nixpkgs.lib.extend (import ./extended.nix inputs);
inherit (builtins) mapAttrs readDir listToAttrs;
inherit (lib) genAttrs pkgFromSystem pkgsFromSystem;
inherit (lib) genAttrs pkgFromSystem pkgsFromSystem loadOverlays;
inherit (import ./find-modules.nix { inherit lib; }) findModulesList;
inherit (import ./generators.nix { inherit lib self inputs; }) mkIso mkSystem;
#supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
supportedSystems = [ "x86_64-linux" ];
forAllSystems =
f:
fn:
genAttrs supportedSystems (
system:
f (
fn (
import nixpkgs {
inherit system;
overlays = [
inputs.nim2nix.overlays.default
(import ../overlays/nimble { inherit inputs; })
];
overlays = (import ../overlays { inherit inputs loadOverlays; });
}
)
);
@ -62,13 +60,13 @@ let
];
};
});
checks = forAllSystems (
pkgs:
import ./checks.nix {
inherit inputs lib self;
system = pkgs.system;
}
);
# checks = forAllSystems (
# pkgs:
# import ./checks.nix {
# inherit inputs lib self;
# system = pkgs.system;
# }
# );
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
in

View file

@ -3,8 +3,11 @@ let
inherit (builtins)
listToAttrs
substring
filter
replaceStrings
map
filter
attrNames
readDir
;
inherit (final)
concatStringsSep
@ -106,6 +109,12 @@ let
pkg = pkgFromSystem system;
};
loadOverlays =
inputs: dir: readDir dir
|> attrNames
|> filter (f: f != "default.nix")
|> map (f: import (../overlays + "/${f}") { inherit inputs; });
in
{
inherit
@ -125,5 +134,6 @@ in
overlayFrom
flakeFromSystem
listify
loadOverlays
;
}

View file

@ -49,14 +49,6 @@ let
nixosSystem {
system = "x86_64-linux";
modules = [
# TODO: clean this up
(
{ ... }:
{
nixpkgs.overlays = [ inputs.nim2nix.overlays.default ];
}
)
../overlays
../modules/oizys.nix
inputs.lix-module.nixosModules.default
inputs.hyprland.nixosModules.default

View file

@ -15,8 +15,6 @@ in
with pkgs;
[
nim
nim-atlas
nimble
]
++ [ nimlangserver ];

View file

@ -1,11 +1,12 @@
{
inputs,
lib,
self,
hostName,
...
}:
let
inherit (lib) mkEnableOption mkOption;
inherit (lib) mkEnableOption mkOption loadOverlays;
in
{
imports = with self.nixosModules; [
@ -54,5 +55,6 @@ in
config = {
networking.hostName = hostName;
time.timeZone = "US/Central";
nixpkgs.overlays = import ../overlays { inherit inputs loadOverlays; };
};
}

View file

@ -1,33 +1,11 @@
{ inputs, ... }:
let
inherit (builtins)
map
filter
attrNames
readDir
elem
;
# execute and import all overlay files in the current
# directory with the given args
# overlays =
# map
# (f: (import (./. + "/${f}") { inherit inputs; }))
# (filter (f: f != "default.nix") (attrNames (readDir ./.)));
ignore = ["nimlangserver"];
overlays =
readDir ./.
|> attrNames
|> filter (f: f != "default.nix" || elem f ignore)
|> map (f: import (./. + "/${f}") { inherit inputs; });
in
{
nixpkgs.overlays = overlays ++ [
(final: _prev: {
stable = import inputs.stable {
system = final.system;
config.allowUnfree = true;
};
})
];
}
{ inputs, loadOverlays }:
(loadOverlays inputs ./.)
++ [
inputs.nim2nix.overlays.default # adds buildNimPackage
(final: _prev: {
stable = import inputs.stable {
system = final.system;
config.allowUnfree = true;
};
})
]

View file

@ -1,12 +0,0 @@
{ ... }:
(final: prev: {
nim-atlas = prev.nim-atlas.overrideNimAttrs {
version = "unstable";
src = final.fetchFromGitHub {
owner = "nim-lang";
repo = "atlas";
rev = "cbba9fa77fa837931bf3c58e20c1f8cb15a22919";
hash = "sha256-TsZ8TriVuKEY9/mV6KR89eFOgYrgTqXmyv/vKu362GU=";
};
};
})