Skip to content

Commit

Permalink
feat: swap to easy-hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed Jan 2, 2025
1 parent 1315e05 commit 914aa7a
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 297 deletions.
16 changes: 16 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@
inputs.nixpkgs-lib.follows = "nixpkgs";
};

easy-hosts = {
type = "github";
owner = "isabelroses";
repo = "easy-hosts";

# url = "git+file:/Users/isabel/dev/easy-hosts";
};

### Flake management
# deploy systems remotely
deploy-rs = {
Expand Down
164 changes: 0 additions & 164 deletions parts/lib/builders.nix

This file was deleted.

3 changes: 1 addition & 2 deletions parts/lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# following https://github.com/NixOS/nixpkgs/blob/77ee426a4da240c1df7e11f48ac6243e0890f03e/lib/default.nix
# as a rough template we can create our own extensible lib and expose it to the flake
# we can then use that elsewhere like our hosts
{ inputs, withSystem, ... }:
{ inputs, ... }:
let
lib0 = inputs.nixpkgs.lib;

Expand All @@ -12,7 +12,6 @@ let
in
{
template = import ./template; # templates, selections of code that are repeated
builders = import ./builders.nix { inherit lib inputs withSystem; };
hardware = import ./hardware.nix;
helpers = import ./helpers.nix { inherit lib; };
programs = import ./programs.nix { inherit lib; };
Expand Down
2 changes: 1 addition & 1 deletion parts/programs/deploy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let
inherit (lib.attrsets) filterAttrs;

# extract the names of the systems that we want to deploy
allowedSystems = attrNames (filterAttrs (_: attrs: attrs.deployable) config.hosts);
allowedSystems = attrNames (filterAttrs (_: attrs: attrs.deployable) config.easyHosts.hosts);
systems = filterAttrs (name: _: elem name allowedSystems) self.nixosConfigurations;

# then create a list of nodes that we want to deploy that we can pass to the deploy configuration
Expand Down
108 changes: 65 additions & 43 deletions systems/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ self, inputs, ... }:
let
inherit (self) lib;

# profiles module, these are sensible defaults for given hardware sets
# or meta profiles that are used to configure the system based on the requirements of the given machine
profilesPath = ../modules/profiles; # the base directory for the types module
Expand All @@ -25,55 +28,74 @@ let
in
{
# this is how we get the custom module `config.hosts`
imports = [ ./flake-module.nix ];

# This is the list of system configuration
#
# the defaults consists of the following:
# arch = "x86_64";
# target = "nixos";
# deployable = false;
# modules = [ ];
# specialArgs = { };
config.hosts = {
# isabel's hosts
hydra.modules = [
laptop
graphical
];

tatsumaki = {
arch = "aarch64";
target = "darwin";
};
imports = [ inputs.easy-hosts.flakeModule ];

amaterasu.modules = [
desktop
graphical
];
config.easyHosts = {
shared.specialArgs = { inherit lib; };

valkyrie.modules = [
wsl
];
perClass = class: {
modules = [
(lib.lists.optionals (class != "iso") [
# import the home module, which is users for configuring users via home-manager
"${self}/home/default.nix"

minerva = {
deployable = true;
modules = [ server ];
};
# import the base module, this contains the common configurations between all systems
"${self}/modules/base/default.nix"
])

lilith = {
target = "iso";
modules = [ headless ];
# import the class module, this contains the common configurations between all systems of the same class
"${self}/modules/${class}/default.nix"
];
};

# robin's hosts
cottage.modules = [
laptop
graphical
];
# This is the list of system configuration
#
# the defaults consists of the following:
# arch = "x86_64";
# class = "nixos";
# deployable = false;
# modules = [ ];
# specialArgs = { };
hosts = {
# isabel's hosts
hydra.modules = [
laptop
graphical
];

tatsumaki = {
arch = "aarch64";
class = "darwin";
};

amaterasu.modules = [
desktop
graphical
];

wisp.modules = [
wsl
];
valkyrie.modules = [
wsl
];

minerva = {
deployable = true;
modules = [ server ];
};

lilith = {
class = "iso";
modules = [ headless ];
};

# robin's hosts
cottage.modules = [
laptop
graphical
];

wisp.modules = [
wsl
];
};
};
}
Loading

0 comments on commit 914aa7a

Please sign in to comment.