chore: improved folder setup, added modules and lib

This commit is contained in:
Patrick Großmann 2023-06-03 16:20:56 +09:00
parent 2df11205d8
commit f0248e4142
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
7 changed files with 29 additions and 18 deletions

View file

@ -78,6 +78,8 @@
stateVersion = "23.05";
extraLib = import ./nix/lib.nix inputs;
hosts = {
patricknix = {
type = "nixos";

View file

@ -12,7 +12,7 @@
../../../users/root
../../../nix/secrets.nix
../../../modules/secrets.nix
];
age.identityPaths = ["/state/etc/ssh/ssh_host_ed25519_key"];
}

View file

@ -3,6 +3,7 @@
hyprland,
stateVersion,
config,
extraLib,
...
}: {
home-manager = {
@ -17,6 +18,7 @@
hyprland.homeManagerModules.default
];
extraSpecialArgs = {
inherit extraLib;
nixosConfig = config;
};
};

View file

@ -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;
};

13
nix/lib.nix Normal file
View file

@ -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";
});
}

View file

@ -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"
]