5 Commits

Author SHA1 Message Date
47f665b742 Add Raspberry Pi 4 host 2023-12-16 23:47:43 +00:00
26be10bd0c Enable autoUpgrade 2023-12-16 20:21:26 +00:00
aa5a4e27a3 Migrate secrets to separate repo 2023-12-16 18:39:00 +00:00
f9cf5758e3 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/781e2a9797ecf0f146e81425c822dca69fe4a348' (2023-12-10)
  → 'github:NixOS/nixpkgs/cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7' (2023-12-12)
2023-12-14 20:02:56 +00:00
f0e0cf2772 Refactor deprecated borgmatic.settings.location 2023-12-11 23:39:09 +00:00
10 changed files with 202 additions and 38 deletions

45
flake.lock generated
View File

@@ -86,11 +86,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1702195709, "lastModified": 1702676849,
"narHash": "sha256-+zRjWkm5rKqQ57PuLZ3JF3xi3vPMiOJzItb1m/43Cq4=", "narHash": "sha256-XqcREaTS38/QOsN8fk8PP325/UXHyF9enbP5ZPw5aiA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6761b8188b860f374b457eddfdb05c82eef9752f", "rev": "aa99c2f4e9847cbb7e46fac0844ea1eb164b3b3a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -100,6 +100,21 @@
"type": "github" "type": "github"
} }
}, },
"nixos-hardware": {
"locked": {
"lastModified": 1702453208,
"narHash": "sha256-0wRi9SposfE2wHqjuKt8WO2izKB/ASDOV91URunIqgo=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "7763c6fd1f299cb9361ff2abf755ed9619ef01d6",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1677676435, "lastModified": 1677676435,
@@ -118,11 +133,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1702233072, "lastModified": 1702346276,
"narHash": "sha256-H5G2wgbim2Ku6G6w+NSaQaauv6B6DlPhY9fMvArKqRo=", "narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "781e2a9797ecf0f146e81425c822dca69fe4a348", "rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -136,10 +151,28 @@
"agenix": "agenix", "agenix": "agenix",
"firefox-gnome-theme": "firefox-gnome-theme", "firefox-gnome-theme": "firefox-gnome-theme",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"secrets": "secrets",
"thunderbird-gnome-theme": "thunderbird-gnome-theme" "thunderbird-gnome-theme": "thunderbird-gnome-theme"
} }
}, },
"secrets": {
"flake": false,
"locked": {
"lastModified": 1702750793,
"narHash": "sha256-w4ajlpX4k+9HBgmRhMaWMfHsNEs1M4ncKtJGXZcHqe8=",
"ref": "refs/heads/master",
"rev": "08e2b6b214e43e8bf3b3db9b7819fd27a1038c86",
"revCount": 1,
"type": "git",
"url": "ssh://git@git.vimium.com/jordan/nix-secrets.git"
},
"original": {
"type": "git",
"url": "ssh://git@git.vimium.com/jordan/nix-secrets.git"
}
},
"thunderbird-gnome-theme": { "thunderbird-gnome-theme": {
"flake": false, "flake": false,
"locked": { "locked": {

View File

@@ -12,13 +12,18 @@
url = "github:rafaelmardojai/firefox-gnome-theme"; url = "github:rafaelmardojai/firefox-gnome-theme";
flake = false; flake = false;
}; };
nixos-hardware.url = "github:NixOS/nixos-hardware";
secrets = {
url = "git+ssh://git@git.vimium.com/jordan/nix-secrets.git";
flake = false;
};
thunderbird-gnome-theme = { thunderbird-gnome-theme = {
url = "github:rafaelmardojai/thunderbird-gnome-theme"; url = "github:rafaelmardojai/thunderbird-gnome-theme";
flake = false; flake = false;
}; };
}; };
outputs = inputs @ { self, nixpkgs, agenix, home-manager, ... }: outputs = inputs @ { self, nixpkgs, agenix, home-manager, nixos-hardware, secrets, ... }:
let let
nixpkgsForSystem = system: inputs.nixpkgs; nixpkgsForSystem = system: inputs.nixpkgs;
overlays = [ overlays = [
@@ -30,7 +35,7 @@
home-manager.nixosModule home-manager.nixosModule
./modules ./modules
]; ];
nixosSystem = system: name: nixosSystem = { system, name, extraModules ? [] }:
let let
nixpkgs = nixpkgsForSystem system; nixpkgs = nixpkgsForSystem system;
lib = (import nixpkgs { inherit overlays system; }).lib; lib = (import nixpkgs { inherit overlays system; }).lib;
@@ -52,15 +57,17 @@
}; };
}) })
./hosts/${name} ./hosts/${name}
]; ] ++ extraModules;
}; };
nixosConfigurations = {
atlas = nixosSystem "x86_64-linux" "atlas";
eos = nixosSystem "x86_64-linux" "eos";
helios = nixosSystem "x86_64-linux" "helios";
odyssey = nixosSystem "x86_64-linux" "odyssey";
};
in in
{ inherit nixosConfigurations; }; {
nixosConfigurations = {
atlas = nixosSystem { system = "x86_64-linux"; name = "atlas"; };
eos = nixosSystem { system = "x86_64-linux"; name = "eos"; };
helios = nixosSystem { system = "x86_64-linux"; name = "helios"; };
odyssey = nixosSystem { system = "x86_64-linux"; name = "odyssey"; };
pi = nixosSystem { system = "aarch64-linux"; name = "pi"; extraModules = [ nixos-hardware.nixosModules.raspberry-pi-4 ]; };
};
};
} }

