Tristan Daniël Maat
9060cb6414
Flake lock file changes: • Updated input 'flake-utils': 'github:numtide/flake-utils/7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19' (2021-09-13) → 'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28) • Updated input 'nixos-hardware': 'github:nixos/nixos-hardware/0a8b8054c9920368a3c15e6d766188fdf04b736f' (2021-09-30) → 'github:nixos/nixos-hardware/2a7063461c3751d83869a2a0a8ebc59e34bec5b2' (2021-12-11) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/7daf35532d2d8bf5e6f7f962e6cd13a66d01a71d' (2021-10-03) → 'github:nixos/nixpkgs/573095944e7c1d58d30fc679c81af63668b54056' (2021-12-10)
130 lines
3.8 KiB
Nix
130 lines
3.8 KiB
Nix
{
|
|
description = "tlater.net host configuration";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
|
|
nixos-hardware.url = "github:nixos/nixos-hardware/master";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
tlaternet-webserver = {
|
|
url = "git+https://gitea.tlater.net/tlaternet/tlaternet.git";
|
|
inputs = {
|
|
flake-utils.follows = "flake-utils";
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
tlaternet-templates = {
|
|
url = "git+https://gitea.tlater.net/tlaternet/tlaternet-templates.git";
|
|
inputs = {
|
|
flake-utils.follows = "flake-utils";
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, nixos-hardware, flake-utils, tlaternet-webserver
|
|
, tlaternet-templates, ... }@inputs:
|
|
let
|
|
overlays = [
|
|
(final: prev: {
|
|
tlaternet-webserver =
|
|
tlaternet-webserver.legacyPackages.${prev.system}.packages;
|
|
tlaternet-templates =
|
|
tlaternet-templates.legacyPackages.${prev.system}.packages;
|
|
local = import ./pkgs {
|
|
pkgs = prev;
|
|
local-lib = self.lib.${prev.system};
|
|
};
|
|
})
|
|
];
|
|
|
|
in {
|
|
nixosConfigurations = {
|
|
tlaternet = let system = "x86_64-linux";
|
|
in nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
modules = [
|
|
({ modulesPath, ... }: {
|
|
imports = [ (modulesPath + "/profiles/headless.nix") ];
|
|
nixpkgs.overlays = overlays;
|
|
})
|
|
(import ./modules)
|
|
|
|
(import ./configuration)
|
|
(import ./configuration/linode.nix)
|
|
(import ./configuration/hardware-configuration.nix)
|
|
];
|
|
};
|
|
|
|
vm = let system = "x86_64-linux";
|
|
in nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
modules = [
|
|
({ modulesPath, ... }: {
|
|
imports = [ (modulesPath + "/profiles/headless.nix") ];
|
|
nixpkgs.overlays = overlays;
|
|
})
|
|
(import ./modules)
|
|
|
|
(import ./configuration)
|
|
({ lib, ... }: {
|
|
users.users.tlater.password = "insecure";
|
|
|
|
# Disable graphical tty so -curses works
|
|
boot.kernelParams = [ "nomodeset" ];
|
|
|
|
# Sets the base domain for nginx to localhost so that we
|
|
# can easily test locally with the VM.
|
|
services.nginx.domain = lib.mkOverride 99 "localhost";
|
|
|
|
# # Set up VM settings to match real VPS
|
|
# virtualisation.memorySize = 3941;
|
|
# virtualisation.cores = 2;
|
|
})
|
|
];
|
|
};
|
|
};
|
|
} // flake-utils.lib.eachDefaultSystem (system:
|
|
let pkgs = import nixpkgs { inherit system overlays; };
|
|
in {
|
|
devShell = with pkgs;
|
|
mkShell {
|
|
buildInputs = [
|
|
nixfmt
|
|
git-lfs
|
|
|
|
# For the minecraft mod update script
|
|
(python3.withPackages (pypkgs:
|
|
with pypkgs; [
|
|
dateutil
|
|
requests
|
|
|
|
ipython
|
|
python-language-server
|
|
pyls-black
|
|
pyls-isort
|
|
pyls-mypy
|
|
]))
|
|
];
|
|
shellHook = ''
|
|
export QEMU_OPTS="-m 3941 -smp 2 -curses"
|
|
export QEMU_NET_OPTS="hostfwd=::3022-:2222,hostfwd=::3080-:80,hostfwd=::3443-:443,hostfwd=::3021-:2221,hostfwd=::25565-:25565"
|
|
|
|
# Work around sudo requiring a full terminal
|
|
export NIX_SSHOPTS="-t"
|
|
'';
|
|
};
|
|
|
|
packages = import ./pkgs {
|
|
inherit pkgs;
|
|
local-lib = self.lib.${system};
|
|
};
|
|
|
|
lib = import ./lib {
|
|
inherit pkgs inputs;
|
|
lib = nixpkgs.lib;
|
|
};
|
|
});
|
|
}
|