From 35177ce911cb50b607ca30eeeb4ff5e1988cdee8 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Mon, 19 Feb 2024 11:29:46 -0800 Subject: [PATCH] chore(systems): minor cleanup --- lib.nix | 4 +++- nixos/base/network.nix | 12 +++++++++--- outputs.nix | 1 - systems/default.nix | 22 +++++++++------------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lib.nix b/lib.nix index a64dedfe..84396194 100644 --- a/lib.nix +++ b/lib.nix @@ -34,11 +34,13 @@ mkWinPath = replaceStrings ["/"] ["\\"]; in { inherit tree nixlib inputs; + meta = tree.impure; std = inputs.self.lib.Std.Std.compat; Std = inputs.std-fl.lib; lib = { + domain = "gensokyo.zone"; inherit mkWinPath userIs eui64 toHexStringLower hexCharToInt; - inherit (inputs.arcexprs.lib) unmerged; + inherit (inputs.arcexprs.lib) unmerged json; }; generate = import ./generate.nix {inherit inputs tree;}; } diff --git a/nixos/base/network.nix b/nixos/base/network.nix index 014ebbf9..840b8bdf 100644 --- a/nixos/base/network.nix +++ b/nixos/base/network.nix @@ -1,9 +1,15 @@ -{ config, name, lib, ... }: with lib; - { + inputs, + name, + lib, + ... +}: let + inherit (lib.modules) mkDefault mkOverride; + inherit (inputs.self.lib.lib) domain; +in { networking = { nftables.enable = true; - domain = mkDefault "gensokyo.zone"; + domain = mkDefault domain; hostName = mkOverride 25 name; }; } diff --git a/outputs.nix b/outputs.nix index da19819d..25cf9258 100644 --- a/outputs.nix +++ b/outputs.nix @@ -4,7 +4,6 @@ }; systems = import ./systems { inherit inputs; - tree = tree.impure; }; outputs = inputs.flake-utils.lib.eachDefaultSystem diff --git a/systems/default.nix b/systems/default.nix index 10d14d26..68b90723 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -1,15 +1,11 @@ -{ - inputs, - tree, -}: let +{inputs}: let # The purpose of this file is to set up the host module which allows assigning of the system, e.g. aarch64-linux and the builder used with less pain. lib = inputs.self.lib.nixlib; + inherit (inputs.self.lib) meta std; inherit (lib.modules) evalModules mkOptionDefault; - inherit (inputs.self.lib) std; inherit (std) string set; defaultSpecialArgs = { - inherit inputs std; - meta = tree; + inherit inputs std meta; }; hostModule = { config, @@ -17,8 +13,8 @@ ... }: { options = let + inherit (inputs.self.lib.lib) json; inherit (lib.types) str listOf attrs unspecified attrsOf nullOr; - jsonAttrsType = inputs.arcexprs.lib.json.types.attrs; inherit (lib.options) mkOption; in { arch = mkOption { @@ -51,7 +47,7 @@ internal = true; }; deploy = mkOption { - type = nullOr jsonAttrsType; + type = nullOr json.types.attrs; }; }; config = { @@ -91,11 +87,11 @@ linux = "linux"; } .${string.toLower config.type}; - modules = with tree; [ + modules = [ # per-OS modules - tree.modules.${config.folder} + meta.modules.${config.folder} # per-OS configuration - tree.${config.folder}.base + meta.${config.folder}.base ]; builder = { @@ -140,7 +136,7 @@ machine = name; }; }) - (set.map (_: c: c) tree.systems); + (set.map (_: c: c) meta.systems); processHost = name: cfg: let host = cfg.config; in