馃彙 my personal home lab
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 138 lines 3.6 kB view raw
1{ 2 description = "my homelab"; 3 4 inputs = { 5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 6 nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.11"; 7 nixos-hardware.url = "github:nixos/nixos-hardware/master"; 8 deploy-rs = { 9 url = "github:serokell/deploy-rs"; 10 inputs.nixpkgs.follows = "nixpkgs"; 11 }; 12 sops-nix = { 13 url = "github:Mic92/sops-nix"; 14 inputs.nixpkgs.follows = "nixpkgs"; 15 }; 16 turing-rk1 = { 17 url = "github:GiyoMoon/nixos-turing-rk1"; 18 inputs.nixpkgs.follows = "nixpkgs"; 19 }; 20 tranquil-pds = { 21 url = "git+https://tangled.org/tranquil.farm/tranquil-pds"; 22 inputs.nixpkgs.follows = "nixpkgs"; 23 }; 24 tangled = { 25 url = "git+https://tangled.org/@tangled.org/core"; 26 inputs.nixpkgs.follows = "nixpkgs"; 27 }; 28 }; 29 30 outputs = 31 { 32 self, 33 nixpkgs, 34 nixpkgs-stable, 35 deploy-rs, 36 nixos-hardware, 37 turing-rk1, 38 sops-nix, 39 tranquil-pds, 40 tangled, 41 ... 42 }@inputs: 43 let 44 inherit (nixpkgs) lib; 45 46 # build system 47 system = "x86_64-linux"; 48 # deploy system 49 targetSystem = "aarch64-linux"; 50 51 deployPkgs = import nixpkgs { 52 system = targetSystem; 53 overlays = [ 54 deploy-rs.overlays.default 55 (self: super: { 56 deploy-rs = { 57 inherit (nixpkgs.legacyPackages.${targetSystem}) deploy-rs; 58 lib = super.deploy-rs.lib; 59 }; 60 }) 61 ]; 62 }; 63 64 hosts = { 65 cm4-node-1 = { 66 ipv4 = "10.0.0.11"; 67 ipv6 = "2a02:168:7353::11"; 68 hardware = nixos-hardware.nixosModules.raspberry-pi-4; 69 }; 70 cm4-node-2 = { 71 ipv4 = "10.0.0.12"; 72 ipv6 = "2a02:168:7353::12"; 73 hardware = nixos-hardware.nixosModules.raspberry-pi-4; 74 }; 75 rk1-node-1 = { 76 ipv4 = "10.0.0.13"; 77 ipv6 = "2a02:168:7353::13"; 78 hardware = turing-rk1.nixosModules.turing-rk1; 79 }; 80 rk1-node-2 = { 81 ipv4 = "10.0.0.14"; 82 ipv6 = "2a02:168:7353::14"; 83 hardware = turing-rk1.nixosModules.turing-rk1; 84 }; 85 }; 86 87 mkSystem = 88 name: host: 89 let 90 system = "aarch64-linux"; 91 pkgs-stable = import nixpkgs-stable { 92 inherit system; 93 config.allowUnfree = true; 94 }; 95 in 96 lib.nixosSystem { 97 system = "aarch64-linux"; 98 specialArgs = { 99 inherit 100 host 101 hosts 102 name 103 inputs 104 pkgs-stable 105 ; 106 }; 107 modules = [ 108 host.hardware 109 sops-nix.nixosModules.sops 110 tranquil-pds.nixosModules.default 111 tangled.nixosModules.knot 112 tangled.nixosModules.spindle 113 ./hosts/${name}.nix 114 ]; 115 }; 116 117 mkDeploy = name: host: { 118 hostname = host.ipv4; 119 profiles.system = { 120 sshUser = "root"; 121 user = "root"; 122 path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.${name}; 123 }; 124 }; 125 in 126 { 127 nixosConfigurations = lib.mapAttrs mkSystem hosts; 128 129 deploy.nodes = lib.mapAttrs mkDeploy hosts; 130 131 packages.${system} = { 132 default = nixpkgs.legacyPackages.${system}.deploy-rs; 133 sops = nixpkgs.legacyPackages.${system}.sops; 134 }; 135 136 checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; 137 }; 138}