Represent remote machines as flake.

main
Joshua Potter 2023-12-07 17:13:57 -07:00
parent ce190bb139
commit 9c083e3a41
7 changed files with 85 additions and 31 deletions

View File

@ -10,13 +10,11 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
};
outputs = { self, nixpkgs, home-manager, bootstrap, ... }:
outputs = { nixpkgs, home-manager, bootstrap, ... }:
let
system = "x86_64-linux";
in
{
# Used with `nixos-rebuild --flake .#<hostname>`
# nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
inherit system;
# Modules can be attribute sets or a function that returns an attribute set.

View File

@ -15,8 +15,7 @@
];
system.stateVersion = "23.11";
};
in
{
in {
packages.${system}.default = (pkgs.nixos module).digitalOceanImage;
};
}

View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1701802827,
"narHash": "sha256-wTn0lpV75Uv6tU6haEypNsmnJJPb0hpaMIy/4uf5AiQ=",
"lastModified": 1701952659,
"narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a804fc878d7ba1558b960b4c64b0903da426ac41",
"rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4",
"type": "github"
},
"original": {
@ -16,9 +16,27 @@
"type": "github"
}
},
"phobos": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1,
"narHash": "sha256-D7vDC0Qph0MikxxgIlCNduD1o7QfQQO5SRtGLAVwywg=",
"path": "./phobos",
"type": "path"
},
"original": {
"path": "./phobos",
"type": "path"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"phobos": "phobos"
}
}
},

View File

@ -2,11 +2,14 @@
description = "Configuration of all remote NixOS machines.";
inputs = {
phobos = {
url = "path:./phobos";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs = { nixpkgs, ... }:
{
outputs = { nixpkgs, phobos, ... }: {
colmena = {
meta = {
nixpkgs = import nixpkgs {
@ -15,7 +18,7 @@
};
# Remote machines
phobos = (import ./phobos.nix);
phobos = phobos.nixosModules.default;
};
};
}

View File

@ -1,12 +0,0 @@
{ modulesPath, lib, ... }:
{
imports = lib.optional (builtins.pathExists ./do-userdata.nix) ./do-userdata.nix ++ [
(modulesPath + "/virtualisation/digital-ocean-config.nix")
];
deployment.targetHost = "146.190.127.180";
networking.hostName = "phobos";
system.stateVersion = "23.11";
}

27
hive/phobos/flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"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
}

21
hive/phobos/flake.nix Normal file
View File

@ -0,0 +1,21 @@
{
description = "Phobos machine";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
};
outputs = { nixpkgs, ... }: {
nixosModules.default = { modulesPath, lib, ... }: {
imports = lib.optional (builtins.pathExists ./do-userdata.nix) ./do-userdata.nix ++ [
(modulesPath + "/virtualisation/digital-ocean-config.nix")
];
deployment.targetHost = "146.190.127.180";
networking.hostName = "phobos";
system.stateVersion = "23.11";
};
};
}