refactor: yet another redo of the entire config to try and minimize issues

This commit is contained in:
Ruben 2024-04-18 09:40:51 -05:00
commit ee6c740f68
No known key found for this signature in database
GPG key ID: AE181294E97E4802
11 changed files with 138 additions and 171 deletions

112
flake.nix
View file

@ -11,6 +11,8 @@
description = "Sneexy's custom nixos configs";
inputs = {
# TODO: dear god there is a lot here. can we remove some? or try to split them?
# nixpkgs from the unstable branch. since stable is a bit too dated
# for my personal taste
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -22,6 +24,9 @@
# packages, such as modified linux kernels (which we do use here)
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
# flake that allows for installing system and user flatpaks
nix-flatpak.url = "github:gmodena/nix-flatpak";
# catppuccin's nix thingy for theming applications with catppuccin directly inside
# of the config
catppuccin.url = "github:catppuccin/nix";
@ -56,6 +61,7 @@
nixpkgs,
nixpkgs-master,
chaotic,
nix-flatpak,
catppuccin,
home-manager,
plasma-manager,
@ -64,86 +70,64 @@
...
} @ inputs: let
inherit (self) outputs;
# our systems are all x86_64 unfortunately
systems = [
"x86_64-linux"
];
# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
nixosModules = {
declarativeHome = { ... }: {
# thanks to https://determinate.systems/posts/declarative-gnome-configuration-with-nixos for teaching how to use this home manager module
imports = [ home-manager.nixosModules.home-manager ];
config = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};
};
defaults = { ... }: {
# globally allow unfree packages
nixpkgs.config.allowUnfree = true;
# flakes, duh
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
};
};
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# main laptop i use daily
# my main laptop, a thinkpad t480
"thunkpad" = nixpkgs.lib.nixosSystem rec {
specialArgs = {inherit inputs outputs;};
modules = [
# specific configs for thunkpad/t480
# boowomp sound effect
system = "x86_64-linux";
specialArgs = {
inherit inputs outputs;
pkgs-master = nixpkgs-master.legacyPackages.${system};
};
modules = with self.nixosModules; [
./machines/thunkpad
# shared/common config
./nixos/configuration.nix
# fingerprint modules
nixos-06cb-009a-fingerprint-sensor.nixosModules.open-fprintd
nixos-06cb-009a-fingerprint-sensor.nixosModules.python-validity
declarativeHome ./users/ruben
# flatpaks
nix-flatpak.nixosModules.nix-flatpak
# nyx repo
chaotic.nixosModules.default
];
};
# secondary 2 in 1 device, not really used
"thonkpad" = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
# nixos configuration file (and others) for thonkpad
# my secondary laptop, a thinkpad yoga 14...?
"thonkpad" = nixpkgs.lib.nixosSystem rec {
# boowomp sound effect x2
system = "x86_64-linux";
specialArgs = {
inherit inputs outputs;
pkgs-master = nixpkgs-master.legacyPackages.${system};
};
modules = with self.nixosModules; [
./machines/thonkpad
# shared/common config
./nixos/configuration.nix
declarativeHome ./users/ruben
# flatpaks
nix-flatpak.nixosModules.nix-flatpak
# nyx repo
chaotic.nixosModules.default
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
# TODO: theres probably a better way to do this/specify one home config for all devices
# main device
"ruben@thunkpad" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home-manager/home.nix
# cat cat cat meow 🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛
catppuccin.homeManagerModules.catppuccin
];
};
# secondary device
"ruben@thonkpad" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home-manager/home.nix
# cat cat cat meow 🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛
catppuccin.homeManagerModules.catppuccin
];
};
};
};
}