Skip to content

Commit

Permalink
switch from deploy-rs to colmena
Browse files Browse the repository at this point in the history
  • Loading branch information
leo60228 committed Jul 4, 2024
1 parent f08f083 commit 22bd703
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 128 deletions.
201 changes: 93 additions & 108 deletions flake.lock

Large diffs are not rendered by default.

53 changes: 33 additions & 20 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
url = github:leo60228/mpdiscord;
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.deploy-rs.url = "github:serokell/deploy-rs";
inputs.fizz-strat = {
url = "github:BlaseballCrabs/fizz-strat";
inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -49,32 +48,46 @@
inputs.lix.follows = "lix";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.colmena = {
url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, colmena, flake-utils, ... } @ flakes: ({
colmena =
let
dotfiles = import ./. null;
inherit (dotfiles) systems;
meta = {
nixpkgs = nixpkgs.legacyPackages.x86_64-linux;

nodeNixpkgs = nixpkgs.lib.mapAttrs (n: x:
let
hardware = import (./hardware + "/${n}.nix");
inherit (hardware) system;
in
nixpkgs.legacyPackages.${system}) systems;

specialArgs.flakes = flakes;

allowApplyAll = false;
};
in
systems // { inherit meta; };

outputs = { self, nixpkgs, flake-utils, deploy-rs, ... } @ flakes: (rec {
nixosConfigurations = nixpkgs.lib.mapAttrs (n: x: nixpkgs.lib.nixosSystem {
system = (import (./hardware + "/${n}.nix")).system;
modules = [ x ];
specialArgs = {
inherit flakes;
};
}) (import ./. null).systems;
system = self.outputs.colmena.meta.nodeNixpkgs.${n}.system;
modules = [ x colmena.nixosModules.deploymentOptions ];
inherit (self.outputs.colmena.meta) specialArgs;
}) (builtins.removeAttrs self.outputs.colmena ["meta" "defaults"]);

hydraJobs =
let
jobs = nixpkgs.lib.mapAttrs (n: x: {
${x.config.nixpkgs.system} = if builtins.hasAttr n deploy.nodes then deploy.nodes.${n}.profiles.system.path else x.config.system.build.toplevel;
}) nixosConfigurations;
${x.config.nixpkgs.system} = x.config.system.build.toplevel;
}) self.outputs.nixosConfigurations;
in
jobs;
deploy.nodes = nixpkgs.lib.mapAttrs (x: y: {
hostname = x;

fastConnection = y;

profiles.system = {
user = "root";
path = deploy-rs.lib.${nixosConfigurations.${x}.config.nixpkgs.system}.activate.nixos nixosConfigurations.${x};
};
}) { leoservices = false; digitaleo = false; nucserv = false; crabstodon = false; leoserv = true; };
} // (flake-utils.lib.eachDefaultSystem (system: rec {
packages = rec {
nixos-rebuild = flakes.nixpkgs.legacyPackages.${system}.nixos-rebuild;
Expand Down
2 changes: 2 additions & 0 deletions hardware/crabstodon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
device = "/var/swapfile";
size = 4096;
} ];

deployment.tags = [ "servers" ];
};

nixops = {
Expand Down
3 changes: 3 additions & 0 deletions hardware/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@
boot.loader.systemd-boot.memtest86.enable = true;

virtualisation.docker.enableNvidia = true;

deployment.tags = [ "workstation" ];
deployment.allowLocalDeployment = true;
};

nixops = {
Expand Down
2 changes: 2 additions & 0 deletions hardware/digitaleo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
device = "/var/swapfile";
size = 4096;
} ];

deployment.tags = [ "servers" ];
};

nixops = {
Expand Down
2 changes: 2 additions & 0 deletions hardware/leoasahi.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

hardware.asahi.extractPeripheralFirmware = false;
hardware.asahi.withRust = true;

deployment.tags = [ "servers" ];
};

nixops = {
Expand Down
2 changes: 2 additions & 0 deletions hardware/leoserv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

nix.settings.max-jobs = lib.mkDefault 12;
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";

deployment.tags = [ "servers" ];
};

nixops = {};
Expand Down
2 changes: 2 additions & 0 deletions hardware/leoservices.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
} ];

boot.loader.grub.device = lib.mkForce "/dev/nvme0n1";

deployment.tags = [ "servers" ];
};

nixops = {
Expand Down
2 changes: 2 additions & 0 deletions hardware/nucserv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
libvdpau-va-gl
];
};

deployment.tags = [ "servers" ];
};

system = "x86_64-linux";
Expand Down
3 changes: 3 additions & 0 deletions hardware/zephyrus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
nvidiaBusId = "PCI:1:0:0";
};
boot.kernelParams = [ "nvidia.NVreg_EnableS0ixPowerManagement=1" ];

deployment.tags = [ "workstation" ];
deployment.allowLocalDeployment = true;
};

nixops = {
Expand Down
1 change: 1 addition & 0 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
(hiPrio gcc)
leoPkgs.bin
] else [
colmena
fusee-nano
obs-studio
thunderbird
Expand Down

0 comments on commit 22bd703

Please sign in to comment.