nix-starter-configs/flake.nix

93 lines
3 KiB
Nix
Raw Normal View History

2021-12-16 12:28:43 -08:00
{
description = "You new nix config";
inputs = {
# Utilities for building flakes
utils.url = "github:numtide/flake-utils";
# Core nix flakes
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
hardware.url = "github:nixos/nixos-hardware";
# Home manager flake
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2021-12-16 12:51:06 -08:00
# Extra community flakes
2021-12-16 12:48:46 -08:00
# Add any cool flakes you need
2021-12-16 12:51:06 -08:00
# nur.url = "github:nix-community/NUR"; # User contributed pkgs and modules
# impermanence.url = "github:riscadoa/impermanence"; # Utilities for opt-in persistance
# nix-colors.url = "github:misterio77/nix-colors"; # Color schemes for usage with home-manager
2021-12-16 12:28:43 -08:00
};
2021-12-16 12:48:46 -08:00
outputs = { self, nixpkgs, home-manager, utils, ... }@inputs: {
# Overlayed packages
overlay = (import ./overlays.nix);
2021-12-16 12:28:43 -08:00
2021-12-16 12:51:06 -08:00
# This repo's overlay plus any other overlays you use
2021-12-16 13:36:16 -08:00
# If you want to use packages from flakes that are not nixpkgs (such as NUR), add their overlays here.
overlays = [
self.overlay
# nur.overlay
];
2021-12-16 12:28:43 -08:00
2021-12-16 12:48:46 -08:00
# System configurations
# Accessible via 'nixos-rebuild --flake'
nixosConfigurations = {
2021-12-16 13:36:16 -08:00
# TODO: Replace with your hostname
2021-12-16 12:48:46 -08:00
cool-computer = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
2021-12-16 13:36:16 -08:00
2021-12-16 12:48:46 -08:00
modules = [
./configuration.nix
2021-12-16 13:36:16 -08:00
# Adds your overlay and packages to nixpkgs
2021-12-16 12:48:46 -08:00
{ nixpkgs.overlays = self.overlays; }
];
2021-12-16 13:36:16 -08:00
# Pass our flake inputs into the config
specialArgs = { inherit inputs; };
2021-12-16 12:28:43 -08:00
};
2021-12-16 12:48:46 -08:00
};
2021-12-16 12:28:43 -08:00
2021-12-16 12:48:46 -08:00
# Home configurations
# Accessible via 'home-manager --flake'
homeConfigurations = {
2021-12-16 13:36:16 -08:00
# TODO: Replace with your username@hostname
"you@cool-computer" = home-manager.lib.homeManagerConfiguration rec {
# TODO: Replace with your username
2021-12-16 12:48:46 -08:00
username = "you";
2021-12-16 13:36:16 -08:00
homeDirectory = "/home/${username}";
system = "x86_64-linux";
2021-12-16 12:48:46 -08:00
configuration = ./home.nix;
2021-12-16 13:36:16 -08:00
extraModules = [
# Adds your overlay and packages to nixpkgs
{ nixpkgs.overlays = self.overlays; }
];
# Pass our flake inputs into the config
extraSpecialArgs = { inherit inputs; };
2021-12-16 12:28:43 -08:00
};
2021-12-16 12:48:46 -08:00
};
2021-12-16 12:51:06 -08:00
}
// utils.lib.eachDefaultSystem (system:
2021-12-16 12:48:46 -08:00
let
pkgs = import nixpkgs { inherit system; overlays = self.overlays; };
nix = pkgs.writeShellScriptBin "nix" ''
exec ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
'';
2021-12-16 12:48:46 -08:00
hm = home-manager.defaultPackage."${system}";
in
{
# Your custom packages, plus nixpkgs and overlayed stuff
# Accessible via 'nix build .#example' or 'nix build .#nixpkgs.example'
packages = {
nixpkgs = pkgs;
} // (import ./pkgs { inherit pkgs; });
2021-12-16 12:28:43 -08:00
2021-12-16 12:48:46 -08:00
# Devshell for bootstrapping plus editor utilities (fmt and LSP)
# Accessible via 'nix develop'
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ nix nixfmt rnix-lsp hm ];
};
});
2021-12-16 12:28:43 -08:00
}