os/flake.nix

137 lines
3.5 KiB
Nix

{
description = "b12f hosts";
inputs = {
# Track channels with commits tested and built by hydra
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-flake.url = "github:srid/nixos-flake";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.inputs.flake-compat.follows = "flake-compat";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:nixos/nixos-hardware";
impermanence.url = "github:nix-community/impermanence";
mobile-nixos.url = "github:nixos/mobile-nixos";
mobile-nixos.flake = false;
musnix.url = "github:musnix/musnix";
adblock-unbound.url = "github:MayNiklas/nixos-adblock-unbound";
adblock-unbound.inputs.nixpkgs.follows = "nixpkgs";
openstreetmap.url = "github:b12f/nixos-openstreetmap/flake-nixosmodule";
openstreetmap.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
imports = [
inputs.nixos-flake.flakeModule
./lib
./modules
./hosts
./users
./overlays
];
perSystem = args@{ system, pkgs, lib, config, ... }: {
_module.args = {
inherit inputs;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.agenix.overlays.default ];
};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
nix
agenix
age-plugin-yubikey
cachix
nixos-generators
nvfetcher
editorconfig-checker
nodePackages.prettier
shellcheck
shfmt
treefmt
nixpkgs-fmt
deploy-rs
# terraform
# terraform-backend-git
];
shellHook = ''
export TF_BACKEND_GIT_GIT_REPOSITORY=gitea@git.pub.solar:b12f/terraform-state.git
export TF_BACKEND_GIT_GIT_REF=main
export TF_BACKEND_GIT_GIT_STATE=b12f.json
export TF_BACKEND_HTTP_ENCRYPTION_PROVIDER=sops
export TF_BACKEND_HTTP_SOPS_PGP_FP=4406E80E13CD656C
export HOSTINGDE_AUTH_TOKEN=$(secret-tool lookup hosting-de terraform-auth-token)
'';
};
};
flake = {
deploy.nodes = self.lib.deploy.mkDeployNodes self.nixosConfigurations {
chocolatebar = {
sshUser = "b12f";
};
biolimo = {
sshUser = "b12f";
};
stroopwafel = {
sshUser = "b12f";
};
droppie = {
hostname = "droppie.b12f.io";
sshUser = "yule";
};
pie = {
hostname = "pie.b12f.io";
sshUser = "yule";
};
frikandel = {
hostname = "frikandel.b12f.io";
sshUser = "yule";
};
maoam = {
sshUser = "b12f";
};
};
};
};
}