Files
nix/flake.nix
2025-08-18 12:03:21 +08:00

97 lines
3.1 KiB
Nix

{
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, home-manager-unstable, ... }@inputs:
let
inherit (self) outputs;
inherit (nixpkgs) lib;
username = "alex";
useremail = "reizero@live.com";
sourcepath = "/home/${username}/.nix";
libs = import ./libs;
nixos = {
stable = {
nixpkgs = nixpkgs;
home-manager = home-manager;
version = "25.05";
};
unstable = {
nixpkgs = nixpkgs-unstable;
home-manager = home-manager-unstable;
version = "25.11";
};
};
in
rec {
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; };
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
# The default.nix file in each profile directory is responsible for creating its own nixosSystem.
nixosConfigurations =
with builtins; listToAttrs (map
(profile: {
name = profile;
value = import ./profiles/${profile} {
inherit self inputs outputs libs nixos profile sourcepath username useremail;
hostname = profile;
};
})
(attrNames (readDir ./profiles))
);
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
# Or run 'nix build .#homeConfigurations.<username>.activationPackage' in none-nixos distro first
homeConfigurations = {
"${username}" = home-manager-unstable.lib.homeManagerConfiguration {
pkgs = nixpkgs-unstable.packages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {
inherit inputs outputs username useremail;
hyprland = inputs.hyprland;
version = "${nixos.unstable.version}";
};
modules = [
# > Our main home-manager configuration file <
./home/desktop.nix
# Ony non-nixos use home-manager standalone, use this config fixing issues.
{
targets.genericLinux.enable = true;
}
];
};
};
};
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# The Nix User Repository
# nur.url = github:nix-community/NUR;
# Home manager
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-unstable = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# Impermanence system
impermanence.url = "github:nix-community/impermanence";
# TODO: Add any other flake you might need
# hardware.url = "github:nixos/nixos-hardware";
# Shameless plug: looking for a way to nixify your themes and make
# everything match nicely? Try nix-colors!
# nix-colors.url = "github:misterio77/nix-colors";
};
}