Add arch to hosts, share host config with flake.
This commit is contained in:
parent
aaf5391557
commit
c02318ca00
|
@ -1,16 +1,8 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
is-nix-file = filename: type: (builtins.match ".+\.nix$" filename) != null;
|
||||
is-regular-file = filename: type: type == "regular" || type == "link";
|
||||
hostname-from-file = filename: builtins.replaceStrings [".nix"] [""] filename;
|
||||
|
||||
host-files = attrNames (filterAttrs is-nix-file (filterAttrs is-regular-file (builtins.readDir ./hosts)));
|
||||
hosts = map hostname-from-file host-files;
|
||||
syslib = pkgs.callPackage ../lib/hosts.nix {};
|
||||
|
||||
load-host-file = hostname: import (./. + "/hosts/${hostname}.nix");
|
||||
|
||||
in {
|
||||
config.fudo.hosts = genAttrs hosts (hostname: load-host-file hostname);
|
||||
config.fudo.hosts = syslib.base-host-config ./hosts;
|
||||
}
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
domain = "sea.fudo.org";
|
||||
site = "seattle";
|
||||
profile = "laptop";
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
profile = "server";
|
||||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB07Jf/NB4OlFSEI/eLJlNLA2sM9cHw1hX43r43nQ7a5";
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -15,4 +15,6 @@
|
|||
profile = "desktop";
|
||||
ssh-pubkey =
|
||||
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPqyDT/JqTxWZbpOXzy1Sxba2z2hNzt2BqjLspPvJLVc9zks1GMlnKAY5Nb7y7oi+CzeZMU+KAa069wZ/mYvpas=";
|
||||
arch = "x86_64-linux";
|
||||
nixos-system = false;
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
profile = "server";
|
||||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1COad5NSK3mi66WK5uWf79NLMf5rk350kvJGsEdDmn";
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPB5JY6jnHCRLxjqWKYkK8Xpmfyq2nA+0noPazYGd9a+";
|
||||
enable-gui = false;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMqymGZ5dI6ChI1Qx1QfjBo/h0+xFwpRx/wQSDxWQprI";
|
||||
tmp-on-tmpfs = false;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
profile = "server";
|
||||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHT8Uf6m8ZrSn4nmPyIO+JWLbgXJGX4jJTk0wfqDzzjb";
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -17,4 +17,5 @@
|
|||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDMPjwpcktL0Rhjc/D3ZmzwkSRqSJX5TGjMXVstpg8nNqQQrj9DxPq7gV4a+1LxMtQGPUv4gYx7De1a5LMVk8u6qJJnaLlt3TB1e1SUCBxxeh5sWIY5BMx8Q0/aRTkyTchyczX6FX0LXM7FP6yvxZVZSn2WHRp7REr8G1PUAwuIGy2a4bKOUSh5Uj4riXFXnROW2mp1vUfe5oH4X5HP3ACCXWRVUFdqDt1ldcrqqi+7/8x2G1eOHJcQ7B5FdL3uuq0nBrUzFQTt6KCHy0C2Jc3DFwOS1+ZdGKZpao+/arh/fH+LQfMUePx/AQOkYrJwvuRwbxg8XmlZ89u2gyDuqapzjBmsu+wyd5pF2QglyTRZW9Ijy1NTuzduPm6wgqN0Q09evFJvM9ZjShcIY3xTcCGDxpwTeYgMVXMF79sV9u+JwCSBpaIyteIJ7M/J/NWmaKoUF6Ia9mNts889Ba9TKzQFek19KYetOB2hfXV+7bvXrH+OBppzpdrztJFavBceQTs="
|
||||
];
|
||||
tmp-on-tmpfs = false;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -15,4 +15,6 @@
|
|||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKEsvl1mTSWJJrqXbYrc8wYdlOiW5gNg4Nzf2QCxB6XW";
|
||||
tmp-on-tmpfs = false;
|
||||
enable-gui = false;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -3,4 +3,6 @@
|
|||
site = "seattle";
|
||||
profile = "laptop";
|
||||
domain = "sea.fudo.org";
|
||||
arch = "x86_64-linux";
|
||||
nixos-system = false;
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
ssh-pubkey =
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP4TqqumZwSDLkg8cTpR734zM+nuqEp1ufaQPoFdqCab";
|
||||
tmp-on-tmpfs = false;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
domain = "sea.fudo.org";
|
||||
site = "seattle";
|
||||
android-dev = true;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
domain = "sea.fudo.org";
|
||||
site = "seattle";
|
||||
android-dev = true;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -13,4 +13,6 @@
|
|||
site = "russell";
|
||||
domain = "rus.selby.ca";
|
||||
profile = "desktop";
|
||||
arch = "x86_64-linux";
|
||||
nixos-system = false;
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
domain = "sea.fudo.org";
|
||||
site = "seattle";
|
||||
android-dev = true;
|
||||
arch = "x86_64-linux";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1631573611,
|
||||
"narHash": "sha256-u2E/wstadWNcn6vOIoK1xY86QPOzzBZQfT1FbePfdaI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "7d9ba15214004c979d2c8733f8be12ce6502cf8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-21.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1632291606,
|
||||
"narHash": "sha256-oEN24XJYAFK9tsD13TzLEizpgQigEfgC6i9x1b/1pVU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "83413f47809790e4ca012e314e7782adeae36cf2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-21.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
description = "Fudo Host Configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-21.05";
|
||||
home-manager.url = "github:nix-community/home-manager/release-21.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }: {
|
||||
|
||||
nixosConfigurations = let
|
||||
hostlib = import ./lib/hosts.nix { lib = nixpkgs.lib; };
|
||||
hosts = hostlib.base-host-config ./config/hosts;
|
||||
in nixpkgs.lib.mapAttrs (hostname: hostOpts: let
|
||||
pkgs = import nixpkgs {
|
||||
system = hostOpts.arch;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
"openssh-with-gssapi-8.4p1"
|
||||
];
|
||||
};
|
||||
overlays = [
|
||||
(import ./fudo-pkgs/overlay.nix)
|
||||
];
|
||||
};
|
||||
in import ./initialize.nix {
|
||||
inherit hostname pkgs;
|
||||
home-manager-module = import "${home-manager}/nixos";
|
||||
include-secrets = true;
|
||||
}) hosts;
|
||||
};
|
||||
}
|
|
@ -149,7 +149,6 @@ let
|
|||
arch = mkOption {
|
||||
type = str;
|
||||
description = "System architecture of the system.";
|
||||
default = "x86_64-linux";
|
||||
};
|
||||
|
||||
android-dev = mkEnableOption "Enable ADB on the host.";
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
base-host-config = host-path: let
|
||||
hostname-from-file = filename: builtins.replaceStrings [".nix"] [""] filename;
|
||||
|
||||
is-nix-file = filename: type: (builtins.match ".+\.nix$" filename) != null;
|
||||
is-regular-file = filename: type: type == "regular" || type == "link";
|
||||
|
||||
host-files = attrNames (filterAttrs is-nix-file (filterAttrs is-regular-file (builtins.readDir host-path)));
|
||||
hosts = map hostname-from-file host-files;
|
||||
|
||||
load-host-file = hostname: import (./. + "/hosts/${hostname}.nix");
|
||||
in genAttrs hosts (hostname: load-host-file hostname);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
|
2
nix-home
2
nix-home
|
@ -1 +1 @@
|
|||
Subproject commit 3f509d08290003c27c51049a8f04e076a79570b7
|
||||
Subproject commit dcab43275a732e9a3e3c66c9a92132b4290838d3
|
Loading…
Reference in New Issue