nixos-config/flake.nix

203 lines
5.5 KiB
Nix
Raw Normal View History

2023-03-29 13:14:37 +00:00
{
inputs = {
# Pin nixpkgs to a specific commit
2024-07-09 13:17:10 +00:00
nixpkgs.url = "github:nixos/nixpkgs/9b10b8f00cb5494795e5f51b39210fed4d2b0748";
2023-05-27 01:39:16 +00:00
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
2023-03-29 13:14:37 +00:00
2023-04-16 02:30:45 +00:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-01-13 02:47:37 +00:00
nix-vscode-extensions = {
2023-09-26 18:32:27 +00:00
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
2023-12-15 13:24:46 +00:00
inputs.flake-utils.follows = "flake-utils";
2023-09-26 18:32:27 +00:00
};
2023-04-16 05:18:23 +00:00
2023-09-11 12:20:32 +00:00
nur = {
url = "github:nix-community/NUR";
};
2023-03-29 13:14:37 +00:00
2023-09-11 12:20:32 +00:00
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
};
2023-04-16 02:30:45 +00:00
2023-09-11 12:20:32 +00:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-09-11 12:20:32 +00:00
flake-utils = {
url = "github:numtide/flake-utils";
};
colmena = {
url = "github:zhaofengli/colmena";
inputs.stable.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
2023-12-15 13:24:46 +00:00
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin.url = "github:catppuccin/nix";
2023-04-03 09:41:33 +00:00
};
outputs =
{ self
, home-manager
, nixpkgs
, nixos-hardware
, flake-utils
, nur
, catppuccin
, ... }@inputs:
2023-04-16 02:30:45 +00:00
let
sharedHmModules = [
inputs.nix-index-database.hmModules.nix-index
catppuccin.homeManagerModules.catppuccin
self.homeManagerModules
];
mkHome = user: host: { ... }: {
imports = [
home-manager.nixosModules.home-manager
{
home-manager = {
sharedModules = sharedHmModules;
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
};
home-manager.users.${user} = (import ./home).${user}.${host};
}
];
};
mkHomeConfiguration = user: host: {
name = user;
value = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
(import ./home).${user}.${host}
] ++ sharedHmModules;
2024-01-07 13:41:01 +00:00
extraSpecialArgs = {
inherit inputs;
};
};
};
2024-01-13 02:47:37 +00:00
mkNixos = { system, modules, specialArgs ? { } }: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = specialArgs // { inherit inputs system; };
modules = [
2023-12-01 17:33:20 +00:00
self.nixosModules.default
nur.nixosModules.nur
./overlays
] ++ modules;
2023-04-16 02:30:45 +00:00
};
in
{
2023-12-01 17:33:20 +00:00
nixosModules.default = import ./modules/nixos;
2023-04-16 02:30:45 +00:00
homeManagerModules = import ./modules/home-manager;
2024-01-07 13:41:01 +00:00
homeConfigurations = builtins.listToAttrs [ (mkHomeConfiguration "xin" "calcite") ];
2024-01-13 02:47:37 +00:00
colmenaHive =
let
deploymentModule = {
deployment.targetUser = "xin";
};
sharedColmenaModules = [
2024-01-13 02:47:37 +00:00
self.nixosModules.default
deploymentModule
];
in
inputs.colmena.lib.makeHive {
2023-10-06 14:03:47 +00:00
meta = {
2024-01-13 02:47:37 +00:00
nixpkgs = import nixpkgs {
system = "x86_64-linux";
};
machinesFile = ./nixbuild.net;
specialArgs = {
inherit inputs;
};
2023-10-06 14:03:47 +00:00
};
massicot = { ... }: {
2024-01-13 02:47:37 +00:00
deployment.targetHost = "49.13.13.122";
deployment.buildOnTarget = true;
2024-01-13 02:47:37 +00:00
imports = [
{ nixpkgs.system = "aarch64-linux"; }
machines/massicot
] ++ sharedColmenaModules;
2023-10-06 14:03:47 +00:00
};
2023-11-28 13:38:50 +00:00
tok-00 = { ... }: {
2024-01-13 02:47:37 +00:00
imports = [
machines/dolomite
] ++ sharedColmenaModules;
2024-01-13 02:47:37 +00:00
nixpkgs.system = "x86_64-linux";
networking.hostName = "tok-00";
2024-01-13 02:47:37 +00:00
system.stateVersion = "23.11";
deployment = {
targetHost = "video01.namely.icu";
2024-01-13 02:47:37 +00:00
buildOnTarget = false;
tags = [ "proxy" ];
};
2023-11-28 13:38:50 +00:00
};
2023-12-06 14:54:22 +00:00
la-00 = { ... }: {
2024-01-13 02:47:37 +00:00
imports = [
machines/dolomite
] ++ sharedColmenaModules;
2024-01-13 02:47:37 +00:00
nixpkgs.system = "x86_64-linux";
networking.hostName = "la-00";
system.stateVersion = "21.05";
2024-01-13 02:47:37 +00:00
deployment = {
targetHost = "la-00.video.namely.icu";
2024-01-13 02:47:37 +00:00
buildOnTarget = false;
tags = [ "proxy" ];
};
2023-12-06 14:54:22 +00:00
};
raspite = { ... }: {
deployment = {
targetHost = "raspite.local";
buildOnTarget = false;
};
nixpkgs.system = "aarch64-linux";
imports = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
nixos-hardware.nixosModules.raspberry-pi-4
machines/raspite/configuration.nix
] ++ sharedColmenaModules;
};
2024-01-13 02:47:37 +00:00
};
2023-10-06 14:03:47 +00:00
nixosConfigurations = {
calcite = mkNixos {
system = "x86_64-linux";
modules = [
nixos-hardware.nixosModules.asus-zephyrus-ga401
machines/calcite/configuration.nix
(mkHome "xin" "calcite")
];
};
} // self.colmenaHive.nodes;
2023-04-16 05:18:23 +00:00
2024-01-13 02:47:37 +00:00
} // flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [ git colmena sops nix-output-monitor nil nvd ];
};
};
}
);
2023-03-29 13:14:37 +00:00
}