os/flake.nix

73 lines
2.1 KiB
Nix

{
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
home-manager.url = github:nix-community/home-manager;
pwnix = {
inputs.nixpkgs.follows = "nixpkgs";
url = git+https://im.badat.dev/bad/pwnix.git;
};
agenix.url = github:ryantm/agenix;
nixos-hardware.url = github:NixOS/nixos-hardware;
};
outputs = args@{ self, home-manager, nixpkgs, agenix, nixos-hardware, ... }: with nixpkgs; {
# Configurations for NixOS machines.
nixosConfigurations = let
# Generate a user configuration for the given user, based on the given home manager
# configuration.
userConfig = user: home: [
home-manager.nixosModules.home-manager
({ config, ... }: {
home-manager.users."${user}" = (home // {
config.home = {
inherit (config.system) stateVersion;
username = user;
};
}).config;
})
];
in {
# Desktop system
"strawberry" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/strawberry/core.nix
./shared/core
] ++ (userConfig "riley" self.homeConfigurations."strawberry");
specialArgs = args;
};
# Thinkpad
"lime" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/lime/core.nix
./shared/core
] ++ (userConfig "riley" self.homeConfigurations."lime");
specialArgs = args;
};
};
# Configurations for home-manager.
homeConfigurations = with home-manager.lib; let
forEachHost = lib.genAttrs [ "dev-lt-63" "strawberry" "lime" ];
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
};
in forEachHost (host: homeManagerConfiguration {
inherit pkgs;
modules = [
./system/${host}/home.nix
./shared/home
];
});
overlays = {
default = (import ./shared/overlay.nix);
};
};
}