nixos/flake.nix

65 lines
1.7 KiB
Nix

{
description = "My homebrew NixOS configurations";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = github:nix-community/nixvim;
inputs.nixpkgs.follows = "nixpkgs";
};
nethack = {
url = git+https://git.psf.lt/xezo360hye/nethack?shallow=1;
#url = git+ssh://git@git.psf.lt/xezo360hye/nethack?shallow=1;
#url = path:/home/andrey/nethack;
};
# nixpkgs-2405.url = github:nixos/nixpkgs/nixos-24.05;
# hm-2405.url = github:nix-community/home-manager/release-24.05;
};
outputs = { self, nixpkgs, home-manager, nixvim, nethack, ... } @ inputs:
let
inherit (self) outputs;
username = "andrey";
hostnames = [ "tokishiko" "maidena" ];
mkSystem = hostname: {
"${hostname}" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [
./system/common.nix
./system/${hostname}.nix
./hardware/${hostname}.nix
];
};
};
mkHome = hostname: {
"${username}@${hostname}" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = inputs;
modules = [
nixvim.homeManagerModules.nixvim
nethack.homeManagerModules.nethack
./home/${hostname}.nix
./home/common.nix
];
};
};
merge = fn: nixpkgs.lib.fold nixpkgs.lib.mergeAttrs {} (map fn hostnames);
in {
nixosConfigurations = merge mkSystem;
homeConfigurations = merge mkHome;
};
}