tami-nix-infra/flake.nix

25 lines
831 B
Nix
Raw Normal View History

2023-05-15 21:47:22 +03:00
{
2023-05-17 00:15:23 +03:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; };
};
2023-05-15 21:47:22 +03:00
2023-05-17 00:15:23 +03:00
outputs = inputs:
let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (inputs.nixpkgs) lib;
in
{
nixosConfigurations.tami-mac = import ./hosts/tami-mac inputs;
2023-05-15 21:47:22 +03:00
2023-05-17 00:15:23 +03:00
apps.${system} = lib.mapAttrs' (n: v: lib.nameValuePair ("deploy-${n}") v) (lib.genAttrs (lib.attrNames inputs.self.nixosConfigurations) (host: {
type = "app";
program = toString (pkgs.writeShellScript "deploy-${host}" ''
${lib.getExe pkgs.nixos-rebuild} switch --fast --flake ${inputs.self}#${host} \
--build-host tami@${host} --target-host tami@${host}
'');
}));
};
2023-05-15 21:47:22 +03:00
}