From 21c5f9d77e3a848e99c361ff810175815f700d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Sat, 26 Aug 2023 19:38:32 +0900 Subject: [PATCH] chore: reworked extraLib --- flake.nix | 3 +-- hosts/common/core/home-manager.nix | 3 +-- nix/generate-node.nix | 4 ++-- nix/lib.nix | 20 ++++++++++++-------- users/common/impermanence.nix | 3 +-- users/patrick/impermanence.nix | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index ca30bf5..6edc85c 100644 --- a/flake.nix +++ b/flake.nix @@ -79,8 +79,6 @@ stateVersion = "23.05"; - extraLib = import ./nix/lib.nix inputs; - hosts = { patricknix = { type = "nixos"; @@ -97,6 +95,7 @@ } // flake-utils.lib.eachDefaultSystem (system: rec { pkgs = import nixpkgs { + overlays = [(import nix/lib.nix inputs)]; inherit system; # TODO fix this to only allow specific unfree packages config.allowUnfree = true; diff --git a/hosts/common/core/home-manager.nix b/hosts/common/core/home-manager.nix index 71b6ad1..dce413b 100644 --- a/hosts/common/core/home-manager.nix +++ b/hosts/common/core/home-manager.nix @@ -3,7 +3,7 @@ hyprland, stateVersion, config, - extraLib, + pkgs, ... }: { home-manager = { @@ -18,7 +18,6 @@ hyprland.homeManagerModules.default ]; extraSpecialArgs = { - inherit extraLib; nixosConfig = config; }; }; diff --git a/nix/generate-node.nix b/nix/generate-node.nix index d7362ee..3302b46 100644 --- a/nix/generate-node.nix +++ b/nix/generate-node.nix @@ -21,8 +21,8 @@ in { inherit (nodeMeta) system; pkgs = self.pkgs.${nodeMeta.system}; specialArgs = { - inherit (nixpkgs) lib; - inherit (self) nodes stateVersion extraLib; + inherit (self.pkgs.${nodeMeta.system}) lib; + inherit (self) nodes stateVersion; inherit inputs nodeName diff --git a/nix/lib.nix b/nix/lib.nix index be0a65e..91f4b5c 100644 --- a/nix/lib.nix +++ b/nix/lib.nix @@ -2,12 +2,16 @@ self, nixpkgs, ... -}: { - # some programs( such as steam do not work with bindmounts - # additionally symlinks are a lot faster than bindmounts - # ~ 2x faster in my tests - impermanence.makeSymlinks = builtins.map (x: { - directory = x; - method = "symlink"; - }); +}: self: super: { + lib = + super.lib + // { + # some programs( such as steam do not work with bindmounts + # additionally symlinks are a lot faster than bindmounts + # ~ 2x faster in my tests + impermanence.makeSymlinks = builtins.map (x: { + directory = x; + method = "symlink"; + }); + }; } diff --git a/users/common/impermanence.nix b/users/common/impermanence.nix index 2d83ac2..5e7c3fd 100644 --- a/users/common/impermanence.nix +++ b/users/common/impermanence.nix @@ -3,7 +3,6 @@ config, lib, nixosConfig, - extraLib, ... }: { home.persistence."/state/${config.home.homeDirectory}" = with lib.lists; { @@ -16,7 +15,7 @@ optionals config.programs.firefox.enable [ ".mozilla" ] - ++ extraLib.impermanence.makeSymlinks ( + ++ pkgs.lib.impermanence.makeSymlinks ( optionals config.programs.atuin.enable [ ".local/share/atuin" ] diff --git a/users/patrick/impermanence.nix b/users/patrick/impermanence.nix index e38019e..86c0da7 100644 --- a/users/patrick/impermanence.nix +++ b/users/patrick/impermanence.nix @@ -1,12 +1,12 @@ { config, - extraLib, + pkgs, ... }: { home = { persistence."/state/${config.home.homeDirectory}" = { allowOther = true; - directories = extraLib.impermanence.makeSymlinks [ + directories = pkgs.lib.impermanence.makeSymlinks [ "repos" "Downloads"