nix-cfg/flake.nix

106 lines
2.9 KiB
Nix

{
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";
# separate inputs to lock some packages
# locked - stuff to be updated very unfrequently
# fresh - mostly desktop apps
nixpkgs-locked.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-fresh.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.05";
# nix-index-database.url = "github:nix-community/nix-index-database";
# nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
# nur = {
# url = "github:nix-community/NUR";
# };
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
nh = {
url = "github:viperML/nh";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
nixpkgs,
nixpkgs-locked,
nixpkgs-fresh,
nixpkgs-stable,
# nix-index-database,
# nur,
home-manager,
...
}:
let
system = "x86_64-linux";
overlay-locked = final: prev: {
locked = import nixpkgs-locked {
inherit system;
config.allowUnfree = true;
};
};
overlay-fresh = final: prev: {
fresh = import nixpkgs-fresh {
inherit system;
config.allowUnfree = true;
};
};
overlay-stable = final: prev: {
stable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
};
overlay-vaapiIntel = final: prev: {
vaapiIntel = prev.vaapiIntel.override { enableHybridCodec = true; };
};
# overlay-gl = final: prev: {
# libGL = final.stable.libGL;
# glfw = final.stable.glfw;
# };
my-overlays = [
overlay-locked
overlay-fresh
overlay-stable
overlay-vaapiIntel
# overlay-gl
];
in
{
nixosConfigurations.lgm-nixos = nixpkgs.lib.nixosSystem rec {
inherit system;
specialArgs = {
secrets = import ./secrets {};
};
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = my-overlays; })
# nur.nixosModules.nur
inputs.nh.nixosModules.default
./configuration.nix
# nix-index-database.nixosModules.nix-index
./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 secrets;
};
}
];
};
};
}