config/flake.nix

72 lines
1.7 KiB
Nix
Raw Normal View History

2023-03-29 17:50:55 +03:00
{
2023-03-30 16:33:03 +03:00
description = "motiejus/config";
2023-03-29 17:50:55 +03:00
inputs = {
2023-04-03 16:50:52 +03:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11-small";
2023-04-05 14:46:57 +03:00
flake-utils.url = "github:numtide/flake-utils";
2023-04-05 22:48:04 +03:00
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
2023-03-30 16:33:03 +03:00
2023-04-03 16:50:52 +03:00
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.inputs.utils.follows = "flake-utils";
2023-04-05 14:46:57 +03:00
};
2023-04-05 09:15:02 +03:00
2023-04-05 14:46:57 +03:00
nixConfig = {
trusted-substituters = "https://cache.nixos.org/";
trusted-public-keys = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
2023-03-29 17:50:55 +03:00
};
2023-04-03 16:50:52 +03:00
outputs = {
self,
nixpkgs,
2023-04-05 22:48:04 +03:00
sops-nix,
2023-04-03 16:50:52 +03:00
deploy-rs,
flake-utils,
2023-04-05 23:19:56 +03:00
} @ inputs: let
2023-04-05 09:15:02 +03:00
myData = import ./data.nix;
in
2023-04-03 16:50:52 +03:00
{
nixosConfigurations.hel1-a = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
2023-03-29 17:50:55 +03:00
./configuration.nix
2023-03-30 16:33:03 +03:00
./hardware-configuration.nix
./zfs.nix
2023-04-03 16:50:52 +03:00
];
2023-04-05 23:19:56 +03:00
specialArgs = inputs;
2023-04-03 16:50:52 +03:00
};
2023-03-30 16:33:03 +03:00
2023-04-03 17:17:40 +03:00
deploy.nodes.hel1-a = {
2023-04-03 16:50:52 +03:00
hostname = "hel1-a.servers.jakst";
profiles = {
system = {
sshUser = "motiejus";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.hel1-a;
user = "root";
};
2023-03-30 16:33:03 +03:00
};
2023-03-29 17:50:55 +03:00
};
2023-03-30 16:33:03 +03:00
2023-04-03 16:50:52 +03:00
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
}
// flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
in {
devShells.default = with pkgs;
mkShell {
2023-04-05 14:46:57 +03:00
packages = [
2023-04-05 22:48:04 +03:00
pkgs.age
pkgs.ssh-to-age
2023-04-05 23:19:56 +03:00
pkgs.sops
2023-04-05 22:48:04 +03:00
deploy-rs.packages.${system}.deploy-rs
2023-04-05 14:46:57 +03:00
];
2023-04-03 16:50:52 +03:00
};
formatter = pkgs.alejandra;
2023-04-03 16:43:34 +03:00
});
2023-03-29 17:50:55 +03:00
}