1
0
Fork 0
dotfiles/nix/flake.nix
2026-02-12 09:02:09 +01:00

78 lines
2.3 KiB
Nix

{
description = "NixOS flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix-snapd.url = "github:nix-community/nix-snapd";
nix-snapd.inputs.nixpkgs.follows = "nixpkgs";
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
autofirma-nix = {
url = "github:nix-community/autofirma-nix/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
outputs = { self, nixpkgs, unstable, nix-snapd, home-manager, autofirma-nix, ... }:
let
system = "x86_64-linux";
lib = nixpkgs.lib;
pkgs-unstable = unstable.legacyPackages.${system};
pkgs = nixpkgs.legacyPackages.${system};
mkNixos = host: modules: lib.nixosSystem {
inherit system;
specialArgs = { inherit pkgs-unstable; };
modules = [
./hosts/${host}/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.catalin = import ./home;
home-manager.extraSpecialArgs = { inherit pkgs-unstable; };
}
] ++ modules;
};
# Helper for Home Manager configurations (non-NixOS)
mkHome = host: user: modules: home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home
{
home.username = user;
home.homeDirectory = "/home/${user}";
}
] ++ modules;
extraSpecialArgs = { inherit pkgs-unstable; };
};
in
{
nixosConfigurations = {
limgrave = mkNixos "limgrave" [
nix-snapd.nixosModules.default
autofirma-nix.nixosModules.default
];
};
# Home Manager configurations for non-NixOS hosts (e.g., Ubuntu)
homeConfigurations = {
# For non-NixOS usage. Run: home-manager switch --flake ./nix#catalin@ubuntu
"catalin@limgrave" = mkHome "limgrave" "catalin" [ ];
};
};
}