Skip to content

Commit

Permalink
add nixos module (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-martin authored Jan 18, 2024
1 parent e2e1057 commit 6adfa80
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
17 changes: 17 additions & 0 deletions main/flake.lock

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

9 changes: 6 additions & 3 deletions main/flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
inputs = {
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-22-11.url = "github:nixos/nixpkgs/nixos-22.11";
nixpkgs-23-05.url = "github:nixos/nixpkgs/nixos-23.05";
nixpkgs-stable-2023-07-25.url = "github:nixos/nixpkgs/6dc93f0daec55ee2f441da385aaf143863e3d671";
nixpkgs-master-2023-05-06.url = "github:nixos/nixpkgs/16b3b0c53b1ee8936739f8c588544e7fcec3fc60";
Expand All @@ -10,11 +11,13 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
(inputs.flake-utils.lib.eachDefaultSystem (system:
rec {
packages = import ./packages.nix { inherit inputs system; };
lib = import ./lib.nix { inherit inputs system packages; };
checks = import ./checks.nix { inherit inputs system packages lib; };
}
);
})
) // {
nixosModules = import ./nixos-modules.nix { inherit inputs; };
};
}
31 changes: 31 additions & 0 deletions main/nixos-modules.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ inputs }:
{
docker-for-local-dev =
{ config, ... }:
let
pkgs = import inputs.nixpkgs-22-11 { inherit (config.nixpkgs) system; };
in
{
# Enable Docker
virtualisation.docker.enable = true;

# Allow Docker to see the host
networking.firewall.allowedTCPPorts = [ 3000 ];

# Pretend that localhost.com is a domain that points to our own machine
networking.extraHosts = ''
127.0.0.1 localhost.com
127.0.0.1 api.localhost.com
127.0.0.1 assets.localhost.com
127.0.0.1 classroom.localhost.com
127.0.0.1 school.localhost.com
127.0.0.1 student.localhost.com
127.0.0.1 console.localhost.com
127.0.0.1 faktory.localhost.com
127.0.0.1 tts.localhost.com
127.0.0.1 sso.localhost.com
'';

virtualisation.docker.package = pkgs.docker;
};
}

0 comments on commit 6adfa80

Please sign in to comment.