Skip to content

Commit

Permalink
fix!: make all nixosConfigurations build
Browse files Browse the repository at this point in the history
Specifically `homix`
- remove manual `home-manager` module definition
Import `(r)agenix` and `agenix-rekey` by default for all `NixOS` configurations
Move `machines.nix` flake module import to `configuration.nix` from `flake.nix`
  • Loading branch information
reo101 committed Jul 21, 2024
1 parent 116df11 commit e9cb50d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 26 deletions.
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@

imports = [
./nix/pkgs.nix
./nix/machines.nix
./nix/modules.nix
./nix/configurations.nix
./nix/agenix.nix
Expand Down
8 changes: 0 additions & 8 deletions machines/nixos/x86_64-linux/homix/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,6 @@
enable = true;
};

home-manager = {
backupFileExtension = "hm-bak";
useUserPackages = true;
useGlobalPkgs = false;

extraSpecialArgs = { inherit inputs outputs; };
};

### Enable plymouth (bootscreen customizations)
boot.plymouth = {
enable = true;
Expand Down
2 changes: 0 additions & 2 deletions machines/nixos/x86_64-linux/jeeves/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
inputs.hardware.nixosModules.common-cpu-amd
inputs.hardware.nixosModules.common-gpu-amd
./disko.nix
inputs.ragenix.nixosModules.default
inputs.agenix-rekey.nixosModules.default
./network.nix
./wireguard.nix
./nginx.nix
Expand Down
11 changes: 4 additions & 7 deletions modules/nixos/agenix-rekey-default/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{ inputs, outputs, lib, pkgs, config, options, ... }:
let
# NOTE: synced with <https://github.com/oddlama/agenix-rekey/blob/c071067f7d972552f5170cf8665643ed0ec19a6d/modules/agenix-rekey.nix#L38>
dummyPubkey = "age1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs3290gq";
in {
# TODO: cleaner deep check
config = lib.mkIf (lib.all lib.id [(builtins.hasAttr "age" options) (builtins.hasAttr "rekey" options.age)]) {
age.rekey = lib.mkIf (config.age.rekey.hostPubkey != dummyPubkey) {
{
config = {
# NOTE: `(r)agenix` and `agenix-rekey` modules are imported by `../../../nix/configurations.nix`
age.rekey = {
masterIdentities = lib.mkDefault [ "${inputs.self}/secrets/privkey.age" ];
storageMode = lib.mkDefault "local";
localStorageDir = lib.mkDefault "${inputs.self}/secrets/rekeyed/${config.networking.hostName}";
Expand Down
4 changes: 1 addition & 3 deletions nix/agenix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

perSystem = {
agenix-rekey = {
nodes = {
inherit (self.nixosConfigurations) jeeves;
};
nodes = self.nixosConfigurations;
};
};
}
8 changes: 7 additions & 1 deletion nix/configurations.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ lib, config, self, inputs, withSystem, ... }:

let
# TODO: works?
outputs = self;
inherit (import ./utils.nix { inherit lib self; })
and
Expand Down Expand Up @@ -45,6 +44,9 @@ let
# Home Manager
inputs.home-manager.nixosModules.home-manager
(homeManagerModule args)
# (r)agenix && agenix-rekey
inputs.ragenix.nixosModules.default
inputs.agenix-rekey.nixosModules.default
# nix-topology
inputs.nix-topology.nixosModules.default
# Sane default `networking.hostName`
Expand Down Expand Up @@ -134,6 +136,10 @@ let
machines));
in
{
imports = [
./machines.nix
];

flake = {
# Configurations
nixosConfigurations =
Expand Down
5 changes: 1 addition & 4 deletions nix/topology/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@
};
in {
topology = {
nixosConfigurations = {
inherit (self.nixosConfigurations)
jeeves;
};
nixosConfigurations = self.nixosConfigurations;
modules = [
({ config, ... }: let
inherit (config.lib.topology)
Expand Down

0 comments on commit e9cb50d

Please sign in to comment.