132 lines
4 KiB
Nix
132 lines
4 KiB
Nix
{
|
|
description = "Project-A flake!";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixos-25.11";
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
secret.url = "git+ssh://forgejo@git.project-a.space/Project-A/project-secret.git";
|
|
|
|
deploy-rs = {
|
|
url = "github:serokell/deploy-rs";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
project-a-software = {
|
|
url = "git+ssh://forgejo@git.project-a.space/Project-A/project-software.git";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.nixpkgs-unstable.follows = "nixpkgs-unstable";
|
|
};
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager/release-25.11";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
nixpkgs-unstable,
|
|
project-a-software,
|
|
deploy-rs,
|
|
home-manager,
|
|
secret,
|
|
...
|
|
}: let
|
|
linux64 = "x86_64-linux";
|
|
nixosServer = { name, system ? linux64, modules ? [] }:
|
|
nixpkgs.lib.nixosSystem {
|
|
system = system;
|
|
specialArgs = {
|
|
pkgs-unstable = import nixpkgs-unstable { system = linux64; config.allowUnfree = true; };
|
|
pkgs-projecta = project-a-software.packages.${system};
|
|
secret = secret.${name};
|
|
common-secret = secret.common;
|
|
};
|
|
modules = [
|
|
./servers/common/main.nix
|
|
./servers/${name}/main.nix
|
|
] ++ modules;
|
|
};
|
|
in {
|
|
nixosConfigurations = {
|
|
artemisia = nixosServer { name = "artemisia"; modules = [ project-a-software.nixosModules.marzban ]; };
|
|
reine = nixosServer { name = "reine"; modules = [ project-a-software.nixosModules.affine ]; };
|
|
ivan = nixosServer { name = "ivan"; modules = [ project-a-software.nixosModules.marzban ]; };
|
|
wise = nixosServer { name = "wise"; modules = [ project-a-software.nixosModules.marzban ]; };
|
|
mio = nixosServer { name = "mio"; modules = [ project-a-software.nixosModules.marzban ]; };
|
|
kristine = nixosServer { name = "kristine"; modules = [ project-a-software.nixosModules.marzban ]; };
|
|
|
|
aqore-nix = nixpkgs.lib.nixosSystem {
|
|
system = linux64;
|
|
specialArgs = {
|
|
pkgs-unstable = import nixpkgs-unstable { system = linux64; config.allowUnfree = true; };
|
|
};
|
|
modules = [
|
|
./desktops/aqore-nix/main.nix
|
|
home-manager.nixosModules.home-manager {
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
home-manager.users.in5ar = ./desktops/users/in5ar/home.nix;
|
|
}
|
|
({ ... }: {
|
|
environment.systemPackages = [
|
|
deploy-rs.packages."${linux64}".deploy-rs
|
|
];
|
|
})
|
|
];
|
|
};
|
|
};
|
|
|
|
deploy.nodes = let serverNode = name: {
|
|
hostname = "${name}.project-a.space";
|
|
profiles.system = {
|
|
user = "root";
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${name};
|
|
};
|
|
sshUser = "in5ar";
|
|
sshOpts = [ "-p" "1004" ];
|
|
};
|
|
in {
|
|
artemisia = serverNode "artemisia";
|
|
reine = {
|
|
hostname = "192.168.0.3";
|
|
profiles.system = {
|
|
user = "root";
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.reine;
|
|
};
|
|
sshUser = "in5ar";
|
|
sshOpts = [ "-p" "1004" ];
|
|
};
|
|
ivan = serverNode "ivan";
|
|
wise = {
|
|
hostname = "${"wise"}.project-a.space";
|
|
profiles.system = {
|
|
user = "root";
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${"wise"};
|
|
};
|
|
sshUser = "root";
|
|
};
|
|
mio = serverNode "mio";
|
|
kristine = serverNode "kristine";
|
|
};
|
|
|
|
devShells = nixpkgs.lib.genAttrs [ "x86_64-linux" ] (system: {
|
|
default = let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
prompt = ''function fish_prompt; set_color red; echo -n "Project-A/debug> "; set_color normal; end'';
|
|
inspect = ''function inspect; nix repl .; end;'';
|
|
inspect-nixpkgs = ''function inspect-nixpkgs; nix repl nixpkgs; end;'';
|
|
included-functions = "${inspect} ${inspect-nixpkgs}";
|
|
in pkgs.mkShell {
|
|
buildInputs = [];
|
|
shellHook = ''
|
|
printf "Welcome to the \033[1;31mProject-A\033[0m dev shell!\n"
|
|
|
|
if [ -z "$FISH_VERSION" ] && [ -x "${pkgs.fish}/bin/fish" ]; then
|
|
exec ${pkgs.fish}/bin/fish --init-command '${prompt}; ${included-functions}'
|
|
fi
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|