feat: proxy nixos modules, remove deprecated overlay attribute
This commit is contained in:
parent
af06876391
commit
b428b981b9
4 changed files with 45 additions and 9 deletions
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -51,16 +51,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1665216225,
|
||||
"narHash": "sha256-SUuvJXGEXhmyaGJlDlptbc9I2Wai9tUx83QYIqvipfE=",
|
||||
"lastModified": 1677028070,
|
||||
"narHash": "sha256-sUKqd8HYBrtPxCRXFWvsnQDnwqnw1uIDwu4khcZuL2k=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1a9935bf90e0f4225756f99e772f06d5fea9edb6",
|
||||
"rev": "d3a15cd8dc917f4364ba0b332a1c389dc3177603",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "release-22.05",
|
||||
"ref": "release-22.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
description = "Snowfall Lib";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/release-22.05";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/release-22.11";
|
||||
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
|
||||
|
||||
flake-compat = {
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ rec {
|
|||
flake-outputs =
|
||||
flake-utils-plus-outputs // {
|
||||
inherit overlays;
|
||||
overlay = overlays.default;
|
||||
};
|
||||
in
|
||||
flake-outputs;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
let
|
||||
inherit (builtins) baseNameOf;
|
||||
inherit (core-inputs.nixpkgs.lib) assertMsg foldl mapAttrs;
|
||||
inherit (core-inputs.nixpkgs.lib) assertMsg foldl mapAttrs hasPrefix;
|
||||
|
||||
user-modules-root = snowfall-lib.fs.get-snowfall-file "modules";
|
||||
in
|
||||
|
|
@ -23,13 +23,50 @@ in
|
|||
let
|
||||
user-modules = snowfall-lib.fs.get-default-nix-files-recursive src;
|
||||
create-module-metadata = module: {
|
||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory module);
|
||||
name =
|
||||
let
|
||||
path-name = builtins.replaceStrings [ src "/default.nix" ] [ "" "" ] (builtins.unsafeDiscardStringContext module);
|
||||
in
|
||||
if hasPrefix "/" path-name then
|
||||
builtins.substring 1 ((builtins.stringLength path-name) - 1) path-name
|
||||
else
|
||||
path-name;
|
||||
path = module;
|
||||
};
|
||||
modules-metadata = builtins.map create-module-metadata user-modules;
|
||||
merge-modules = modules: metadata:
|
||||
modules // {
|
||||
${metadata.name} = import metadata.path;
|
||||
${metadata.name} = args:
|
||||
let
|
||||
system = args.system or args.pkgs.system;
|
||||
target = args.target or system;
|
||||
|
||||
format =
|
||||
let
|
||||
virtual-system-type = snowfall-lib.system.get-virtual-system-type target;
|
||||
in
|
||||
if virtual-system-type != "" then
|
||||
virtual-system-type
|
||||
else if snowfall-lib.system.is-darwin target then
|
||||
"darwin"
|
||||
else
|
||||
"linux";
|
||||
|
||||
# Replicates the specialArgs from Snowfall Lib's system builder.
|
||||
modified-args = args // {
|
||||
inherit system target format;
|
||||
virtual = args.virtual or (snowfall-lib.system.get-virtual-system-type target != "");
|
||||
systems = args.systems or { };
|
||||
|
||||
|
||||
lib = snowfall-lib.internal.system-lib;
|
||||
pkgs = user-inputs.self.pkgs.${system}.nixpkgs;
|
||||
|
||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||
};
|
||||
user-module = import metadata.path modified-args;
|
||||
in
|
||||
user-module // { _file = metadata.path; };
|
||||
};
|
||||
modules-without-aliases = foldl merge-modules { } modules-metadata;
|
||||
aliased-modules = mapAttrs (name: value: modules-without-aliases.${value}) alias;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue