bifrost: nixos on digitalocean 👌

This commit is contained in:
Adithya 2024-11-09 20:27:33 +05:30
parent 3c9658a57b
commit 0656576e76
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
14 changed files with 209 additions and 38 deletions

View file

@ -6,6 +6,7 @@ keys:
- &host_rico2 age19uy6xerll6st3s3ftfpy7075m9eetm2288l2w07k7ek6z2l3ef6qfw34cf
- &host_wynne age1jyaf9rn5d5pqjh60shs2q5hs98fwugak8z6cs6qs7yuc3wntugmsumxmv0
- &host_layne age1k2wpm88wms6hx3ldvu0n2je7pag9fexs9eq0e8hlkfcs2dx9eg9qlkf95d
- &host_bifrost age1jt8uleg4auf0h8ftl4ykq73epvgqml29q8ty0lz6kasta5h6td3shgxvrr
creation_rules:
- path_regex: secrets.yaml
key_groups:
@ -17,3 +18,4 @@ creation_rules:
- *host_rico2
- *host_wynne
- *host_layne
- *host_bifrost

View file

@ -201,6 +201,28 @@
./hosts/layne
];
};
Bifrost =
let
hostname = "Bifrost";
system = "x86_64-linux";
username = "adtya";
in
nixpkgs.lib.nixosSystem {
inherit system;
pkgs = packages system;
specialArgs = { inherit inputs username; };
modules = [
{
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
networking.hostName = lib.mkForce hostname;
nixpkgs.hostPlatform = lib.mkDefault system;
}
sops-nix.nixosModules.sops
self.nixosModules.default
./common
./hosts/bifrost
];
};
};
deploy.nodes = {
@ -244,6 +266,14 @@
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.Layne;
};
};
Bifrost = {
hostname = "Biforst";
sshUser = "adtya";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.Bifrost;
};
};
};
}
// flake-utils.lib.eachDefaultSystem (system:
@ -264,6 +294,7 @@
];
};
packages.getpaper = pkgs.callPackage ./extra-packages/scripts/getpaper { };
packages.digitalOceanImage = (pkgs.nixos { imports = [ "${nixpkgs}/nixos/modules/virtualisation/digital-ocean-image.nix" ]; system.stateVersion = "24.11"; }).digitalOceanImage;
}
);
}

40
hosts/bifrost/default.nix Normal file
View file

@ -0,0 +1,40 @@
{ modulesPath, ... }: {
imports = [
(modulesPath + "/virtualisation/digital-ocean-config.nix")
./network.nix
./programs
./services
./security.nix
];
nodeconfig = {
minimize = true;
nix.auto-gc = true;
};
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
};
supportedLocales = [ "en_US.UTF-8/UTF-8" ];
};
time.timeZone = "Asia/Kolkata";
system = {
switch = {
enable = false;
enableNg = true;
};
stateVersion = "24.11";
};
}

12
hosts/bifrost/network.nix Normal file
View file

@ -0,0 +1,12 @@
{ lib, ... }: {
imports = [
../shared/network.nix
../shared/networkd.nix
];
networking = {
nameservers = lib.mkForce [
"1.1.1.1"
"1.0.0.1"
];
};
}

View file

@ -0,0 +1,16 @@
{ pkgs, ... }: {
imports = [
./neovim.nix
./starship.nix
./zsh.nix
];
programs = {
git.enable = true;
};
environment.systemPackages = with pkgs; [
sops
age
];
}

View file

@ -0,0 +1,8 @@
_: {
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
}

View file

@ -0,0 +1,8 @@
_: {
programs.starship = {
enable = true;
settings = {
add_newline = false;
};
};
}

View file

@ -0,0 +1,10 @@
_: {
programs = {
zsh = {
enable = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
};
};
environment.pathsToLink = [ "/share/zsh" ];
}

View file

@ -0,0 +1,9 @@
_: {
security = {
sudo = {
wheelNeedsPassword = false;
};
polkit.enable = true;
};
}

View file

@ -0,0 +1,5 @@
_: {
imports = [
./ssh.nix
];
}

View file

@ -0,0 +1,21 @@
_: {
services.openssh = {
enable = true;
settings = {
KbdInteractiveAuthentication = false;
PasswordAuthentication = false;
PermitRootLogin = "no";
};
hostKeys = [
{
path = "/persist/secrets/ssh/keys/ssh_host_ed25519_key";
type = "ed25519";
}
{
path = "/persist/secrets/ssh/keys/ssh_host_rsa_key";
type = "rsa";
bits = "4096";
}
];
};
}

View file

