Unnest machines to top-level.

main
Joshua Potter 2023-12-08 12:07:54 -07:00
parent c983540f82
commit ea9d99b2a9
41 changed files with 421 additions and 172 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
hardware-configuration.nix

View File

@ -1,44 +0,0 @@
{
description = "NixOS Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
bootstrap = {
url = "github:jrpotter/bootstrap/v0.1.2";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, bootstrap, home-manager, ... }:
let
system = "x86_64-linux";
in
{
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.jrpotter = import ./jrpotter;
# Used to pass non-default parameters to submodules.
extraSpecialArgs = {
inherit system;
bootstrap = bootstrap.packages.${system}.default;
};
};
}
];
};
};
}

282
flake.lock Normal file
View File

@ -0,0 +1,282 @@
{
"nodes": {
"boardwise": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1701963345,
"narHash": "sha256-ObPo2TtW4JqhpjR/bzuGDPvcQp21ykImi5DYD7gKg4Q=",
"owner": "boardwise-gg",
"repo": "website",
"rev": "0eca8e5f5f9cf1b4c12c1d50e851dad94b33c0a9",
"type": "github"
},
"original": {
"owner": "boardwise-gg",
"ref": "v0.1.0",
"repo": "website",
"type": "github"
}
},
"bootstrap": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"framework",
"nixpkgs"
]
},
"locked": {
"lastModified": 1701362005,
"narHash": "sha256-YueE+a2t54o41flddLpOlz3O6XZtSlaQyQVn909k4R4=",
"owner": "jrpotter",
"repo": "bootstrap",
"rev": "383ada86616194d8bf66b9646ec601f84c6add05",
"type": "github"
},
"original": {
"owner": "jrpotter",
"ref": "v0.1.2",
"repo": "bootstrap",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_2": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"framework": {
"inputs": {
"bootstrap": "bootstrap",
"home-manager": "home-manager",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1,
"narHash": "sha256-El3RJD5VwflvBxsxtzx3V7rz96G8JxgN9UWi2hxw9Mo=",
"path": "./framework",
"type": "path"
},
"original": {
"path": "./framework",
"type": "path"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"framework",
"nixpkgs"
]
},
"locked": {
"lastModified": 1699748081,
"narHash": "sha256-MOmMapBydd7MTjhX4eeQZzKlCABWw8W6iSHSG4OeFKE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "04bac349d585c9df38d78e0285b780a140dc74a4",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1701615100,
"narHash": "sha256-7VI84NGBvlCTduw2aHLVB62NvCiZUlALLqBe5v684Aw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9f06adb793d1cca5384907b3b8a4071d5d7cb19",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1701568804,
"narHash": "sha256-iwr1fjOCvlirVL/xNvOTwY9kg3L/F3TC/7yh/QszaPI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dc01248a9c946953ad4d438b0a626f5c987a93e4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1700794826,
"narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"phobos": {
"inputs": {
"boardwise": "boardwise",
"nixpkgs": [
"nixpkgs"
],
"sops-nix": "sops-nix"
},
"locked": {
"lastModified": 1,
"narHash": "sha256-/ZJi6zwrTNAJihWJDtLqmvnJEoZFXI2BqVesNqLP1xM=",
"path": "./phobos",
"type": "path"
},
"original": {
"path": "./phobos",
"type": "path"
}
},
"root": {
"inputs": {
"framework": "framework",
"nixpkgs": "nixpkgs",
"phobos": "phobos"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"phobos",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1701728052,
"narHash": "sha256-7lOMc3PtW5a55vFReBJLLLOnopsoi1W7MkjJ93jPV4E=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "e91ece6d2cf5a0ae729796b8f0dedceab5107c3d",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

42
flake.nix Normal file
View File

@ -0,0 +1,42 @@
{
description = "Colmena hive configuration.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
framework = {
url = "path:./framework";
inputs.nixpkgs.follows = "nixpkgs";
};
phobos = {
url = "path:./phobos";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, framework, phobos, ... }:
let
system = "x86_64-linux";
in
{
colmena = {
meta = {
nixpkgs = import nixpkgs { inherit system; };
specialArgs = { inherit system; };
};
# Local machines. Deploy using `colmena apply-local [--sudo]`
framework = {
imports = [ framework.nixosModules.default ];
deployment = {
allowLocalDeployment = true;
targetHost = null; # Disable SSH deployment.
};
};
# Remote machines. Deploy using `colmena apply`
phobos = phobos.nixosModules.default;
};
};
}

View File

@ -59,7 +59,7 @@
hardware.bluetooth.enable = true;
networking.hostName = "nixos";
networking.hostName = "framework";
networking.networkmanager.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];

39
framework/flake.nix Normal file
View File

@ -0,0 +1,39 @@
{
description = "Local machine - framework";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
bootstrap = {
url = "github:jrpotter/bootstrap/v0.1.2";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { bootstrap, home-manager, ... }: {
nixosModules.default = { pkgs, system, ... }:
let
jrpotter-home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.jrpotter = import ./jrpotter;
# Used to pass non-default parameters to submodules.
extraSpecialArgs = {
inherit system;
bootstrap = bootstrap.packages.${system}.default;
};
};
in
{
imports = [
./configuration.nix
home-manager.nixosModules.home-manager
{ home-manager = jrpotter-home-manager; }
];
};
};
}

View File

@ -0,0 +1,38 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/cb6f7cbc-f3a1-4347-8193-9047090d8ee1";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/DED1-6712";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp170s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -1,33 +0,0 @@
{
description = "Configuration of all remote NixOS machines.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
phobos = {
url = "path:./phobos";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, phobos, sops-nix, ... }:
let
system = "x86_64-linux";
in
{
colmena = {
meta = {
nixpkgs = import nixpkgs {
inherit system;
};
specialArgs = { inherit system; };
};
# Remote machines
phobos = phobos.nixosModules.default;
};
};
}

View File

@ -1,27 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1701615100,
"narHash": "sha256-7VI84NGBvlCTduw2aHLVB62NvCiZUlALLqBe5v684Aw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9f06adb793d1cca5384907b3b8a4071d5d7cb19",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -4,10 +4,7 @@
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"phobos",
"nixpkgs"
]
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1701963345,
@ -58,16 +55,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1701952659,
"narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=",
"lastModified": 1700794826,
"narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4",
"rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -88,52 +85,32 @@
"type": "github"
}
},
"nixpkgs-stable_2": {
"nixpkgs_2": {
"locked": {
"lastModified": 1701568804,
"narHash": "sha256-iwr1fjOCvlirVL/xNvOTwY9kg3L/F3TC/7yh/QszaPI=",
"lastModified": 1701615100,
"narHash": "sha256-7VI84NGBvlCTduw2aHLVB62NvCiZUlALLqBe5v684Aw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dc01248a9c946953ad4d438b0a626f5c987a93e4",
"rev": "e9f06adb793d1cca5384907b3b8a4071d5d7cb19",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.05",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"phobos": {
"inputs": {
"boardwise": "boardwise",
"nixpkgs": [
"nixpkgs"
],
"sops-nix": "sops-nix"
},
"locked": {
"lastModified": 1,
"narHash": "sha256-eJcRqFATORPXB3PXPLiR+5lAJDNiEK+SbpdBkBcS3G8=",
"path": "./phobos",
"type": "path"
},
"original": {
"path": "./phobos",
"type": "path"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"phobos": "phobos",
"sops-nix": "sops-nix_2"
"boardwise": "boardwise",
"nixpkgs": "nixpkgs_2",
"sops-nix": "sops-nix"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"phobos",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
@ -152,27 +129,6 @@
"type": "github"
}
},
"sops-nix_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1701728052,
"narHash": "sha256-7lOMc3PtW5a55vFReBJLLLOnopsoi1W7MkjJ93jPV4E=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "e91ece6d2cf5a0ae729796b8f0dedceab5107c3d",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,

View File

@ -1,11 +1,10 @@
{
description = "Phobos machine";
description = "Remote machine - phobos";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
boardwise = {
url = "github:boardwise-gg/website/v0.1.0";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
@ -20,13 +19,7 @@
sops-nix.nixosModules.sops
];
sops.defaultSopsFile = ./secrets.yaml;
sops.secrets.example-key = {};
sops.secrets."myservice/my_subdir/my_secret" = {};
deployment = {
targetHost = "146.190.127.180";
};
deployment.targetHost = "146.190.127.180";
networking = {
hostName = "phobos";
@ -55,6 +48,10 @@
};
};
sops.defaultSopsFile = ./secrets.yaml;
sops.secrets.example-key = {};
sops.secrets."myservice/my_subdir/my_secret" = {};
system.stateVersion = "23.11";
};
};