View File

@@ -44,6 +44,12 @@
neovim neovim
]; ];
system.autoUpgrade = {
enable = true;
flake = "git+ssh://git@git.vimium.com/jordan/nix-config.git";
randomizedDelaySec = "10min";
};
nix = { nix = {
settings = { settings = {
connect-timeout = 5; connect-timeout = 5;

View File

@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, inputs, ... }:
{ {
imports = [ imports = [
@@ -50,23 +50,21 @@
}; };
}; };
age.secrets."odyssey_borg_passphrase" = { age.secrets."odyssey-passphrase" = {
file = ../../secrets/odyssey_borg_passphrase.age; file = "${inputs.secrets}/passwords/services/borg/odyssey-passphrase.age";
}; };
services.borgmatic = { services.borgmatic = {
enable = true; enable = true;
settings = { settings = {
location = { source_directories = [
source_directories = [ "/home/jordan/Documents"
"/home/jordan/Documents" ];
]; repositories = [
repositories = [ { label = "borgbase"; path = "ssh://iqwu22oq@iqwu22oq.repo.borgbase.com/./repo"; }
"ssh://iqwu22oq@iqwu22oq.repo.borgbase.com/./repo" ];
];
};
storage = { storage = {
encryption_passcommand = "cat ${config.age.secrets.odyssey_borg_passphrase.path}"; encryption_passcommand = "cat ${config.age.secrets.odyssey-passphrase.path}";
ssh_command = "ssh -i /etc/ssh/ssh_host_ed25519_key"; ssh_command = "ssh -i /etc/ssh/ssh_host_ed25519_key";
}; };
retention = { retention = {

18
hosts/pi/README.md Normal file
View File

@@ -0,0 +1,18 @@
# Pi
## Overview
Raspberry Pi 4
## Specs
* SoC - Broadcom BCM2711
* CPU - ARM Cortex-A72 @ 1.8 GHz
* Memory - 8 GB LPDDR4
### Disks
Device | Partitions _(filesystem, usage)_
--- | ---
SD card | `/dev/sda1` (ext4, NixOS Root)
### Networks
- DHCP on `10.0.1.0/24` subnet.
- Tailscale on `100.64.0.0/10` subnet. FQDN: `pi.mesh.vimium.net`.

79
hosts/pi/default.nix Normal file
View File

@@ -0,0 +1,79 @@
{ config, lib, pkgs, inputs, ... }:
{
imports = [
./hardware-configuration.nix
../server.nix
];
networking.hostId = "731d1660";
hardware = {
raspberry-pi."4" = {
apply-overlays-dtmerge.enable = true;
audio.enable = false;
fkms-3d.enable = true;
xhci.enable = true;
};
deviceTree = {
enable = true;
overlays = [
{ name = "hifiberry-digi-pro"; dtboFile = "${pkgs.device-tree_rpi.overlays}/hifiberry-digi-pro.dtbo"; }
];
};
firmware = with pkgs; [
firmwareLinuxNonfree
wireless-regdb
];
};
sound.enable = true;
console.enable = false;
age.secrets."passwords/networks.age" = {
file = "${inputs.secrets}/passwords/networks.age";
};
networking = {
wireless = {
enable = true;
interfaces = [ "wlan0" ];
environmentFile = config.age.secrets."passwords/networks.age".path;
networks = {
"Apollo 600 Mbps".psk = "@PSK_APOLLO@";
};
};
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
systemWide = true;
};
services.shairport-sync = {
enable = true;
group = "pipewire";
openFirewall = true;
};
services.zigbee2mqtt = {
enable = true;
settings = {
homeassistant = true;
frontend = true;
permit_join = true;
};
};
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
system.stateVersion = "22.11";
}

View File

@@ -0,0 +1,31 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
];
boot = {
# Stop ZFS kernel being built
supportedFilesystems = lib.mkForce [ "btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs" ];
tmp.cleanOnBoot = true;
};
# Fix missing modules
# https://github.com/NixOS/nixpkgs/issues/154163
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
}

View File

@@ -18,6 +18,8 @@
console.keyMap = "uk"; console.keyMap = "uk";
documentation.enable = false;
services.openssh = { services.openssh = {
enable = true; enable = true;
settings = { settings = {

View File

@@ -1,10 +0,0 @@
let
jordan = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILVHTjsyMIV4THNw6yz0OxAxGnC+41gX72UrPqTzR+OS";
users = [ jordan ];
odyssey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJre8/cjdoUnbTu0x4ClTITcq4lq+FjpEyJBbLbOlox7";
systems = [ odyssey ];
in
{
"secrets/odyssey_borg_passphrase.age".publicKeys = [ jordan odyssey ];
}

Binary file not shown.