os/flake.nix

91 lines
2.5 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 non-NixOS machines.
homeConfigurations = with home-manager.lib; let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
};
in {
# riley @ dev-lt-63
"dev-lt-63" = homeManagerConfiguration {
inherit pkgs;
modules = [
./system/dev-lt-63/home.nix
./shared/home
];
};
# riley @ strawberry
"strawberry" = homeManagerConfiguration {
inherit pkgs;
modules = [
./system/strawberry/home.nix
./shared/home
];
};
# riley @ lime
"lime" = homeManagerConfiguration {
inherit pkgs;
modules = [
./system/lime/home.nix
./shared/home
];
};
};
overlays = {
default = (import ./shared/overlay.nix);
};
};
}