nixconf/flake.nix

156 lines
4.4 KiB
Nix

{
description = "main system and home configuration flake";
inputs = {
# NixOS official package source, using the nixos-25.05 branch as stable and nixos-unstable as default
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nur.url = "github:nix-community/NUR";
# Home manager using nixos-unstable
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Automatic themeing (using home-manager module)
stylix = {
url = "github:nix-community/stylix/";
inputs.nixpkgs.follows = "nixpkgs";
};
# Declarative flatpak management, documentation states overriding nixpkgs is not supported
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
# Easy Nix-based neovim config
nvf = {
url = "github:notashelf/nvf";
inputs.nixpkgs.follows = "nixpkgs";
};
# Disk partitioning
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# An-anime-game-launcher
aagl = {
url = "github:ezKEa/aagl-gtk-on-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# NixOS Secure Boot
lanzaboote = {
url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs";
};
# Useful flake for satusfactory server config in nix
satisfactory-server = {
url = "github:nekowinston/satisfactory-server-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
musnix.url = "github:musnix/musnix";
};
outputs =
{
self,
nixpkgs-stable,
nixpkgs,
nixpkgs-master,
nur,
home-manager,
...
}@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
overlays = [
overlay-stable
overlay-master
nur.overlays.default
];
};
genericModules = [
{
nix.registry.nixos.flake = inputs.self;
environment.etc."nix/inputs/nixpkgs".source = nixpkgs.outPath;
nix.nixPath = [ "nixpkgs=${nixpkgs.outPath}" ];
}
];
genericHomeModule = [
{
nix.registry.nixos.flake = inputs.self;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
# Overlay definitions
# nixpkgs-unstable
overlay-stable = final: prev: {
stable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
};
# nixpkgs-master
overlay-master = final: prev: {
master = import nixpkgs-master {
inherit system;
config.allowUnfree = true;
};
};
in
{
nixosConfigurations.gabbielaptop = nixpkgs.lib.nixosSystem {
inherit system;
inherit pkgs;
specialArgs = {
inherit inputs;
};
modules = genericModules ++ [
# Import nixos modules here
./hosts/gabbielaptop/configuration.nix
./modules/nh.nix
./modules/waydroid.nix
./modules/packages.nix
./modules/aagl.nix
inputs.aagl.nixosModules.default
inputs.lanzaboote.nixosModules.lanzaboote
inputs.musnix.nixosModules.musnix
{ nix.settings = inputs.aagl.nixConfig; } # Setup cachix for aagl projects
];
};
nixosConfigurations.biggerpi = nixpkgs.lib.nixosSystem {
inherit system;
inherit pkgs;
modules = genericModules ++ [
inputs.disko.nixosModules.disko
inputs.satisfactory-server.nixosModules.satisfactory
./hosts/biggerpi/configuration.nix
./modules/satisfactory-server.nix
];
};
# Standalone home-manager config
homeConfigurations.blue = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit inputs;
};
# Import home-manager modules here
modules = [
./home-manager/home.nix
inputs.nvf.homeManagerModules.default
inputs.stylix.homeModules.stylix
inputs.nix-flatpak.homeManagerModules.nix-flatpak
];
};
# set formatter, using nixfmt-tree here
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree;
};
}