cleaned up lib and modules/misc

This commit is contained in:
Gerg-L 2023-06-26 22:13:41 -04:00
parent f2974e6b13
commit da8e226c3a
7 changed files with 55 additions and 52 deletions

View file

@ -5,29 +5,31 @@ inputs @ {
}: let
inherit (unstable) lib;
listNixFilesRecursive = path:
builtins.filter (lib.hasSuffix "nix")
(lib.filesystem.listFilesRecursive path);
importAll = path:
map
(module: (import module inputs))
(
builtins.filter (lib.hasSuffix ".nix")
(lib.filesystem.listFilesRecursive path)
);
(listNixFilesRecursive path);
mkModules = path:
lib.listToAttrs (
map (
name: {
name = lib.removePrefix (toString path + "/") (lib.removeSuffix ".nix" (toString name));
name = lib.pipe name [
toString
(lib.removePrefix "${path}/")
(lib.removeSuffix ".nix")
];
value = import name inputs;
}
)
(
builtins.filter (lib.hasSuffix ".nix")
(lib.filesystem.listFilesRecursive path)
)
(listNixFilesRecursive path)
);
in {
inherit importAll mkModules;
inherit importAll mkModules listNixFilesRecursive;
withSystem = f:
lib.fold lib.recursiveUpdate {}
@ -39,12 +41,13 @@ in {
lib.nixosSystem {
inherit system;
modules =
builtins.attrValues self.nixosModules ++ importAll (self + "/hosts/" + name);
builtins.attrValues self.nixosModules
++ importAll "${self}/hosts/${name}";
}
);
mkDisko = names:
lib.genAttrs names (
name: (import (self + "/hosts/" + name + "/disko.nix") inputs)
name: (import "${self}/hosts/${name}/disko.nix" inputs)
);
mkPkgs = pkgs: path:
@ -53,9 +56,6 @@ in {
name = lib.removeSuffix ".nix" (builtins.baseNameOf module);
value = pkgs.callPackage module {};
})
(
builtins.filter (lib.hasSuffix ".nix")
(lib.filesystem.listFilesRecursive path)
)
(listNixFilesRecursive path)
);
}

View file

@ -16,7 +16,7 @@
enable = true;
displayManager = {
sessionCommands = ''
${lib.getExe pkgs.feh} --bg-center ${self.packages.${pkgs.system}.images + /recursion.png}
${lib.getExe pkgs.feh} --bg-center "${self.packages.${pkgs.system}.images}/recursion.png"
${lib.getExe pkgs.numlockx}
${lib.getExe pkgs.picom} &
'';

View file

@ -11,7 +11,7 @@
displayManager = {
lightdm = {
enable = true;
background = self.packages.${pkgs.system}.images + /recursion.png;
background = "${self.packages.${pkgs.system}.images}/recursion.png";
extraConfig = "minimum-vt=1";
greeters.mini = {
enable = true;

View file

@ -17,7 +17,7 @@
plymouth = {
enable = lib.mkDefault true;
theme = "breeze";
logo = self.packages.${pkgs.system}.images + /logo.png;
logo = "${self.packages.${pkgs.system}.images}/logo.png";
};
loader = {
grub.configurationLimit = 10;

View file

@ -15,35 +15,35 @@ _: {
};
};
config = lib.mkMerge [
(lib.mkIf (config.nixpkgs.allowedUnfree != []) {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree;
})
{
environment.defaultPackages = lib.mkForce [
pkgs.efibootmgr #efi editor
pkgs.pciutils #lspci
pkgs.alsa-utils #volume control
pkgs.xclip #commandline clipboard access
pkgs.bottom #view tasks
pkgs.nix-tree #view packages
pkgs.nix-output-monitor #nom nom nom nom];
];
config = {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree;
#enable ssh
programs.mtr.enable = true; #ping and traceroute
services.openssh = {
enable = true;
hostKeys = lib.mkForce [];
settings = {
PermitRootLogin = "yes";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
environment.defaultPackages = lib.mkForce (builtins.attrValues {
inherit
(pkgs)
alsa-utils #volume control
bottom #view tasks
efibootmgr #efi editor
nix-output-monitor #nom nom nom nom;
nix-tree #view packages
pciutils #lspci
xclip #commandline clipboard access
;
});
#enable ssh
programs.mtr.enable = true; #ping and traceroute
services.openssh = {
enable = true;
hostKeys = lib.mkForce [];
settings = {
PermitRootLogin = "yes";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
i18n.defaultLocale = "en_US.UTF-8";
#time settings
time.timeZone = "America/New_York";
}
];
};
i18n.defaultLocale = "en_US.UTF-8";
#time settings
time.timeZone = "America/New_York";
};
}

View file

@ -3,7 +3,11 @@ inputs: {pkgs, ...}: {
nix = {
package = inputs.nix.packages.${pkgs.system}.default;
settings = {
experimental-features = ["nix-command" "flakes" "repl-flake"];
experimental-features = [
"nix-command"
"flakes"
"repl-flake"
];
auto-optimise-store = true;
warn-dirty = false;
#ignore global registry
@ -14,8 +18,7 @@ inputs: {pkgs, ...}: {
"root"
"@wheel"
];
allowed-users = [
];
allowed-users = [];
use-xdg-base-directories = true;
};
};

View file

@ -14,7 +14,7 @@
pkgs.sops
];
sops = {
defaultSopsFile = self + "/hosts/" + config.networking.hostName + "/secrets.yaml";
defaultSopsFile = "${self}/hosts/${config.networking.hostName}/secrets.yaml";
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
};
}