Things
This commit is contained in:
parent
a2681cc220
commit
d1b74a5bf6
17 changed files with 675 additions and 74 deletions
26
hosts/archer/#default.nix#
Normal file
26
hosts/archer/#default.nix#
Normal file
|
@ -0,0 +1,26 @@
|
|||
{pkgs, ...}: {
|
||||
# $ nix-env -qaP | grep wget
|
||||
environment.systemPackages =
|
||||
[ pkgs.vim
|
||||
];
|
||||
|
||||
# # Auto upgrade nix package and the daemon service.
|
||||
# services.nix-daemon.enable = true;
|
||||
# # nix.package = pkgs.nix;
|
||||
|
||||
# # Necessary for using flakes on this system.
|
||||
# nix.settings.experimental-features = "nix-command flakes";
|
||||
|
||||
# # Create /etc/zshrc that loads the nix-darwin environment.
|
||||
# programs.zsh.enable = true; # default shell on catalina
|
||||
# # programs.fish.enable = true;
|
||||
|
||||
# # # Set Git commit hash for darwin-version.
|
||||
# # system.configurationRevision = self.rev or self.dirtyRev or null;
|
||||
|
||||
# # Used for backwards compatibility, please read the changelog before changing.
|
||||
# # $ darwin-rebuild changelog
|
||||
# system.stateVersion = 4;
|
||||
|
||||
# # The platform the configuration will be used on.
|
||||
}
|
13
hosts/archer/default.nix
Normal file
13
hosts/archer/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{pkgs, ...}: {
|
||||
environment.systemPackages = [
|
||||
pkgs.vim
|
||||
];
|
||||
|
||||
nix.settings.experimental-features = "nix-command flakes";
|
||||
|
||||
programs.fish.enable = true;
|
||||
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
nixpkgs.hostPlatform = "x86_64-darwin";
|
||||
}
|
|
@ -8,6 +8,9 @@
|
|||
imports = [./module.nix];
|
||||
|
||||
fleet = {
|
||||
darwinHosts.archer = {
|
||||
};
|
||||
|
||||
hosts = {
|
||||
# thinkpad = {
|
||||
# extraModules = with inputs; [
|
||||
|
@ -99,6 +102,7 @@
|
|||
};
|
||||
extraModules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.nixThePlanet.nixosModules.macos-ventura
|
||||
# inputs.hercules-ci-agent.nixosModules.agent-service
|
||||
];
|
||||
extraHmModules = [
|
||||
|
@ -117,7 +121,7 @@
|
|||
"autistici-password".owner = "ccr";
|
||||
"restic-hetzner-password" = {};
|
||||
"aws-credentials".owner = "hercules-ci-agent";
|
||||
"forgejo-runners-token".owner = "forgejo-runners";
|
||||
"forgejo-runners-token".owner = "nixuser";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -145,6 +149,7 @@
|
|||
"aws-credentials".owner = "hercules-ci-agent";
|
||||
"hass-ssh-key".owner = "hass";
|
||||
"matrix-registration-shared-secret".owner = "matrix-synapse";
|
||||
"matrix-sliding-sync-secret".owner = "matrix-synapse";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -161,4 +166,9 @@
|
|||
lib.mapAttrs
|
||||
config.fleet._mkNixosConfiguration
|
||||
config.fleet.hosts;
|
||||
|
||||
flake.darwinConfigurations =
|
||||
lib.mapAttrs
|
||||
config.fleet._mkDarwinConfiguration
|
||||
config.fleet.darwinHosts;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,46 @@
|
|||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
} @ flakePartsArgs: let
|
||||
cfg = config.fleet;
|
||||
in {
|
||||
options.fleet = {
|
||||
darwinHosts = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
description = "Host name";
|
||||
type = lib.types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
|
||||
default = name;
|
||||
};
|
||||
system = lib.mkOption {
|
||||
description = "NixOS architecture (a.k.a. system)";
|
||||
type = lib.types.str;
|
||||
default = "x86_64-darwin";
|
||||
};
|
||||
nixpkgs = lib.mkOption {
|
||||
description = "Used nixpkgs";
|
||||
type = lib.types.anything;
|
||||
default = inputs.nixpkgsUnstable;
|
||||
};
|
||||
extraModules = lib.mkOption {
|
||||
description = "Extra NixOS modules";
|
||||
type = lib.types.listOf lib.types.deferredModule;
|
||||
default = [];
|
||||
};
|
||||
overlays = lib.mkOption {
|
||||
description = "Enabled Nixpkgs overlays";
|
||||
type = lib.types.listOf (lib.mkOptionType {
|
||||
name = "nixpkgs-overlay";
|
||||
description = "nixpkgs overlay";
|
||||
check = lib.isFunction;
|
||||
merge = lib.mergeOneOption;
|
||||
});
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
hosts = lib.mkOption {
|
||||
description = "Host configuration";
|
||||
type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
|
||||
|
@ -183,8 +219,29 @@ in {
|
|||
fleetHmModules = builtins.map (moduleName: "${self.outPath}/hmModules/${moduleName}");
|
||||
fleetFlake = self;
|
||||
vpn = cfg.vpnExtra // (lib.mapAttrs (_: host: host.vpn) cfg.hosts);
|
||||
inherit (flakePartsArgs.config.allSystems.${config.system}.allModuleArgs.config._module.args) inputs';
|
||||
};
|
||||
};
|
||||
};
|
||||
_mkDarwinConfiguration = lib.mkOption {
|
||||
description = "Function returning a proper Darwin configuration";
|
||||
type = lib.types.functionTo (lib.types.functionTo lib.types.attrs); # TODO improve this type
|
||||
internal = true;
|
||||
default = hostname: config:
|
||||
inputs.nixDarwin.lib.darwinSystem {
|
||||
modules = [
|
||||
({
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
networking.hostName = lib.mkForce hostname;
|
||||
nixpkgs.overlays = config.overlays;
|
||||
nixpkgs.hostPlatform = config.system;
|
||||
})
|
||||
"${self.outPath}/hosts/${hostname}"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
"syncthing"
|
||||
"hass-poweroff"
|
||||
"forgejo-runners"
|
||||
"teamviewer"
|
||||
"macos-ventura"
|
||||
]
|
||||
++ [
|
||||
./disko.nix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue