nix-cfg/flake.nix

69 lines
2.1 KiB
Nix
Raw Normal View History

2023-09-09 16:31:01 +02:00
{
description = "Lgm's NixOS Flake";
inputs = {
# There are many ways to reference flake inputs.
# The most widely used is `github:owner/name/reference`,
# which represents the GitHub repository URL + branch/commit-id/tag.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.05";
2023-10-30 17:20:54 +01:00
# nix-index-database.url = "github:nix-community/nix-index-database";
# nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
# nur = {
# url = "github:nix-community/NUR";
# };
2023-09-09 16:31:01 +02:00
# nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
# home-manager, used for managing user configuration
home-manager = {
2023-10-30 17:20:54 +01:00
url = "github:nix-community/home-manager/master";
2023-09-09 16:31:01 +02:00
# The `follows` keyword in inputs is used for inheritance.
# Here, `inputs.nixpkgs` of home-manager is kept consistent with
# the `inputs.nixpkgs` of the current flake,
# to avoid problems caused by different versions of nixpkgs.
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
nixpkgs,
nixpkgs-stable,
2023-10-30 17:20:54 +01:00
# nix-index-database,
# nur,
2023-09-09 16:31:01 +02:00
home-manager,
...
}: {
nixosConfigurations.lgm-nixos = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
pkgs-stable = import nixpkgs-stable {
system = system;
config.allowUnfree = true;
};
secrets = import ./secrets {};
};
modules = [
2023-10-30 17:20:54 +01:00
# nur.nixosModules.nur
2023-09-09 16:31:01 +02:00
./configuration.nix
2023-10-30 17:20:54 +01:00
# nix-index-database.nixosModules.nix-index
2023-09-09 16:31:01 +02:00
./mounts.nix
# make home-manager as a module of nixos
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lgm = import ./home.nix;
home-manager.extraSpecialArgs = with specialArgs; {
inherit pkgs-stable;
2023-10-30 17:20:54 +01:00
inherit secrets;
2023-09-09 16:31:01 +02:00
};
}
];
};
};
}