hell n back

This commit is contained in:
Jet Pham 2024-03-22 23:35:56 -07:00
parent 3ee6761b45
commit cac7203033
45 changed files with 2988 additions and 177 deletions

View file

@ -2,35 +2,58 @@
description = "Jet's Nix Config";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-hardware.url = "nixos-hardware";
# nixos-raspberrypi.url = "github:ramblurr/nixos-raspberrypi";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
nixConfig = {
};
# All outputs for the system (configs)
outputs = { home-manager, nixpkgs, nixos-hardware, ... }@inputs:
let
system = "x86_64-linux"; #current system
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
lib = nixpkgs.lib;
outputs = {
self,
nixpkgs,
nixos-hardware,
home-manager,
...
} @ inputs: {
nixosConfigurations = {
laptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
home-manager.nixosModules.home-manager
nixos-hardware.nixosModules.lenovo-thinkpad-x1-6th-gen
./laptop.nix
];
};
};
};
# This lets us reuse the code to "create" a system
# Credits go to sioodmy on this one!
# https://github.com/sioodmy/dotfiles/blob/main/flake.nix
mkSystem = pkgs: system: hostname:
let
hardwareConfig = {
"laptop" = "${inputs.nixos-hardware}.nixosModules.lenovo-thinkpad-x1-6th-gen";
# Add other hostnames and their respective hardware configurations here
};
in
pkgs.lib.nixosSystem {
inherit system;
modules = [
{ networking.hostName = hostname; }
./modules/system/configuration.nix
(./. + "/hosts/${hostname}/hardware-configuration.nix")
(hardwareConfig.${hostname} or (lib.mkForce {})) # Import hardware configuration if exists for hostname
home-manager.nixosModules.home-manager
{
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs; };
users.jet = (./. + "/hosts/${hostname}/user.nix");
};
}
];
specialArgs = { inherit inputs; };
};
in {
nixosConfigurations = {
# Now, defining a new system is can be done in one line
# Architecture Hostname
laptop = mkSystem inputs.nixpkgs "x86_64-linux" "laptop";
#desktop = mkSystem inputs.nixpkgs "x86_64-linux" "desktop";
};
};
}