os/flake.nix

74 lines
2.1 KiB
Nix
Raw Normal View History

2023-05-21 21:15:04 +02:00
{
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;
};
2023-06-15 20:29:20 +02:00
agenix.url = github:ryantm/agenix;
nixos-hardware.url = github:NixOS/nixos-hardware;
2023-05-21 21:15:04 +02:00
};
2023-06-19 15:15:59 +02:00
outputs = args@{ self, home-manager, nixpkgs, agenix, nixos-hardware, ... }: with nixpkgs; {
2023-05-21 21:15:04 +02:00
2023-05-23 10:04:47 +02:00
# Configurations for NixOS machines.
2023-06-19 15:15:59 +02:00
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;
2023-05-23 10:04:47 +02:00
};
2023-06-19 15:15:59 +02:00
}).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;
2023-05-21 21:15:04 +02:00
};
2023-06-19 15:15:59 +02:00
# Thinkpad
"lime" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/lime/core.nix
./shared/core
] ++ (userConfig "riley" self.homeConfigurations."lime");
specialArgs = args;
};
};
2023-05-21 21:15:04 +02:00
2023-06-19 15:28:11 +02:00
# Configurations for home-manager.
2023-06-19 15:15:59 +02:00
homeConfigurations = with home-manager.lib; let
2023-06-19 15:28:11 +02:00
forEachHost = lib.genAttrs [ "dev-lt-63" "strawberry" "lime" ];
2023-06-19 15:15:59 +02:00
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
};
2023-06-19 15:28:11 +02:00
in forEachHost (host: homeManagerConfiguration {
inherit pkgs;
modules = [
./system/${host}/home.nix
./shared/home
];
});
2023-05-21 21:15:04 +02:00
2023-05-23 10:04:47 +02:00
overlays = {
default = (import ./shared/overlay.nix);
2023-05-21 21:15:04 +02:00
};
};
}