config/flake.nix

361 lines
11 KiB
Nix
Raw Normal View History

2023-03-29 14:50:55 +00:00
{
2023-03-30 13:33:03 +00:00
description = "motiejus/config";
2023-03-29 14:50:55 +00:00
inputs = {
2024-05-30 13:28:47 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
2024-07-07 17:22:27 +00:00
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
2023-04-05 11:46:57 +00:00
flake-utils.url = "github:numtide/flake-utils";
2023-10-01 19:45:00 +00:00
flake-compat.url = "github:nix-community/flake-compat";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
2023-10-01 21:05:57 +00:00
nur.url = "github:nix-community/NUR";
2023-04-05 11:46:57 +00:00
2024-05-30 13:28:47 +00:00
home-manager.url = "github:nix-community/home-manager/release-24.05";
2023-08-18 10:47:27 +00:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2023-05-30 07:03:21 +00:00
2023-11-27 16:17:27 +00:00
agenix = {
url = "github:ryantm/agenix";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
darwin.follows = "";
};
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
utils.follows = "flake-utils";
};
};
2023-09-15 11:39:04 +00:00
2023-12-14 08:10:00 +00:00
nixgl = {
url = "github:guibou/nixGL";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
2023-09-21 03:06:10 +00:00
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
2023-10-01 21:05:57 +00:00
gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
2023-11-27 16:17:27 +00:00
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
gitignore.follows = "gitignore";
};
};
2023-04-05 11:46:57 +00:00
};
2023-04-05 06:15:02 +00:00
2023-04-05 11:46:57 +00:00
nixConfig = {
trusted-substituters = "https://cache.nixos.org/";
trusted-public-keys = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
2023-11-30 14:44:11 +00:00
extra-experimental-features = "nix-command flakes";
2023-03-29 14:50:55 +00:00
};
2024-07-29 12:39:54 +00:00
outputs =
{
self,
nixpkgs,
nixpkgs-unstable,
agenix,
deploy-rs,
flake-utils,
home-manager,
nixos-hardware,
nix-index-database,
pre-commit-hooks,
nur,
nixgl,
...
}@inputs:
let
myData = import ./data.nix;
overlays = [
nur.overlay
nixgl.overlay
(_self: super: { deploy-rs-pkg = super.deploy-rs; })
deploy-rs.overlay
(_self: super: {
deploy-rs = {
deploy-rs = super.deploy-rs-pkg;
inherit (super.deploy-rs) lib;
};
deploy-rs-pkg = null;
})
(_: super: {
compressDrv = super.callPackage ./pkgs/compress-drv { };
compressDrvWeb = super.callPackage ./pkgs/compress-drv/web.nix { };
tmuxbash = super.callPackage ./pkgs/tmuxbash.nix { };
nicer = super.callPackage ./pkgs/nicer.nix { };
pkgs-unstable = import nixpkgs-unstable { inherit (super) system; };
})
];
mkVM =
system:
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{ nixpkgs.overlays = overlays; }
./hosts/vm/configuration.nix
./modules
./modules/profiles/desktop
home-manager.nixosModules.home-manager
];
specialArgs = {
inherit myData;
} // inputs;
2024-07-07 17:22:27 +00:00
};
2024-07-29 12:39:54 +00:00
in
2023-04-03 13:50:52 +00:00
{
2023-11-27 16:17:27 +00:00
nixosConfigurations = {
vm-x86_64 = mkVM "x86_64-linux";
vm-aarch64 = mkVM "aarch64-linux";
2024-02-04 14:18:47 +00:00
2024-03-12 19:26:31 +00:00
mtworx = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
2024-07-29 12:39:54 +00:00
{ nixpkgs.overlays = overlays; }
2024-03-12 19:26:31 +00:00
./hosts/mtworx/configuration.nix
home-manager.nixosModules.home-manager
nixos-hardware.nixosModules.lenovo-thinkpad-x1-11th-gen
2024-03-13 12:12:44 +00:00
nix-index-database.nixosModules.nix-index
2024-03-12 19:26:31 +00:00
2024-03-18 15:46:17 +00:00
agenix.nixosModules.default
{
age.secrets = {
motiejus-work-passwd-hash.file = ./secrets/motiejus_work_passwd_hash.age;
root-work-passwd-hash.file = ./secrets/root_work_passwd_hash.age;
#sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
2024-06-05 20:08:35 +00:00
syncthing-key.file = ./secrets/mtworx/syncthing/key.pem.age;
syncthing-cert.file = ./secrets/mtworx/syncthing/cert.pem.age;
2024-03-18 15:46:17 +00:00
};
}
2024-03-12 19:26:31 +00:00
];
2024-07-29 12:39:54 +00:00
specialArgs = {
inherit myData;
} // inputs;
2024-03-12 19:26:31 +00:00
};
2024-02-06 07:53:14 +00:00
fwminex = nixpkgs.lib.nixosSystem {
2023-11-27 16:17:27 +00:00
system = "x86_64-linux";
modules = [
2024-07-29 12:39:54 +00:00
{ nixpkgs.overlays = overlays; }
2023-11-27 16:17:27 +00:00
./hosts/fwminex/configuration.nix
home-manager.nixosModules.home-manager
nixos-hardware.nixosModules.framework-12th-gen-intel
2024-07-23 19:01:40 +00:00
agenix.nixosModules.default
{
age.secrets = {
2024-07-24 06:02:57 +00:00
motiejus-server-passwd-hash.file = ./secrets/motiejus_server_passwd_hash.age;
root-server-passwd-hash.file = ./secrets/root_server_passwd_hash.age;
2024-07-23 19:01:40 +00:00
sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
2024-08-02 11:00:18 +00:00
headscale-client-oidc.file = ./secrets/headscale/oidc_client_secret2.age;
2024-07-31 06:40:05 +00:00
borgbackup-password.file = ./secrets/fwminex/borgbackup-password.age;
2024-08-03 02:57:15 +00:00
grafana-oidc.file = ./secrets/grafana.jakstys.lt/oidc.age;
letsencrypt-account-key.file = ./secrets/letsencrypt/account.key.age;
2024-08-03 03:53:37 +00:00
vaultwarden-secrets-env.file = ./secrets/vaultwarden/secrets.env.age;
2024-08-02 13:03:09 +00:00
photoprism-admin-passwd.file = ./secrets/photoprism/admin_password.age;
2024-08-03 15:57:29 +00:00
synapse-jakstys-signing-key.file = ./secrets/synapse/jakstys_lt_signing_key.age;
synapse-registration-shared-secret.file = ./secrets/synapse/registration_shared_secret.age;
synapse-macaroon-secret-key.file = ./secrets/synapse/macaroon_secret_key.age;
2024-07-30 19:47:21 +00:00
syncthing-key.file = ./secrets/fwminex/syncthing/key.pem.age;
syncthing-cert.file = ./secrets/fwminex/syncthing/cert.pem.age;
2024-07-23 19:01:40 +00:00
};
}
2023-11-27 16:17:27 +00:00
];
2023-09-13 09:17:43 +00:00
2024-07-29 12:39:54 +00:00
specialArgs = {
inherit myData;
} // inputs;
2023-11-27 16:17:27 +00:00
};
2023-09-13 09:17:43 +00:00
2024-08-05 12:43:08 +00:00
vno1-gdrx = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{ nixpkgs.overlays = overlays; }
./hosts/vno1-gdrx/configuration.nix
home-manager.nixosModules.home-manager
nix-index-database.nixosModules.nix-index
#agenix.nixosModules.default
#{
# age.secrets = {
# motiejus-work-passwd-hash.file = ./secrets/motiejus_work_passwd_hash.age;
# root-work-passwd-hash.file = ./secrets/root_work_passwd_hash.age;
# #sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
# #syncthing-key.file = ./secrets/mtworx/syncthing/key.pem.age;
# #syncthing-cert.file = ./secrets/mtworx/syncthing/cert.pem.age;
# };
#}
];
specialArgs = {
inherit myData;
} // inputs;
};
2024-02-06 07:53:14 +00:00
vno3-rp3b = nixpkgs.lib.nixosSystem {
2023-11-27 16:17:27 +00:00
system = "aarch64-linux";
modules = [
2024-07-29 12:39:54 +00:00
{ nixpkgs.overlays = overlays; }
2023-11-27 16:17:27 +00:00
./hosts/vno3-rp3b/configuration.nix
2023-11-27 16:17:27 +00:00
./modules
2023-08-15 04:09:11 +00:00
2023-11-27 16:17:27 +00:00
agenix.nixosModules.default
home-manager.nixosModules.home-manager
2023-08-15 04:09:11 +00:00
2023-11-27 16:17:27 +00:00
{
age.secrets = {
motiejus-passwd-hash.file = ./secrets/motiejus_passwd_hash.age;
root-passwd-hash.file = ./secrets/root_passwd_hash.age;
sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
2023-11-27 16:17:27 +00:00
datapool-passphrase.file = ./secrets/vno3-rp3b/datapool-passphrase.age;
};
}
];
2023-08-15 04:09:11 +00:00
2024-07-29 12:39:54 +00:00
specialArgs = {
inherit myData;
} // inputs;
2023-11-27 16:17:27 +00:00
};
2023-08-15 04:09:11 +00:00
2024-07-30 20:06:33 +00:00
fra1-b = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
{ nixpkgs.overlays = overlays; }
agenix.nixosModules.default
home-manager.nixosModules.home-manager
./hosts/fra1-b/configuration.nix
./modules
2024-07-30 21:18:48 +00:00
{
age.secrets = {
motiejus-passwd-hash.file = ./secrets/motiejus_passwd_hash.age;
root-passwd-hash.file = ./secrets/root_passwd_hash.age;
sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
};
}
2024-07-30 20:06:33 +00:00
];
specialArgs = {
inherit myData;
} // inputs;
};
2023-08-26 04:18:27 +00:00
};
2023-11-27 16:17:27 +00:00
deploy.nodes = {
fwminex = {
2024-07-31 06:19:13 +00:00
hostname = myData.hosts."fwminex.servers.jakst".jakstIP;
2023-11-27 16:17:27 +00:00
profiles = {
system = {
sshUser = "motiejus";
2024-07-29 12:39:54 +00:00
path = self.nixosConfigurations.fwminex.pkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.fwminex;
2023-11-27 16:17:27 +00:00
user = "root";
};
2023-09-15 12:05:25 +00:00
};
};
2024-04-04 16:54:51 +00:00
mtworx = {
hostname = myData.hosts."mtworx.motiejus.jakst".jakstIP;
profiles = {
system = {
sshUser = "motiejus";
2024-07-29 12:39:54 +00:00
path = self.nixosConfigurations.mtworx.pkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.mtworx;
2024-04-04 16:54:51 +00:00
user = "root";
};
};
};
2023-11-27 16:17:27 +00:00
vno3-rp3b = {
hostname = myData.hosts."vno3-rp3b.servers.jakst".jakstIP;
profiles = {
system = {
sshUser = "motiejus";
2024-07-29 12:39:54 +00:00
path = self.nixosConfigurations.vno3-rp3b.pkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.vno3-rp3b;
2023-11-27 16:17:27 +00:00
user = "root";
};
2023-08-16 12:58:35 +00:00
};
};
2023-08-15 04:09:11 +00:00
2024-07-30 21:18:48 +00:00
fra1-b = {
hostname = myData.hosts."fra1-b.servers.jakst".jakstIP;
profiles = {
system = {
sshUser = "motiejus";
path = self.nixosConfigurations.fra1-b.pkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.fra1-b;
user = "root";
};
};
};
2023-08-26 04:18:27 +00:00
};
2024-07-29 12:39:54 +00:00
checks = builtins.mapAttrs (
system: deployLib:
let
pkgs = import nixpkgs { inherit system overlays; };
in
deployLib.deployChecks self.deploy
// {
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
2023-10-01 19:51:53 +00:00
};
2024-07-29 12:39:54 +00:00
deadnix.enable = true;
statix.enable = true;
};
};
2024-02-24 17:43:19 +00:00
2024-07-29 12:39:54 +00:00
compress-drv-test = pkgs.callPackage ./pkgs/compress-drv/test.nix { };
}
) deploy-rs.lib;
2023-04-03 13:50:52 +00:00
}
2024-07-29 12:39:54 +00:00
// flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
{
devShells.default = pkgs.mkShellNoCC {
GIT_AUTHOR_EMAIL = "motiejus@jakstys.lt";
packages = [
pkgs.nix-output-monitor
pkgs.rage
pkgs.age-plugin-yubikey
pkgs.deploy-rs.deploy-rs
agenix.packages.${system}.agenix
];
inherit (self.checks.${system}.pre-commit-check) shellHook;
};
2023-04-03 13:50:52 +00:00
2024-07-29 12:39:54 +00:00
formatter = pkgs.nixfmt-rfc-style;
}
);
2023-03-29 14:50:55 +00:00
}