nixos/flake.nix
2023-12-11 20:43:55 -05:00

145 lines
4.1 KiB
Nix

{
description = "Your new nix config";
inputs = {
# Nixpkgs (usually unstable)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Home manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Darwin & Apple Silicon tools
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
apple-silicon.url = "github:tpwrules/nixos-apple-silicon";
# Secrets
sops-nix.url = "github:Mic92/sops-nix";
sops-nix-darwin.url = "github:Kloenk/sops-nix?ref=darwin";
# Fancy stuff
nix-colors.url = "github:misterio77/nix-colors";
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
nur.url = "github:nix-community/nur";
firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
mkNixos = modules: nixpkgs.lib.nixosSystem {
inherit modules;
specialArgs = { inherit inputs outputs; };
};
mkDarwin = system: modules: inputs.darwin.lib.darwinSystem {
inherit modules system inputs;
specialArgs = { inherit inputs outputs; };
};
mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration {
inherit modules pkgs;
extraSpecialArgs = { inherit inputs outputs; };
};
in
rec {
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./pkgs { inherit pkgs; }
);
# Devshell for bootstrapping
# Acessible through 'nix develop' or 'nix-shell' (legacy)
devShells = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./shell.nix { inherit pkgs; }
);
# 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;
# Reusable nix-darwin packages you might want to export
# These are usually hacks!
darwinModules = import ./modules/darwin;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# T480
thonkpad = mkNixos [ ./nixos/hosts/thonkpad ];
# Blueberry Lab
blueberry = mkNixos [ ./nixos/hosts/blueberry ];
# 2015 MBP
#echo = mkNixos [ ./nixos/hosts/echo ];
# 2013 MBP
#who =
# Pi4B Xbox Hacking
#xxx = mkNixos [
# PlanetSide Stack
#watermelon =
# Akkoma (sapphic.engineer)
#pineapple =
# Web Services
#honeydew =
# Workers
#tangerine =
# Pi3B Audio Streamer
#audiofox =
# Router
#nekomata =
# just give me a machine THANKS
#lab =
};
darwinConfigurations = {
noe-air = mkDarwin "aarch64-darwin" [ ./darwin/hosts/noe-air ];
AMERMACC02G65A8MD6T = mkDarwin "x86_64-darwin" [ ./darwin/hosts/work-mac ];
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
# TODO: add generic standalone home-manager config
};
};
}