some modularizing and refactoring

This commit is contained in:
cnst
2024-10-24 18:49:49 +02:00
parent 7f9d5c000f
commit ca0dc208e0
25 changed files with 248 additions and 227 deletions

50
nix/default.nix Normal file
View File

@@ -0,0 +1,50 @@
# Yanked from https://github.com/fufexan/dotfiles
{
inputs,
lib,
config,
pkgs,
...
}: {
imports = [
./nixpkgs
./home-manager
./substituters
];
environment = {
systemPackages = with pkgs; [
git
stow
];
localBinInPath = true;
};
console.useXkbConfig = true;
nix = let
flakeInputs = lib.filterAttrs (_: v: lib.isType "flake" v) inputs;
in {
package = pkgs.lix;
# pin the registry to avoid downloading and evaling a new nixpkgs version every time
registry = lib.mapAttrs (_: v: {flake = v;}) flakeInputs;
# set the path for channels compat
nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
settings = {
auto-optimise-store = true;
builders-use-substitutes = true;
warn-dirty = false;
experimental-features = ["nix-command" "flakes"];
flake-registry = "/etc/nix/registry.json";
# # for direnv GC roots
# keep-derivations = true;
# keep-outputs = true;
trusted-users = ["root" "@wheel"];
};
};
}

View File

@@ -0,0 +1,10 @@
{inputs, ...}: {
imports = [
inputs.hm.nixosModules.default
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
}

13
nix/nixpkgs/default.nix Normal file
View File

@@ -0,0 +1,13 @@
{
nixpkgs = {
overlays = [
# (_: prev: {
# python312 = prev.python312.override {packageOverrides = _: pysuper: {nose = pysuper.pynose;};};
# })
];
config = {
allowUnfree = true;
input-fonts.acceptLicense = true;
};
};
}

58
nix/shell/default.nix Normal file
View File

@@ -0,0 +1,58 @@
{
inputs,
pkgs ? import <nixpkgs> {},
...
}: {
default = pkgs.mkShell {
# Add Rust toolchain from Fenix and rust-analyzer-nightly
packages = [
(inputs.fenix.packages.${pkgs.stdenv.hostPlatform.system}.complete.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
])
];
nativeBuildInputs = with pkgs; [
# Build tools
cmake # Build system generator
gnumake # GNU Make
pkg-config # Manages library paths during compilation
perl # Scripting language, sometimes needed during builds
# Version control
git # Version control system
# Auto-patching (include if needed)
autoPatchelfHook # Automatically patches ELF binaries
# Scripting languages (include if needed)
# nodejs # JavaScript runtime environment
];
buildInputs = with pkgs; [
# Graphics and UI libraries
aquamarine # Aquamarine compositor library for Wayland
egl-wayland # EGLStream-based Wayland platform
wayland # Wayland client library
wayland-protocols # Wayland protocols for Wayland applications
gtk3
# Cryptography
openssl # TLS/SSL library for networking and encryption
];
shellHook = ''
# Set LD_LIBRARY_PATH if needed (temporary fix)
# export LD_LIBRARY_PATH="${pkgs.openssl.out}/lib:$LD_LIBRARY_PATH"
# Set SHELL to zsh if available
export SHELL=$(which zsh)
if [ "$SHELL" != "$(which zsh)" ]; then
exec $SHELL
fi
'';
};
}

View File

@@ -0,0 +1,25 @@
{
nix.settings = {
substituters = [
"https://cache.nixos.org?priority=10"
"https://fufexan.cachix.org"
"https://helix.cachix.org"
"https://hyprland.cachix.org"
"https://nix-community.cachix.org"
"https://nix-gaming.cachix.org"
"https://yazi.cachix.org"
"https://chaotic-nyx.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"fufexan.cachix.org-1:LwCDjCJNJQf5XD2BV+yamQIMZfcKWR9ISIFy5curUsY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k="
"chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8"
];
};
}