2023-03-29 13:14:37 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
# Pin nixpkgs to a specific commit
|
2024-07-17 03:45:15 +00:00
|
|
|
nixpkgs.url = "github:xinyangli/nixpkgs/deploy";
|
2024-07-14 06:04:52 +00:00
|
|
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.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-04-22 17:42:40 +00:00
|
|
|
|
2023-09-11 12:20:32 +00:00
|
|
|
flake-utils = {
|
|
|
|
url = "github:numtide/flake-utils";
|
|
|
|
};
|
2023-07-21 07:03:59 +00:00
|
|
|
|
2023-12-19 13:32:40 +00:00
|
|
|
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";
|
|
|
|
};
|
2024-06-11 10:02:55 +00:00
|
|
|
|
|
|
|
catppuccin.url = "github:catppuccin/nix";
|
2023-04-03 09:41:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-06-11 10:02:55 +00:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, home-manager
|
|
|
|
, nixpkgs
|
|
|
|
, nixos-hardware
|
|
|
|
, flake-utils
|
|
|
|
, nur
|
|
|
|
, catppuccin
|
|
|
|
, ... }@inputs:
|
2023-04-16 02:30:45 +00:00
|
|
|
let
|
2024-06-11 10:02:55 +00:00
|
|
|
sharedHmModules = [
|
2023-12-24 10:53:47 +00:00
|
|
|
inputs.nix-index-database.hmModules.nix-index
|
2024-06-11 10:02:55 +00:00
|
|
|
catppuccin.homeManagerModules.catppuccin
|
|
|
|
self.homeManagerModules
|
2023-12-24 10:53:47 +00:00
|
|
|
];
|
2024-06-11 10:02:55 +00:00
|
|
|
mkHome = user: host: { ... }: {
|
2023-04-22 17:42:40 +00:00
|
|
|
imports = [
|
2023-12-24 10:53:47 +00:00
|
|
|
home-manager.nixosModules.home-manager
|
2023-04-22 17:42:40 +00:00
|
|
|
{
|
2023-12-24 10:53:47 +00:00
|
|
|
home-manager = {
|
2024-06-11 10:02:55 +00:00
|
|
|
sharedModules = sharedHmModules;
|
2023-12-24 10:53:47 +00:00
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
extraSpecialArgs = { inherit inputs; };
|
|
|
|
};
|
2024-06-11 10:02:55 +00:00
|
|
|
home-manager.users.${user} = (import ./home).${user}.${host};
|
2023-04-22 17:42:40 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-06-11 10:02:55 +00:00
|
|
|
mkHomeConfiguration = user: host: {
|
2023-12-24 10:53:47 +00:00
|
|
|
name = user;
|
|
|
|
value = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
|
|
modules = [
|
2024-06-11 10:02:55 +00:00
|
|
|
(import ./home).${user}.${host}
|
|
|
|
] ++ sharedHmModules;
|
2024-01-07 13:41:01 +00:00
|
|
|
extraSpecialArgs = {
|
2023-12-24 10:53:47 +00:00
|
|
|
inherit inputs;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-01-13 02:47:37 +00:00
|
|
|
mkNixos = { system, modules, specialArgs ? { } }: nixpkgs.lib.nixosSystem {
|
2023-04-22 17:42:40 +00:00
|
|
|
inherit system;
|
|
|
|
specialArgs = specialArgs // { inherit inputs system; };
|
|
|
|
modules = [
|
2023-12-01 17:33:20 +00:00
|
|
|
self.nixosModules.default
|
2023-04-22 17:42:40 +00:00
|
|
|
nur.nixosModules.nur
|
2024-06-11 10:02:55 +00:00
|
|
|
./overlays
|
2023-04-22 17:42:40 +00:00
|
|
|
] ++ 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") ];
|
2023-12-24 10:53:47 +00:00
|
|
|
|
2024-01-13 02:47:37 +00:00
|
|
|
colmenaHive =
|
|
|
|
let
|
|
|
|
deploymentModule = {
|
|
|
|
deployment.targetUser = "xin";
|
|
|
|
};
|
2024-06-11 10:02:55 +00:00
|
|
|
sharedColmenaModules = [
|
2024-01-13 02:47:37 +00:00
|
|
|
self.nixosModules.default
|
|
|
|
deploymentModule
|
|
|
|
];
|
|
|
|
in
|
2024-06-11 10:02:55 +00:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
};
|
2023-10-06 14:03:47 +00:00
|
|
|
};
|
|
|
|
|
2024-06-11 10:02:55 +00:00
|
|
|
massicot = { ... }: {
|
2024-01-13 02:47:37 +00:00
|
|
|
deployment.targetHost = "49.13.13.122";
|
|
|
|
deployment.buildOnTarget = true;
|
2023-10-03 03:52:54 +00:00
|
|
|
|
2024-01-13 02:47:37 +00:00
|
|
|
imports = [
|
|
|
|
{ nixpkgs.system = "aarch64-linux"; }
|
|
|
|
machines/massicot
|
2024-06-11 10:02:55 +00:00
|
|
|
] ++ sharedColmenaModules;
|
2023-10-06 14:03:47 +00:00
|
|
|
};
|
2023-11-28 13:38:50 +00:00
|
|
|
|
2024-06-11 10:02:55 +00:00
|
|
|
tok-00 = { ... }: {
|
2024-01-13 02:47:37 +00:00
|
|
|
imports = [
|
|
|
|
machines/dolomite
|
2024-06-11 10:02:55 +00:00
|
|
|
] ++ sharedColmenaModules;
|
2024-01-13 02:47:37 +00:00
|
|
|
nixpkgs.system = "x86_64-linux";
|
2024-06-11 10:02:55 +00:00
|
|
|
networking.hostName = "tok-00";
|
2024-01-13 02:47:37 +00:00
|
|
|
system.stateVersion = "23.11";
|
|
|
|
deployment = {
|
2024-06-11 10:02:55 +00:00
|
|
|
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
|
|
|
|
2024-06-11 10:02:55 +00:00
|
|
|
la-00 = { ... }: {
|
2024-01-13 02:47:37 +00:00
|
|
|
imports = [
|
|
|
|
machines/dolomite
|
2024-06-11 10:02:55 +00:00
|
|
|
] ++ sharedColmenaModules;
|
2024-01-13 02:47:37 +00:00
|
|
|
nixpkgs.system = "x86_64-linux";
|
2024-06-11 10:02:55 +00:00
|
|
|
networking.hostName = "la-00";
|
|
|
|
system.stateVersion = "21.05";
|
2024-01-13 02:47:37 +00:00
|
|
|
deployment = {
|
2024-06-11 10:02:55 +00:00
|
|
|
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
|
|
|
};
|
2024-06-11 10:02:55 +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
|
|
|
|
2023-12-19 13:32:40 +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:
|
2023-12-24 10:53:47 +00:00
|
|
|
let pkgs = nixpkgs.legacyPackages.${system}; in
|
|
|
|
{
|
|
|
|
devShells = {
|
|
|
|
default = pkgs.mkShell {
|
2024-07-18 03:44:09 +00:00
|
|
|
packages = with pkgs; [ nix git colmena sops nix-output-monitor nil nvd ];
|
2023-12-24 10:53:47 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2023-03-29 13:14:37 +00:00
|
|
|
}
|