os/flake.nix

90 lines
2.7 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?rev=7c67f006ea0e7d0265f16d7df07cc076fdffd91f";
nixpkgs-latest.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;
oxalica.url = github:oxalica/rust-overlay;
};
outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, oxalica, ... }: with nixpkgs; rec {
# Configurations for NixOS machines.
nixosConfigurations =
let mkUserConfig = path: { config, ... }: {
imports = [ home-manager.nixosModules.home-manager ];
config = {
home-manager.users."riley" = (import "${path}/home.nix");
home-manager.extraSpecialArgs = args // { age = config.age; };
home-manager.useGlobalPkgs = true;
};
};
in {
# Desktop system
"strawberry" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
(mkUserConfig ./system/strawberry)
agenix.nixosModules.default
./system/strawberry/core.nix
./shared/core
./shared/secrets.nix
];
specialArgs = args;
};
# Thinkpad
"lime" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
(mkUserConfig ./system/lime)
agenix.nixosModules.default
./system/lime/core.nix
./shared/core
./shared/secrets.nix
];
specialArgs = args;
};
# Raspberry Pi hosting my website
"cherry" = lib.nixosSystem {
system = "aarch64-linux";
modules = [
./system/cherry/core.nix
];
};
};
# Configurations for non-NixOS machines.
homeConfigurations = with home-manager.lib; {
"dev-lt-63" = homeManagerConfiguration {
extraSpecialArgs = args // { age = args.config.age; };
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
./system/dev-lt-63/home.nix
./shared/home
];
};
};
overlays = {
default = (import ./shared/overlay.nix);
};
devShells."x86_64-linux"."utils" = let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in pkgs.mkShell {
buildInputs = import ./shared/env.nix pkgs;
};
};
}