nix-cfg/flake.nix

128 lines
3.6 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";
# 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.11";
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
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
inputs.nixpkgs.follows = "nixpkgs";
};
2023-11-13 20:46:28 +01:00
nh = {
url = "github:viperML/nh";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-01-21 19:53:13 +01:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
2023-09-09 16:31:01 +02:00
};
outputs = inputs@{
nixpkgs,
nixpkgs-locked,
nixpkgs-fresh,
2023-09-09 16:31:01 +02:00
nixpkgs-stable,
2023-10-30 17:20:54 +01:00
# nix-index-database,
# nur,
2023-09-09 16:31:01 +02:00
home-manager,
2024-01-21 19:53:13 +01:00
sops-nix,
2023-09-09 16:31:01 +02:00
...
}:
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;
};
};
2023-12-11 17:47:25 +01:00
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
2023-12-11 17:47:25 +01:00
overlay-vaapiIntel
# overlay-gl
];
in
{
2023-09-09 16:31:01 +02:00
nixosConfigurations.lgm-nixos = nixpkgs.lib.nixosSystem rec {
inherit system;
2023-09-09 16:31:01 +02:00
specialArgs = {
# secrets = import ./secrets {};
2023-09-09 16:31:01 +02:00
};
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = my-overlays; })
2023-10-30 17:20:54 +01:00
# nur.nixosModules.nur
2023-11-13 20:46:28 +01:00
inputs.nh.nixosModules.default
2024-01-09 23:36:02 +01:00
./hosts/laptop/configuration.nix
./hosts/laptop/hardware-configuration.nix
./hosts/laptop/mounts.nix
2023-10-30 17:20:54 +01:00
# nix-index-database.nixosModules.nix-index
2024-01-21 19:53:13 +01:00
sops-nix.nixosModules.sops
2023-09-09 16:31:01 +02:00
# 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 ./hosts/laptop/home.nix;
2023-09-09 16:31:01 +02:00
home-manager.extraSpecialArgs = with specialArgs; {
# inherit secrets;
2023-09-09 16:31:01 +02:00
};
}
];
};
nixosConfigurations.lgm-vps1 = nixpkgs.lib.nixosSystem rec {
inherit system;
specialArgs = {
# secrets = import ./secrets {};
};
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = my-overlays; })
inputs.nh.nixosModules.default
./hosts/vps1/configuration.nix
./hosts/vps1/hardware-configuration.nix
sops-nix.nixosModules.sops
];
};
2023-09-09 16:31:01 +02:00
};
}