nix-config/flake.nix

83 lines
2.8 KiB
Nix
Raw Normal View History

2023-10-13 20:52:26 +02:00
{
2023-12-23 21:20:40 +01:00
description = "Your new nix config";
2023-10-13 20:52:26 +02:00
2023-12-23 21:20:40 +01:00
inputs = {
# Nixpkgs
2023-12-23 22:05:10 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
2023-12-23 21:20:40 +01:00
# You can access packages and modules from different nixpkgs revs
# at the same time. Here's an working example:
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
2023-10-13 20:52:26 +02:00
2023-12-23 21:20:40 +01:00
# Home manager
2023-12-23 22:05:10 +01:00
home-manager.url = "github:nix-community/home-manager/release-23.11";
2023-12-23 21:20:40 +01:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2023-10-13 20:52:26 +02:00
2023-12-24 11:16:59 +01:00
hardware.url = "github:nixos/nixos-hardware";
2023-10-14 18:53:32 +02:00
2023-12-23 21:20:40 +01:00
# Shameless plug: looking for a way to nixify your themes and make
# everything match nicely? Try nix-colors!
# nix-colors.url = "github:misterio77/nix-colors";
};
2023-10-13 20:52:26 +02:00
2023-12-23 21:20:40 +01:00
outputs = {
2023-10-13 20:52:26 +02:00
self,
nixpkgs,
home-manager,
...
2023-12-23 21:20:40 +01:00
} @ inputs: let
inherit (self) outputs;
# Supported systems for your flake packages, shell, etc.
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
# 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;
2023-12-25 23:11:54 +01:00
vars = import ./vars.nix;
2023-10-13 20:52:26 +02:00
in {
2023-12-23 21:20:40 +01:00
# 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;
2023-10-14 18:53:32 +02:00
2023-12-23 21:20:40 +01:00
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
2023-12-23 22:05:10 +01:00
adalbert = nixpkgs.lib.nixosSystem {
2023-12-25 23:11:54 +01:00
specialArgs = {inherit inputs outputs vars;};
2023-12-23 21:20:40 +01:00
modules = [
2023-12-23 22:05:10 +01:00
./hosts/adalbert
2023-12-23 21:20:40 +01:00
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
2023-12-23 22:05:10 +01:00
"ghoscht@adalbert" = home-manager.lib.homeManagerConfiguration {
2023-12-23 21:20:40 +01:00
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
2023-12-25 23:11:54 +01:00
extraSpecialArgs = {inherit inputs outputs vars;};
2023-12-23 21:20:40 +01:00
modules = [
2023-12-23 22:05:10 +01:00
./home/ghoscht/adalbert.nix
2023-12-23 21:20:40 +01:00
];
};
};
2023-10-13 20:52:26 +02:00
};
}