diffu/flake.nix

231 lines
6.3 KiB
Nix
Raw Normal View History

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-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";
};
2024-08-20 13:04:46 +00:00
my-nixvim = {
url = "git+https://git.xinyang.life/xin/nixvim";
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
2024-08-20 13:04:46 +00:00
, my-nixvim
, ... }@inputs:
2023-04-16 02:30:45 +00:00
let
2024-08-20 13:04:46 +00:00
nixvimOverlay = (final: prev: {
nixvim = self.packages.${prev.stdenv.system}.nixvim;
});
overlayModule = { ... }: {
nixpkgs.overlays = [
nixvimOverlay
(import ./overlays/add-pkgs.nix)
];
};
deploymentModule = {
deployment.targetUser = "xin";
};
sharedColmenaModules = [
self.nixosModules.default
deploymentModule
];
sharedHmModules = [
inputs.sops-nix.homeManagerModules.sops
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
] ++ modules;
2023-04-16 02:30:45 +00:00
};
in
{
2024-07-30 02:59:12 +00:00
nixpkgs = nixpkgs;
2024-08-20 13:04:46 +00:00
nixosModules.default = { imports = [ ./modules/nixos overlayModule ]; };
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-08-20 13:04:46 +00:00
colmenaHive = 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
};
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;
};
weilite = { ... }: {
imports = [
machines/weilite
] ++ sharedColmenaModules;
deployment = {
targetHost = "weilite.coho-tet.ts.net";
2024-07-30 02:59:12 +00:00
targetPort = 22;
buildOnTarget = false;
};
nixpkgs.system = "x86_64-linux";
};
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; [ nix git colmena sops nix-output-monitor nil nvd ];
};
};
2024-08-20 13:04:46 +00:00
packages = {
nixvim = my-nixvim.packages.${system}.default;
};
}
);
2023-03-29 13:14:37 +00:00
}