feat: nixcloud config

This commit is contained in:
Thiago Sposito 2025-10-17 18:13:29 -03:00
parent 634d7eb2e8
commit 959af7690d
Signed by: thiago
GPG key ID: 3065EA73A976D430
12 changed files with 113 additions and 152 deletions

View file

@ -6,20 +6,35 @@
...
}:
{
imports = [ ./users/nimbus/default.nix ];
boot.loader.systemd-boot.enable = true;
nixpkgs.overlays = [
(final: prev: {
libnitrokey = prev.libnitrokey.overrideAttrs (old: {
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
];
});
})
imports = [
./hardware-configuration.nix
./networking.nix
];
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
networking.hostName = "srv1065175";
networking.domain = "hstgr.cloud";
services.openssh.enable = true;
users.users = {
root.openssh.authorizedKeys.keyFiles = [
(builtins.fetchurl {
url = "https://meta.sr.ht/~sposito.keys";
name = "sposito-srht-keys";
sha256 = "1mf76x36kd1iaccy6l5f5xnbjqkm1fwf9giws9nb3bvgmj3c25wc";
})
];
nimbus.openssh.authorizedKeys.keys = [
(builtins.fetchurl {
url = "https://meta.sr.ht/~sposito.keys";
name = "sposito-srht-keys";
sha256 = "1mf76x36kd1iaccy6l5f5xnbjqkm1fwf9giws9nb3bvgmj3c25wc";
})
];
};
system.stateVersion = "23.11";
environment = {
shells = with pkgs; [ bash ];
etc = lib.mapAttrs' (name: value: {
@ -27,23 +42,7 @@
value.source = value.flake;
}) config.nix.registry;
systemPackages = with pkgs; [
ccid
exfat
file
fuse3
gcsfuse
git
gnupg
libnitrokey
libusb1
nix-ld
opensc
pciutils
pcsc-safenet
pcsclite
pcsctools
pkcs11helper
rclone
sops
wget
];
@ -63,7 +62,6 @@
};
};
nixpkgs.config.allowUnfree = true;
programs = {
gnupg = {
agent = {
@ -72,24 +70,6 @@
pinentryPackage = pkgs.pinentry-tty;
};
};
nix-ld = {
enable = true;
libraries = with pkgs; [
glibc
zlib
];
};
};
services = {
pcscd.enable = true;
# xserver.displayManager.sessionCommands =
# "${pkgs.xorg.xmodmap}/bin/xmodmap -e 'keycode 64 = Alt_L'";
udev.packages = [
pkgs.nitrokey-udev-rules
];
};
users.groups.scard = { };
time.timeZone = "America/Sao_Paulo";
}

View file

@ -1,9 +1,11 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
nixpkgs.hostPlatform = "x86_64-linux";
boot.loader.grub.device = "/dev/sda";
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
}

View file

@ -0,0 +1,54 @@
{ lib, ... }:
{
networking = {
nameservers = [
"45.143.83.10"
"1.1.1.1"
"8.8.4.4"
];
defaultGateway = "72.61.129.254";
defaultGateway6 = {
address = "2a02:4780:66::1";
interface = "eth0";
};
dhcpcd.enable = false;
usePredictableInterfaceNames = lib.mkForce false;
interfaces = {
eth0 = {
ipv4.addresses = [
{
address = "72.61.129.56";
prefixLength = 24;
}
];
ipv6.addresses = [
{
address = "2a02:4780:66:9ac0::1";
prefixLength = 48;
}
{
address = "fe80::9ce8:d4ff:feb5:50d7";
prefixLength = 64;
}
];
ipv4.routes = [
{
address = "72.61.129.254";
prefixLength = 32;
}
];
ipv6.routes = [
{
address = "2a02:4780:66::1";
prefixLength = 128;
}
];
};
};
};
services.udev.extraRules = ''
ATTR{address}=="9e:e8:d4:b5:50:d7", NAME="eth0"
'';
}

View file

@ -1,15 +0,0 @@
{ ... }: {
imports = [
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
];
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
networking.hostName = "srv1065175";
networking.domain = "hstgr.cloud";
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [''ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWstSULudWNwPQxyS2J7Qygw8CozDDy8WsPjsYzKPI9s0B/KLU0g1oX42bBvn4DgNpzGrpb6IGHpRQohStt7vcOxb9XpfhIOcIr45gU3k3lcPjh6vj8/ZoNQlRDIfxs83RDImvveYABuI/Hq42mLV1kI5qnQHaJxuW73AuYKNzE3Z3PUl5Kw6MgzSZ96QlpiQDn/js7ZTBF/YZ18kPh9E9O1y+EDhcJ4gn38rFIMYMG/KbJB22hYyYQHo0WkJlZ2jScnjv1op2yHPM4lfjOnnyL+LhOQLN8VrHayDWXtJcIW0nEKT+1R/7qkSH/5ELA2c/gznfkdTDzfG8+P3WAzNF openpgp:0xC25417F1 n3k0'' '''' ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICRAJaRuXqVeAs/Y5CeTbyc9lSbyvchkVqiML/yl6wbh thiago@Nixbook'' ];
system.stateVersion = "23.11";
}

View file

@ -1,35 +0,0 @@
{ lib, ... }: {
# This file was populated at runtime with the networking
# details gathered from the active system.
networking = {
nameservers = [ "45.143.83.10"
"1.1.1.1"
"8.8.4.4"
];
defaultGateway = "72.61.129.254";
defaultGateway6 = {
address = "2a02:4780:66::1";
interface = "eth0";
};
dhcpcd.enable = false;
usePredictableInterfaceNames = lib.mkForce false;
interfaces = {
eth0 = {
ipv4.addresses = [
{ address="72.61.129.56"; prefixLength=24; }
];
ipv6.addresses = [
{ address="2a02:4780:66:9ac0::1"; prefixLength=48; }
{ address="fe80::9ce8:d4ff:feb5:50d7"; prefixLength=64; }
];
ipv4.routes = [ { address = "72.61.129.254"; prefixLength = 32; } ];
ipv6.routes = [ { address = "2a02:4780:66::1"; prefixLength = 128; } ];
};
};
};
services.udev.extraRules = ''
ATTR{address}=="9e:e8:d4:b5:50:d7", NAME="eth0"
'';
}

View file

@ -1,44 +0,0 @@
{ pkgs, config, ... }:
let
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
in
{
users.users.nimbus = {
isNormalUser = true;
initialPassword = "changeme";
extraGroups = [
"fuse"
"networkmanager"
"scard"
"wheel"
]
++ ifTheyExist [
"docker"
"git"
"i2c"
"kvm"
"libvirt"
"libvirtd"
"photos"
"scanner"
"video"
"wireshark"
];
openssh.authorizedKeys.keyFiles = [
(builtins.fetchurl {
url = "https://meta.sr.ht/~sposito.keys";
name = "sposito-srht-keys";
sha256 = "1mf76x36kd1iaccy6l5f5xnbjqkm1fwf9giws9nb3bvgmj3c25wc";
})
];
packages = with pkgs; [
git
podman
podman-compose
nginx
];
};
}