nixos-config/flake.nix

154 lines
3.8 KiB
Nix

# flake.nix
{
inputs = {
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-flatpak.url = "github:gmodena/nix-flatpak"; # unstable branch
stylix = {
url = "github:donovanglover/stylix";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
yazi = {
url = "github:sxyazi/yazi";
inputs.nixpkgs.follows = "nixpkgs";
};
shikane = {
url = "git+https://gitlab.com/w0lff/shikane";
inputs.nixpkgs.follows = "nixpkgs";
};
emacs-overlay.url = "github:nix-community/emacs-overlay";
kmonad = {
url = "github:kmonad/kmonad?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprlock = {
url = "github:hyprwm/hyprlock";
inputs.nixpkgs.follows = "nixpkgs";
};
hypridle = {
url = "github:hyprwm/hypridle";
inputs.nixpkgs.follows = "nixpkgs";
};
musnix = {
url = "github:musnix/musnix";
inputs.nixpkgs.follows = "nixpkgs";
};
wezterm = {
url = "github:wez/wezterm?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
affinity-nix = {
url = "github:mrshmllow/affinity-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
isd = {
url = "github:isd-project/isd";
inputs.nixpkgs.follows = "nixpkgs";
};
paperwm = {
url = "github:paperwm/PaperWM";
inputs.nixpkgs.follows = "nixpkgs";
};
niri = {
url = "github:YaLTeR/niri";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {nixpkgs, home-manager, self, ... } @ inputs:
let
inherit (nixpkgs.lib) genAttrs replaceStrings;
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
forAllSystems =
function:
genAttrs [
"x86_64-linux"
] (system: function nixpkgs.legacyPackages.${system});
nameOf = path: replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString path));
in
{
packages = forAllSystems (
pkgs:
packagesFromDirectoryRecursive {
inherit (pkgs) callPackage;
directory = ./packages;
}
);
nixosModules = genAttrs (map nameOf (listFilesRecursive ./modules/system)) (
name: import ./modules/system/${name}.nix
);
homeModules = genAttrs (map nameOf (listFilesRecursive ./modules/home)) (
name: import ./modules/home/${name}.nix);
overlays = genAttrs (map nameOf (listFilesRecursive ./overlays)) (
name: import ./overlays/${name}.nix
);
nixosConfigurations = {
eddie = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
nix-config = self;
};
modules = [
inputs.kmonad.nixosModules.default
inputs.musnix.nixosModules.musnix
./hosts/eddie/configuration.nix
];
};
};
homeConfigurations = {
"emenel" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {
inherit inputs;
nix-config = self;
};
modules = [
inputs.nix-flatpak.homeManagerModules.nix-flatpak
inputs.stylix.homeManagerModules.stylix
inputs.sops-nix.homeManagerModules.sops
./homes/emenel/default.nix
];
};
};
};
}