Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Apr 17, 2024
1 parent aba7ed0 commit 0876341
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 55 deletions.
20 changes: 2 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,8 @@
};

nixosConfigurations = {
cirno = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ ... }: { nixpkgs.overlays = [ overlays.default ]; })
./servers/base.nix
./servers/cirno/configuration.nix
];
specialArgs = inputs // { inherit self; };
};
cs306 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ ... }: { nixpkgs.overlays = [ overlays.default ]; })
./servers/base.nix
./servers/cs306/configuration.nix
];
specialArgs = inputs // { inherit self; };
};
cirno = import ./servers/cirno inputs;
cs306 = import ./servers/cs306 inputs;
};
}
);
Expand Down
8 changes: 2 additions & 6 deletions packages/imports.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{ config, pkgs, lib, ... }:
{ ... }:

let sources = import <acm-aws/nix/sources.nix> { };

in {
{
imports = [
./caddy/caddy.nix
./sysmet/sysmet.nix
./dischord/service.nix
./christmasd/service.nix
];

nixpkgs.overlays = import <acm-aws/nix/overlays.nix>;
}
17 changes: 10 additions & 7 deletions servers/base.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, self, ... }:

let sources = import ../nix/sources.nix;

in {
{
imports = [
<acm-aws/packages/imports.nix>
<acm-aws/nix/modules>
(self + "/packages/imports.nix")
(self + "/nix/modules")
];

services.journald = {
Expand Down Expand Up @@ -41,5 +39,10 @@ in {
];

# Deploy ./static to all servers.
deployment.staticPaths = [ ../static ];
deployment.staticPaths = [ (self + "/static") ];

# Add the flake's overlays to the system.
nixpkgs.overlays = [
self.overlays.${pkgs.system}.default
];
}
4 changes: 2 additions & 2 deletions servers/cirno/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ config, lib, pkgs, modulesPath, ... }:
{ config, lib, pkgs, modulesPath, self, ... }:

{
imports = [
(modulesPath + "/virtualisation/amazon-image.nix")
<acm-aws/servers/base.nix>
(self + "/servers/base.nix")
./services.nix
./telemetry.nix
];
Expand Down
9 changes: 4 additions & 5 deletions servers/cirno/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
let
sources = import <acm-aws/nix/sources.nix>;
in
{ nixpkgs, ... }@inputs:

import "${sources.nixpkgs}/nixos" {
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
configuration = import ./configuration.nix;
modules = [ ./servers/cirno/configuration.nix ];
specialArgs = inputs;
}
5 changes: 3 additions & 2 deletions servers/cirno/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ resource "aws_instance" "cirno" {
}

module "deployment" {
source = "git::https://github.com/diamondburned/terraform-nixos.git//deploy_nixos?ref=9d26ace355b2ed7d64a253b11ab12395a1395030"
nixos_config = "${path.module}"
source = "github.com/tweag/terraform-nixos//deploy_nixos?ref=646cacb12439ca477c05315a7bfd49e9832bc4e3"
nixos_config = "cirno"
flake = true
target_host = var.host != null ? var.host : aws_instance.cirno.public_ip
ssh_private_key_file = var.ssh_private_key_file
ssh_agent = false
Expand Down
11 changes: 3 additions & 8 deletions servers/cs306/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:
{ config, pkgs, lib, self, ... }:

{
imports = [ # Include the results of the hardware scan.
<acm-aws/servers/base.nix>
# <acm-aws/containers/cs306/test.nix>
imports = [
(self + "/servers/base.nix")
./hardware-configuration.nix
./services.nix
./recovery.nix
Expand Down
9 changes: 4 additions & 5 deletions servers/cs306/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
let
sources = import <acm-aws/nix/sources.nix>;
in
{ nixpkgs, ... }@inputs:

import "${sources.nixpkgs}/nixos" {
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
configuration = import ./configuration.nix;
modules = [ ./servers/cs306/configuration.nix ];
specialArgs = inputs;
}
5 changes: 3 additions & 2 deletions servers/cs306/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ variable "host" {
}

module "deployment" {
source = "git::https://github.com/diamondburned/terraform-nixos.git//deploy_nixos?ref=9d26ace355b2ed7d64a253b11ab12395a1395030"
nixos_config = "${path.module}"
source = "github.com/tweag/terraform-nixos//deploy_nixos?ref=646cacb12439ca477c05315a7bfd49e9832bc4e3"
nixos_config = "cs306"
flake = true
target_host = "${var.host}"
ssh_private_key_file = var.ssh_private_key_file
ssh_agent = false
Expand Down

0 comments on commit 0876341

Please sign in to comment.