2023-07-30 14:50:11 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
# Principle inputs (updated by `nix run .#update`)
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
nix-darwin.url = "github:lnl7/nix-darwin/master";
|
|
|
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
nixos-flake.url = "github:srid/nixos-flake";
|
|
|
|
|
|
|
|
terranix.url = "github:terranix/terranix";
|
2023-10-27 21:06:55 +00:00
|
|
|
|
|
|
|
deploy-rs.url = "github:serokell/deploy-rs";
|
2023-07-30 14:50:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = inputs@{ self, terranix, ... }:
|
|
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
|
|
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
inputs.nixos-flake.flakeModule
|
2023-10-27 21:06:55 +00:00
|
|
|
# ./terraform.nix
|
|
|
|
./public-keys
|
|
|
|
./lib
|
2023-07-30 14:50:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
perSystem = { config, ... }: { };
|
|
|
|
|
|
|
|
flake =
|
|
|
|
let
|
2023-10-27 21:06:55 +00:00
|
|
|
username = "barkeeper";
|
2023-07-30 14:50:11 +00:00
|
|
|
system = "x86_64-linux";
|
2023-10-27 21:06:55 +00:00
|
|
|
in {
|
2023-07-30 14:50:11 +00:00
|
|
|
nixosConfigurations = {
|
2023-10-27 21:06:55 +00:00
|
|
|
nachtigall = self.nixos-flake.lib.mkLinuxSystem system {
|
2023-07-30 14:50:11 +00:00
|
|
|
imports = [
|
2023-10-27 21:06:55 +00:00
|
|
|
self.nixosModules.common
|
|
|
|
./hosts/nachtigall
|
|
|
|
self.pub-solar.lib.linux.unlockZFSOnBoot
|
2023-07-30 14:50:11 +00:00
|
|
|
self.nixosModules.home-manager
|
2023-10-27 21:06:55 +00:00
|
|
|
self.nixosModules.linux
|
2023-07-30 14:50:11 +00:00
|
|
|
{
|
2023-10-27 21:06:55 +00:00
|
|
|
home-manager.users.${username} = {
|
2023-07-30 14:50:11 +00:00
|
|
|
imports = [
|
2023-10-27 21:06:55 +00:00
|
|
|
self.homeModules.common
|
2023-07-30 14:50:11 +00:00
|
|
|
];
|
2023-10-27 21:06:55 +00:00
|
|
|
home.stateVersion = "23.05";
|
2023-07-30 14:50:11 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nixosModules = {
|
|
|
|
# Common nixos/nix-darwin configuration shared between Linux and macOS.
|
|
|
|
common = { pkgs, ... }: {
|
2023-10-27 21:06:55 +00:00
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
services.openssh.enable = true;
|
|
|
|
services.openssh.settings.PermitRootLogin = "prohibit-password";
|
2023-07-30 14:50:11 +00:00
|
|
|
};
|
2023-10-27 21:06:55 +00:00
|
|
|
|
2023-07-30 14:50:11 +00:00
|
|
|
# NixOS specific configuration
|
|
|
|
linux = { pkgs, ... }: {
|
2023-10-27 21:06:55 +00:00
|
|
|
users.users.${username} = {
|
|
|
|
name = username;
|
|
|
|
group = username;
|
|
|
|
extraGroups = ["wheel"];
|
|
|
|
isNormalUser = true;
|
|
|
|
openssh.authorizedKeys.keys = self.publicKeys.allAdmins;
|
|
|
|
};
|
|
|
|
users.groups.${username} = {};
|
|
|
|
|
|
|
|
security.sudo.wheelNeedsPassword = false;
|
|
|
|
nix.settings.trusted-users = [ "root" username ];
|
|
|
|
|
|
|
|
# TODO: Remove when we stop locking ourselves out.
|
|
|
|
users.users.root.openssh.authorizedKeys.keys = self.publicKeys.allAdmins;
|
2023-07-30 14:50:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# All home-manager configurations are kept here.
|
|
|
|
homeModules = {
|
|
|
|
# Common home-manager configuration shared between Linux and macOS.
|
|
|
|
common = { pkgs, ... }: {
|
|
|
|
programs.git.enable = true;
|
|
|
|
programs.starship.enable = true;
|
|
|
|
programs.bash.enable = true;
|
2023-10-27 21:06:55 +00:00
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
vimAlias = true;
|
|
|
|
viAlias = true;
|
|
|
|
defaultEditor = true;
|
|
|
|
# configure = {
|
|
|
|
# packages.myVimPackages = with pkgs.vimPlugins; {
|
|
|
|
# start = [vim-nix vim-surrund rainbow];
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
};
|
2023-07-30 14:50:11 +00:00
|
|
|
};
|
2023-10-27 21:06:55 +00:00
|
|
|
};
|
|
|
|
deploy.nodes = self.pub-solar.lib.deploy.mkDeployNodes self.nixosConfigurations {
|
|
|
|
nachtigall = {
|
|
|
|
sshUser = username;
|
2023-07-30 14:50:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|