nixos/flake.nix

149 lines
5.5 KiB
Nix
Raw Normal View History

# _
# _ __ (_)_ _____ ___
# | '_ \| \ \/ / _ \/ __|
# | | | | |> < (_) \__ \
# |_| |_|_/_/\_\___/|___/
# this configuration file is basically a mashup of https://github.com/chfour/nixos and https://github.com/Misterio77/nix-starter-configs
# with lots of examples and knowledge gained from both of them
# and also this wonderful book which helped get me started on nix https://nixos-and-flakes.thiscute.world
# shoutouts to yall 🙏
2024-04-17 08:35:18 -05:00
{
description = "Sneexy's custom nixos configs";
2024-04-17 08:35:18 -05:00
inputs = {
# nixpkgs from the unstable branch. since stable is a bit too dated
# for my personal taste
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2024-04-17 08:35:18 -05:00
# "fresh from git" master branch of nixpkgs. for packages not yet in unstable
2024-04-17 08:35:18 -05:00
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
# chaotic's team nyx repo which usually contains unstable git packages or custom
# packages, such as modified linux kernels (which we do use here)
2024-04-17 08:35:18 -05:00
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
2024-04-17 21:31:20 -05:00
# catppuccin's nix thingy for theming applications with catppuccin directly inside
# of the config
catppuccin.url = "github:catppuccin/nix";
# home manager for managing user specific stuff
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# plasma manager to allow configuring plasma within nix config
plasma-manager = {
url = "github:pjones/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
# flake for 06cb:009a fingerprint scanners. to make the fingerprint scanner on my
# thinkpad t480 function.
# TODO: see if you can only add this for t480
nixos-06cb-009a-fingerprint-sensor = {
url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor";
inputs.nixpkgs.follows = "nixpkgs";
};
# hardware flakes for some devices
hardware.url = "github:nixos/nixos-hardware";
2024-04-17 08:35:18 -05:00
};
outputs = {
self,
nixpkgs,
nixpkgs-master,
chaotic,
2024-04-17 21:31:20 -05:00
catppuccin,
home-manager,
plasma-manager,
nixos-06cb-009a-fingerprint-sensor,
hardware,
...
} @ 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;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# main laptop i use daily
"thunkpad" = nixpkgs.lib.nixosSystem rec {
specialArgs = {inherit inputs outputs;};
modules = [
# specific configs for thunkpad/t480
./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
# 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
./machines/thonkpad
# shared/common config
./nixos/configuration.nix
# nyx repo
chaotic.nixosModules.default
];
};
};
2024-04-17 08:35:18 -05:00
# 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
"thunkpad" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./users/ruben/home.nix
2024-04-17 21:31:20 -05:00
# cat cat cat meow 🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛
catppuccin.homeManagerModules.catppuccin
];
};
# secondary device
"thonkpad" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./users/ruben/home.nix
2024-04-17 21:31:20 -05:00
# cat cat cat meow 🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛
catppuccin.homeManagerModules.catppuccin
];
};
2024-04-17 08:35:18 -05:00
};
};
}