diffu/flake.nix

201 lines
5.8 KiB
Nix
Raw Normal View History

2023-03-29 13:14:37 +00:00
{
inputs = {
# Pin nixpkgs to a specific commit
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
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";
};
2023-09-26 18:32:27 +00:00
nix-vscode-extensions = {
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-04-03 09:41:33 +00:00
nixos-cn = {
url = "github:nixos-cn/flakes";
2023-04-16 02:30:45 +00:00
inputs.nixpkgs.follows = "nixpkgs";
2023-12-15 13:24:46 +00:00
inputs.flake-utils.follows = "flake-utils";
2023-04-03 09:41:33 +00:00
};
2023-09-26 18:32:27 +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";
};
2023-04-03 09:41:33 +00:00
};
2023-04-16 05:18:23 +00:00
outputs = { self, ... }@inputs:
with inputs;
2023-04-16 02:30:45 +00:00
let
homeConfigurations = import ./home;
sharedModules = [
self.homeManagerModules
inputs.nix-index-database.hmModules.nix-index
];
mkHome = user: host: { config, system, ... }: {
imports = [
home-manager.nixosModules.home-manager
{
home-manager = {
inherit sharedModules;
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
};
home-manager.users.${user} = homeConfigurations.${user}.${host};
}
];
};
mkHomeConfiguration = user: settings: {
name = user;
value = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
self.homeManagerModules
] ++ sharedModules;
2024-01-07 13:41:01 +00:00
extraSpecialArgs = {
inherit inputs;
};
};
};
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
] ++ modules;
2023-04-16 02:30:45 +00:00
};
2023-10-06 14:03:47 +00:00
evalSecrets = import ./eval_secrets.nix;
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") ];
colmenaHive = colmena.lib.makeHive {
2023-10-06 14:03:47 +00:00
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
};
machinesFile = ./nixbuild.net;
2023-11-28 13:38:50 +00:00
specialArgs = {
inherit inputs;
};
2023-10-06 14:03:47 +00:00
};
massicot = { name, nodes, pkgs, ... }: with inputs; {
2023-12-17 06:55:53 +00:00
deployment.targetHost = "49.13.13.122";
deployment.targetUser = "xin";
2023-10-06 14:03:47 +00:00
imports = [
{ nixpkgs.system = "aarch64-linux"; }
2023-12-17 06:55:53 +00:00
self.nixosModules.default
2023-10-06 14:03:47 +00:00
machines/massicot
];
};
2023-11-28 13:38:50 +00:00
sgp-00 = { name, nodes, pkgs, ... }: with inputs; {
2023-11-28 13:38:50 +00:00
imports = [
2023-12-20 03:13:20 +00:00
self.nixosModules.default
machines/dolomite
2023-11-28 13:38:50 +00:00
];
nixpkgs.system = "x86_64-linux";
networking.hostName = "sgp-00";
system.stateVersion = "23.11";
2023-11-28 13:38:50 +00:00
deployment = {
targetHost = "video.namely.icu";
buildOnTarget = false;
tags = [ "proxy" ];
2023-11-28 13:38:50 +00:00
};
};
2023-12-06 14:54:22 +00:00
tok-00 = { name, nodes, pkgs, ... }: with inputs; {
2023-12-06 14:54:22 +00:00
imports = [
2023-12-20 03:13:20 +00:00
self.nixosModules.default
machines/dolomite
2023-12-06 14:54:22 +00:00
];
nixpkgs.system = "x86_64-linux";
networking.hostName = "tok-00";
system.stateVersion = "23.11";
2023-12-06 14:54:22 +00:00
deployment = {
targetHost = "video01.namely.icu";
buildOnTarget = false;
tags = [ "proxy" ];
2023-12-06 14:54:22 +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")
];
};
raspite = mkNixos {
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
machines/raspite/configuration.nix
(mkHome "xin" "raspite")
];
};
} // self.colmenaHive.nodes;
2023-04-16 05:18:23 +00:00
2023-04-23 03:06:57 +00:00
images.raspite = (mkNixos {
2023-04-16 05:18:23 +00:00
system = "aarch64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
nixos-hardware.nixosModules.raspberry-pi-4
2023-04-23 03:06:57 +00:00
machines/raspite/configuration.nix
2023-04-16 05:18:23 +00:00
{
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.hostPlatform.system = "aarch64-linux";
nixpkgs.buildPlatform.system = "x86_64-linux";
}
];
}).config.system.build.sdImage;
} // flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShells = {
default = pkgs.mkShell {
2024-01-07 17:03:42 +00:00
packages = with pkgs; [ git colmena sops nix-output-monitor ];
};
};
}
);
2023-03-29 13:14:37 +00:00
}