From 10f795dbb3b26eedb74ca60384c9b45d92e85460 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Thu, 25 May 2023 05:02:07 +0700 Subject: [PATCH] nuke flake-utils-plus --- flake.lock | 36 +--------------------------- flake.nix | 49 ++++++++++++++++++++++++--------------- system/modules/common.nix | 4 ---- 3 files changed, 31 insertions(+), 58 deletions(-) diff --git a/flake.lock b/flake.lock index 43b6aa9..5e7f710 100644 --- a/flake.lock +++ b/flake.lock @@ -68,21 +68,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -260,8 +245,7 @@ "nixpkgs": "nixpkgs", "notlua": "notlua", "nur": "nur", - "rust-overlay": "rust-overlay", - "utils": "utils_2" + "rust-overlay": "rust-overlay" } }, "rust-overlay": { @@ -314,24 +298,6 @@ "repo": "flake-utils", "type": "github" } - }, - "utils_2": { - "inputs": { - "flake-utils": "flake-utils_2" - }, - "locked": { - "lastModified": 1657226504, - "narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=", - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a", - "type": "github" - }, - "original": { - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ed69659..527a288 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,6 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; nixos-hardware.url = "github:NixOS/nixos-hardware"; impermanence.url = "github:nix-community/impermanence"; nur.url = "github:nix-community/NUR"; @@ -30,7 +29,7 @@ }; }; - outputs = inputs@{ self, nixpkgs, utils, nixos-hardware, impermanence, home-manager, nur, nix-gaming, notlua, nixos-mailserver, ... }: + outputs = inputs@{ self, nixpkgs, nixos-hardware, impermanence, home-manager, nur, nix-gaming, notlua, nixos-mailserver, ... }: let # IRL-related stuff I'd rather not put into git priv = @@ -102,28 +101,40 @@ ]; }; }; - in utils.lib.mkFlake { - inherit self inputs; - hostDefaults.modules = [ - ./system/modules/vfio.nix - ./system/modules/ccache.nix - ./system/modules/impermanence.nix - ./system/modules/common.nix - impermanence.nixosModule - ]; - hosts = builtins.mapAttrs (hostname: args @ { system ? "x86_64-linux", modules, ... }: { + in { + nixosConfigurations = builtins.mapAttrs (hostname: args @ { system ? "x86_64-linux", modules, ... }: + lib.nixosSystem ({ inherit system; - modules = modules ++ [ (getPrivSys hostname) ]; - extraArgs = { - inherit nixpkgs; - }; + modules = modules ++ [ + { networking.hostName = hostname; } + ./system/modules/vfio.nix + ./system/modules/ccache.nix + ./system/modules/impermanence.nix + ./system/modules/common.nix + impermanence.nixosModule + (getPrivSys hostname) + { + nix.registry = + builtins.mapAttrs + (_: v: { flake = v; }) + (lib.filterAttrs (_: v: v?outputs) inputs); + + # add import'able flakes (like nixpkgs) to nix path + environment.etc = lib.mapAttrs' + (name: value: { + name = "nix/inputs/${name}"; + value = { source = value.outPath; }; + }) + (lib.filterAttrs (_: v: builtins.pathExists "${v}/default.nix") inputs); + nix.nixPath = [ "/etc/nix/inputs" ]; + } + ]; specialArgs = { - inherit lib; + inherit lib nixpkgs; hardware = nixos-hardware.nixosModules; }; - } // (builtins.removeAttrs args [ "home" "modules" ])) + } // (builtins.removeAttrs args [ "home" "modules" ]))) config; - } // { homeConfigurations = builtins.foldl' (a: b: a // b) diff --git a/system/modules/common.nix b/system/modules/common.nix index a9691cc..8f6fc4f 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -48,10 +48,6 @@ extraOptions = '' experimental-features = nix-command flakes ''; - # from flake-utils-plus: make this flake's nixpkgs available to the whole system - generateNixPathFromInputs = true; - generateRegistryFromInputs = true; - linkInputs = true; }; systemd.services.nix-daemon.serviceConfig.LimitSTACKSoft = "infinity"; boot.kernelParams = lib.optionals (cfg.resolution != null) [