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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,33 +1,11 @@
{ inputs, ... }: { inputs, loadOverlays }:
let (loadOverlays inputs ./.)
inherit (builtins) ++ [
map inputs.nim2nix.overlays.default # adds buildNimPackage
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: { (final: _prev: {
stable = import inputs.stable { stable = import inputs.stable {
system = final.system; system = final.system;
config.allowUnfree = true; 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=";
};
};
})