rename sj-bm-hostkey0 -> hstk0
This commit is contained in:
parent
92be66cbb5
commit
b30596b3a6
14 changed files with 348 additions and 577 deletions
1
nix/os/devices/hstk0/.gitignore
vendored
Normal file
1
nix/os/devices/hstk0/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
result
|
7
nix/os/devices/hstk0/README.md
Normal file
7
nix/os/devices/hstk0/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
## bootstrapping
|
||||
|
||||
```
|
||||
# TODO: generate an SSH host-key and deploy it via --extra-files
|
||||
nixos-anywhere --flake .\#sj-bm-hostkey0 root@185.130.227.252
|
||||
```
|
||||
|
155
nix/os/devices/hstk0/configuration.nix
Normal file
155
nix/os/devices/hstk0/configuration.nix
Normal file
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
modulesPath,
|
||||
repoFlake,
|
||||
packages',
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
nodeFlake,
|
||||
nodeName,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
disabledModules = [
|
||||
];
|
||||
|
||||
imports = [
|
||||
nodeFlake.inputs.disko.nixosModules.disko
|
||||
repoFlake.inputs.sops-nix.nixosModules.sops
|
||||
|
||||
nodeFlake.inputs.srvos.nixosModules.roles-nix-remote-builder
|
||||
{
|
||||
roles.nix-remote-builder.schedulerPublicKeys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINQ22z5rDdCLYH+MEoEt+tXJXTJqoeZNqvJl2n4aB+Kn steveej@steveej-x13s"
|
||||
|
||||
# TODO: make this a reference to the private key's secret
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8FHuK0k86iBWq41+NAhVwJqH1ZpGJe+q01m7iLviz6 root@steveej-t14"
|
||||
];
|
||||
}
|
||||
|
||||
../../snippets/nix-settings.nix
|
||||
{
|
||||
nix.settings.sandbox = lib.mkForce "relaxed";
|
||||
}
|
||||
|
||||
../../snippets/mycelium.nix
|
||||
|
||||
# user config
|
||||
../../profiles/common/user.nix
|
||||
{
|
||||
users.commonUsers = {
|
||||
enable = true;
|
||||
enableNonRoot = true;
|
||||
};
|
||||
}
|
||||
|
||||
../../snippets/home-manager-with-zsh.nix
|
||||
# {
|
||||
# home-manager.users.steveej = {pkgs, ...}: {
|
||||
# imports = [
|
||||
# ../../../home-manager/programs/pass.nix
|
||||
# ../../../home-manager/programs/openvscode-server.nix
|
||||
# ];
|
||||
# };
|
||||
# }
|
||||
];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
settings.PermitRootLogin = "yes";
|
||||
extraConfig = ''
|
||||
StreamLocalBindUnlink yes
|
||||
'';
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernel = {
|
||||
sysctl = {
|
||||
"net.ipv4.conf.all.forwarding" = true;
|
||||
"net.ipv6.conf.all.forwarding" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = nodeName;
|
||||
useNetworkd = true;
|
||||
useDHCP = true;
|
||||
|
||||
nat.enable = true;
|
||||
firewall.enable = true;
|
||||
|
||||
firewall.allowedTCPPorts = [
|
||||
5201
|
||||
];
|
||||
firewall.allowedUDPPorts = [
|
||||
5201
|
||||
];
|
||||
};
|
||||
|
||||
disko.devices = let
|
||||
disk = id: {
|
||||
type = "disk";
|
||||
device = "/dev/${id}";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02"; # for grub MBR
|
||||
};
|
||||
mdadm = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "raid0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
disk = {
|
||||
sda = disk "sda";
|
||||
sdb = disk "sdb";
|
||||
};
|
||||
mdadm = {
|
||||
raid0 = {
|
||||
type = "mdadm";
|
||||
level = 0;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
primary = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "btrfs";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
boot.initrd.includeDefaultModules = true;
|
||||
boot.initrd.kernelModules = [
|
||||
"dm-raid"
|
||||
"dm-integrity"
|
||||
"xhci_pci_renesas"
|
||||
];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
boot.binfmt.emulatedSystems = [
|
||||
"aarch64-linux"
|
||||
];
|
||||
}
|
34
nix/os/devices/hstk0/default.nix
Normal file
34
nix/os/devices/hstk0/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
nodeName,
|
||||
repoFlake,
|
||||
nodeFlake,
|
||||
...
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
in {
|
||||
meta.nodeSpecialArgs.${nodeName} = {
|
||||
inherit repoFlake nodeName nodeFlake system;
|
||||
packages' = repoFlake.packages.${system};
|
||||
};
|
||||
|
||||
meta.nodeNixpkgs.${nodeName} =
|
||||
import nodeFlake.inputs.nixpkgs.outPath
|
||||
{
|
||||
inherit system;
|
||||
};
|
||||
|
||||
${nodeName} = {
|
||||
deployment.targetHost = "185.130.224.33";
|
||||
deployment.replaceUnknownProfiles = false;
|
||||
|
||||
# nixpkgs.pkgs = nodeFlake.inputs.nixpkgs.legacyPackages.${system};
|
||||
|
||||
imports = [
|
||||
nodeFlake.inputs.home-manager.nixosModules.home-manager
|
||||
|
||||
./configuration.nix
|
||||
];
|
||||
|
||||
networking.hostName = nodeName;
|
||||
};
|
||||
}
|
124
nix/os/devices/hstk0/flake.lock
generated
Normal file
124
nix/os/devices/hstk0/flake.lock
generated
Normal file
|
@ -0,0 +1,124 @@
|
|||
{
|
||||
"nodes": {
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719401812,
|
||||
"narHash": "sha256-QONBQ/arBsKZNJuSd3sMIkSYFlBoRJpvf1jGlMfcOuI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "b6a1262796b2990ec3cc60bb2ec23583f35b2f43",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"get-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1714237590,
|
||||
"narHash": "sha256-9gtHdGbzFHaR20xORN8IYd67ROWS+1nqQ5CsPf9MD8I=",
|
||||
"owner": "ursi",
|
||||
"repo": "get-flake",
|
||||
"rev": "a6c57417d1b857b8be53aba4095869a0f438c502",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ursi",
|
||||
"repo": "get-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718530513,
|
||||
"narHash": "sha256-BmO8d0r+BVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "a1fddf0967c33754271761d91a3d921772b30d0e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-24.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1719253556,
|
||||
"narHash": "sha256-A/76RFUVxZ/7Y8+OMVL1Lc8LRhBxZ8ZE2bpMnvZ1VpY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fc07dc3bdf2956ddd64f24612ea7fc894933eb2e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1719254875,
|
||||
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"disko": "disko",
|
||||
"get-flake": "get-flake",
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"srvos": "srvos"
|
||||
}
|
||||
},
|
||||
"srvos": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719189969,
|
||||
"narHash": "sha256-6MSZrWvXSvUKIr0iC9eSbQ09NSm+j1Oh4o9Gentu1CU=",
|
||||
"owner": "numtide",
|
||||
"repo": "srvos",
|
||||
"rev": "4f314be1307c8d5f1fb3d882a67e09dbdf285850",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "srvos",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
53
nix/os/devices/hstk0/flake.nix
Normal file
53
nix/os/devices/hstk0/flake.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
get-flake.url = "github:ursi/get-flake";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager/release-24.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
disko.url = "github:nix-community/disko";
|
||||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||
srvos.url = "github:numtide/srvos";
|
||||
srvos.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# outputs = _: {};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
get-flake,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
system = "x86_64-linux";
|
||||
nodeName = "hostkey-0";
|
||||
|
||||
mkNixosConfiguration = {extraModules ? [], ...} @ attrs:
|
||||
nixpkgs.lib.nixosSystem (
|
||||
nixpkgs.lib.attrsets.recursiveUpdate
|
||||
attrs
|
||||
{
|
||||
specialArgs = {
|
||||
nodeFlake = self;
|
||||
repoFlake = get-flake ../../../..;
|
||||
inherit nodeName;
|
||||
};
|
||||
|
||||
modules =
|
||||
[
|
||||
./configuration.nix
|
||||
]
|
||||
++ extraModules;
|
||||
}
|
||||
);
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
native = mkNixosConfiguration {
|
||||
inherit system;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue