2 description = "The deployment flake for the awful.systems cluster";
5 nixpkgs.url = "nixpkgs/nixos-23.05";
6 flake-utils.url = "github:numtide/flake-utils";
7 pkgs-unstable.url = "nixpkgs/nixos-unstable";
8 sops-nix.url = "github:Mic92/sops-nix";
11 outputs = { self, nixpkgs, flake-utils, sops-nix, ... }@attrs:
13 nixosConfigurations = {
14 these = nixpkgs.lib.nixosSystem {
17 [ ./hosts/these/configuration.nix sops-nix.nixosModules.sops ];
19 more = nixpkgs.lib.nixosSystem {
22 [ ./hosts/more/configuration.nix sops-nix.nixosModules.sops ];
25 } // flake-utils.lib.eachDefaultSystem (system:
27 pkgs = nixpkgs.legacyPackages.${system};
28 deploy = name: target:
29 pkgs.writeShellScriptBin "deploy-${name}" ''
30 nixos-rebuild switch --fast --flake .#${name} \
31 --target-host ${target} \
35 pkgs.writeShellScriptBin "go-${name}" ''
38 init-secrets = pkgs.writeShellScriptBin "init-secrets" ''
39 mkdir -p ~/.config/sops/age
40 cp "$1" /tmp/init-secrets-key &&
41 ${pkgs.openssh}/bin/ssh-keygen -p -N "" -f /tmp/init-secrets-key &&
42 ${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i /tmp/init-secrets-key > ~/.config/sops/age/keys.txt
43 rm /tmp/init-secrets-key
44 echo Your age public key is:
45 ${pkgs.age}/bin/age-keygen -y ~/.config/sops/age/keys.txt
47 rekey-secrets = pkgs.writeShellScriptBin "rekey-secrets" ''
48 ${pkgs.sops}/bin/sops updatekeys "$1"
51 devShells.default = pkgs.mkShell {
56 (deploy "these" "root@these.awful.systems")
57 (go "these" "root@these.awful.systems")
58 (deploy "more" "root@more.awful.systems")
59 (go "more" "root@more.awful.systems")
65 (pkgs.callPackage ./maint-mode/site.nix {});