diff --git a/flake.nix b/flake.nix index 1c5ab6c..8a6f1db 100644 --- a/flake.nix +++ b/flake.nix @@ -78,6 +78,8 @@ stateVersion = "23.05"; + extraLib = import ./nix/lib.nix inputs; + hosts = { patricknix = { type = "nixos"; diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index 082b70c..89928ee 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -12,7 +12,7 @@ ../../../users/root - ../../../nix/secrets.nix + ../../../modules/secrets.nix ]; age.identityPaths = ["/state/etc/ssh/ssh_host_ed25519_key"]; } diff --git a/hosts/common/core/home-manager.nix b/hosts/common/core/home-manager.nix index 024b634..71b6ad1 100644 --- a/hosts/common/core/home-manager.nix +++ b/hosts/common/core/home-manager.nix @@ -3,6 +3,7 @@ hyprland, stateVersion, config, + extraLib, ... }: { home-manager = { @@ -17,6 +18,7 @@ hyprland.homeManagerModules.default ]; extraSpecialArgs = { + inherit extraLib; nixosConfig = config; }; }; diff --git a/nix/secrets.nix b/modules/secrets.nix similarity index 100% rename from nix/secrets.nix rename to modules/secrets.nix diff --git a/nix/generate-node.nix b/nix/generate-node.nix index 7b3554a..d7362ee 100644 --- a/nix/generate-node.nix +++ b/nix/generate-node.nix @@ -22,12 +22,15 @@ in { pkgs = self.pkgs.${nodeMeta.system}; specialArgs = { inherit (nixpkgs) lib; - inherit (self) nodes stateVersion; - inherit inputs; - inherit nodeName; - inherit nodeMeta; + inherit (self) nodes stateVersion extraLib; + inherit + inputs + nodeName + nodePath + ; + inherit hyprland; - inherit nodePath; + nixos-hardware = nixos-hardware.nixosModules; impermanence = impermanence.nixosModules; }; diff --git a/nix/lib.nix b/nix/lib.nix new file mode 100644 index 0000000..be0a65e --- /dev/null +++ b/nix/lib.nix @@ -0,0 +1,13 @@ +{ + 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"; + }); +} diff --git a/users/common/impermanence.nix b/users/common/impermanence.nix index 0f5ca26..9b886a6 100644 --- a/users/common/impermanence.nix +++ b/users/common/impermanence.nix @@ -2,6 +2,7 @@ config, lib, nixosConfig, + extraLib, ... }: { home.persistence."/state/${config.home.homeDirectory}" = with lib.lists; { @@ -9,22 +10,12 @@ files = [ ".ssh/known_hosts" ]; - directories = let - # some programs( such as steam do not work with bindmounts - # additionally symlinks are a lot faster than bindmounts - # ~ 2x faster in my tests - makeSymLinks = x: - builtins.map (x: { - directory = x; - method = "symlink"; - }) - x; - in + directories = # firefox cannot be a symlink as home manager refuses put files outside your $HOME optionals config.programs.firefox.enable [ ".mozilla" ] - ++ makeSymLinks ( + ++ extraLib.impermanence.makeSymlinks ( optionals config.programs.atuin.enable [ ".local/share/atuin" ]