@ -1,4 +1,4 @@
_: {
{ lib, config, ... }: {
networking = {
useNetworkd = true;
};
@ -26,7 +26,7 @@ _: {
linkConfig = {
RequiredForOnline = "yes";
};
routes = [
routes = lib.mkIf ((lib.strings.toLower config.networking.hostName) != "bifrost") [
{
Destination = "165.232.180.97";
Gateway = "_dhcp4";

View file

@ -37,65 +37,74 @@ sops:
- recipient: age1w5rvr4nl8xvjjxpct4e2a2eajvm79v4r9nyxrcn40fm8d7h9l9cqkk0jtt
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBhMWpGcmtXcVp5dmxSUWQ0
RTBQd0RxNVdPODQrOVJOTjNiTkh4YjNVNzF3Cm5YUkxoT3ZPUmV2Q2xwbXBsSGl0
c2drMXY3UnE2cHJjSjdHdW53TWUzaTgKLS0tIHJSdmQ2ZXF1NnJqTGtCUER3NEtY
ejBNdEltL252RXN6M2VlZ3IyNkgyMk0K76RGGt1tXnm76nm/k6V3OObgDEnQG0eP
DDJKBQiUOqFan5Yu83CgkOFpFw+2eMFw23RFDoLmCMi8/dqAbQAqvw==
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFZ2NPRVZxUlFZbVArSlNz
aGxBMCszb0JRbWJFNFhkcVJoa00xV3BJQ1JZCmcvZUpRODBkLzVWTDVqUWtCR3V3
ektBTkprdzFENTIxaEZZQ0RpZGRrUm8KLS0tIFc0aVhuZVh6dW4wbnZ1ajNDazdk
aXRQZUI4RVlEeGdUMXoya2RCRnMxRDQKWxogRGGH5dP8w80xBBchjxs0Hhw0o+BX
uxNQZoSYENIPESR7ydO7642r8xjLdQdfMEjKz/rnooCgB1Zy7X7kGw==
-----END AGE ENCRYPTED FILE-----
- recipient: age1mhks8qmhjrtc2u5ufvp3pv2hn7tkadvmscnp7wd0ywmnse0szctqsnpy0a
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4WEl5MDNuY2VvRTh5eU5N
dFZsOEVmMklkZ3lHSG9SRTdzeTFmdGp0YURnCkxjOWJrRTA4MWh1Y0UvVDNMSFov
b1Zmc2R2MkNTUDVmVlU5c2J5Q0R5OVEKLS0tIE1HYk1veEg1NUpkQzZmWE5NeVM2
Rk5sYy85VkhLb1hpRXB2M3Ntb1BocWsKy82qsGfMLs8HSJ5yHm0TmxQQL+JYNXDs
KjUeabcRK5Y5tE/z/axYAFz+y9ib7gfVQ7O1rb7Wa78OnxbeZxZYTA==
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAxeDZYeTNtczE4eWVYcTcy
ZDZmeU8xZlppMHlQUlkyb3h2cWRGbXpBeUFNCjUzNGs1endaZ2tzTzE2SE1CYWg2
aHU0dnlpeU9aRTYyc2hCMU1YYlBFQ1UKLS0tIERsS2VUSVllcVhUNzExOEJqSlF4
SVNNaHl0ckt4bmtSazloUnREM3VWZ28K2/DfdwYi7iMiNrHn/9FMEJX5aaL/PLoR
GYtO9JpFHFWngDSVsJm013NlsvAtCY1ep382EWK8Z/I+QahkoyBW2w==
-----END AGE ENCRYPTED FILE-----
- recipient: age106k9u5ns9h7smh3gqc40k9fft5emknvq669qdv8a29ak3ah4j38s5ng2gt
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA1QnlsNk03OFpEUzgzNVRD
RTJzR3dPV1hRTTNxeWU0dDA4L2lEZWQ4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uc8CyTDFTuyDoAhvmnzXHtrg1wpA==
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBaaVpYU3JJQ05iNGdYNHMv
MjFIcEw4bk9UdWVaSnhncUJkYmlaaHlxSnpRClJMemtIcklGUzE0ZzZaVXNiS0dO
SGdxWVpjRzdHSDROcVl2bTNxVzlwTmsKLS0tIFE4cHFpOWpSYlRLYnZjVmlTc1V2
UVV6WlpRbzk0UjZVL2RMQmNnNnlvZ1UKhrTqF6vq1c2jsrvjtMv+03fwj5MZIVTn
uPY7OHqm0scOxARNIW7nVYeTIxNYFEPvfZiriydrOtXfrVZB4u82IQ==
-----END AGE ENCRYPTED FILE-----
- recipient: age1jt8uleg4auf0h8ftl4ykq73epvgqml29q8ty0lz6kasta5h6td3shgxvrr
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB4ajFvYVJxejJkcTM0Rm5n
a0tOWFE4Q1R6ZS9qZE1BTVZybnRSTS94Y0NFCjJIUjRwODMvcmFKN3VvYUNVOFB3
V1lJZW56STFra0JsRXF0RVM3eWtLaTQKLS0tIC95SmtrRTFRbW0raCtZWTN4RkFJ
UXJhWFFnQnFvOEF0M0JFb3E4UVB4UU0KSUq4d8eudY03p/fd8S8f1wk0OU4BlNYB
tldkOx2DhSvcVr/FcIJIR2PFbU8o50kYj9R0HR2sHJ5C5fJ0cDXY4A==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-10-31T05:28:50Z"
mac: ENC[AES256_GCM,data:PbyhjXr/IZw+5q0PqTjXowHaiB31NjZzYpKhVV5s43+XrdMpVhcaqr9Gs7yTsqNsSc36uZ1YRymwYr8i+bF1k81lvDgyEr38Pl3vcEoIy+jNPaVnxXBRW6CL69cKfC058GmuPRYIyevorw3G3DtpLsCT5lGiMS9XedmBMf3rsw0=,iv:lHO27bURe7apOq/2KQXttou/OJMRM4uBrpqH26hBIDE=,tag:1ulMCx3/UCWCplUv+NJqNA==,type:str]