Skip to content

Commit

Permalink
host: refactor import
Browse files Browse the repository at this point in the history
  • Loading branch information
ocfox committed Sep 30, 2024
1 parent 61f2ef2 commit 9cfda0b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 169 deletions.
2 changes: 2 additions & 0 deletions hosts/civet/networking.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
firewall.allowedTCPPorts = [
80
443
7096
11283
];

firewall.allowedUDPPorts = [
Expand Down
174 changes: 41 additions & 133 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,151 +7,59 @@
...
}:
let
whitefox-module =
genConf =
host:
{ pkgs, username, ... }@args:
inputs.haumea.lib.load {
src = ./whitefox;
src = ./${host};
inputs = args // {
inherit inputs;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};

# silverfox-module =
# { pkgs, username, ... }@args:
# inputs.haumea.lib.load {
# src = ./silverfox;
# inputs = args // {
# inherit inputs;
# };
# transformer = inputs.haumea.lib.transformers.liftDefault;
# };

arcticfox-module =
{ pkgs, username, ... }@args:
inputs.haumea.lib.load {
src = ./arcticfox;
inputs = args // {
inherit inputs;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};

redfox-module =
{ pkgs, username, ... }@args:
inputs.haumea.lib.load {
src = ./redfox;
inputs = args // {
inherit inputs;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};

civet-module =
{ pkgs, ... }@args:
inputs.haumea.lib.load {
src = ./civet;
inputs = args // {
inherit inputs;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};

sakhalin-module =
{ pkgs, ... }@args:
inputs.haumea.lib.load {
src = ./sakhalin;
inputs = args // {
inherit inputs;
genNixosSystem = host: system: modules: {
"${host}" = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(genConf "${host}")
] ++ modules;
specialArgs = {
inherit inputs username home;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};

vulpes-module =
{ pkgs, ... }@args:
inputs.haumea.lib.load {
src = ./vulpes;
inputs = args // {
inherit inputs;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};
in
{
whitefox = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./whitefox/_hardware.nix
whitefox-module
inputs.home-manager.nixosModules.home-manager
inputs.minegrub.nixosModules.default
inputs.agenix.nixosModules.default
inputs.niri.nixosModules.niri
inputs.self.nixosModules.default
{ nix.registry.self.flake = self; }
];
specialArgs = {
inherit inputs username home;
};
};

civet = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
inputs.disko.nixosModules.disko
inputs.nixos-facter.nixosModules.facter
civet-module
];
specialArgs = {
inherit inputs;
};
};
inherit (nixpkgs.lib) mkMerge;
in
mkMerge [
(genNixosSystem "whitefox" "x86_64-linux" [
./whitefox/_hardware.nix
inputs.home-manager.nixosModules.home-manager
inputs.minegrub.nixosModules.default
inputs.agenix.nixosModules.default
inputs.niri.nixosModules.niri
inputs.self.nixosModules.default
{ nix.registry.self.flake = self; }
])

arcticfox = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./arcticfox/_hardware.nix
arcticfox-module
inputs.home-manager.nixosModules.home-manager
inputs.agenix.nixosModules.default
{ nix.registry.self.flake = self; }
];
specialArgs = {
inherit inputs username home;
};
};
(genNixosSystem "civet" "x86_64-linux" [
inputs.disko.nixosModules.disko
inputs.nixos-facter.nixosModules.facter
])

redfox = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./redfox/_hardware.nix
inputs.disko.nixosModules.disko
redfox-module
];
specialArgs = {
inherit inputs;
};
};
(genNixosSystem "redfox" "x86_64-linux" [
./redfox/_hardware.nix
inputs.disko.nixosModules.disko
])

sakhalin = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./sakhalin/_hardware.nix
sakhalin-module
];
specialArgs = {
inherit inputs;
};
};
(genNixosSystem "arcticfox" "x86_64-linux" [
./arcticfox/_hardware.nix
inputs.home-manager.nixosModules.home-manager
inputs.agenix.nixosModules.default
{ nix.registry.self.flake = self; }
])

vulpes = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./vulpes/_hardware.nix
vulpes-module
];
specialArgs = {
inherit inputs;
};
};
}
(genNixosSystem "vulpes" "x86_64-linux" [
./vulpes/_hardware.nix
])
]
36 changes: 0 additions & 36 deletions hosts/whitefox/services.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,6 @@
getty.autologinUser = username;
devmon.enable = true;

home-assistant = {
enable = true;
customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [
mini-graph-card
];

lovelaceConfig = {
title = "My Awesome Home";
views = [
{
title = "Ele";
cards = [
{
type = "custom:mini-graph-card";
entities = [
{
entity = "sensor.last_electricity_usage";
name = "每日用电量";
aggregate_func = "first";
show_state = true;
show_points = true;
}
];
group_by = "date";
hour24 = true;
hours_to_show = 240;
}
];
}
];
};
config = {
default_config = { };
};
};

tailscale.enable = true;

openssh.enable = true;
Expand Down

0 comments on commit 9cfda0b

Please sign in to comment.