This commit is contained in:
albert 2024-03-20 17:23:30 +09:00
parent 50dbdd98c5
commit 99a388b850
No known key found for this signature in database
GPG key ID: 64F6C4EB46C4543A
5 changed files with 65 additions and 37 deletions

View file

@ -30,6 +30,38 @@
modules = [ ../home-manager/${type}.nix ]; modules = [ ../home-manager/${type}.nix ];
}; };
# Helper function for generating container configs
mkContainer = {
container,
username ? "albert",
desktop ? null,
gpu ? null,
system ? "x86_64-linux",
theme ? "stylix",
type ? "default",
repo ? "nixpkgs",
unfree ? false
}: {
autoStart = true;
privateNetwork = false;
specialArgs = { inherit desktop container username stateVersion gpu system theme; };
config = { lib, container, username, desktop, gpu, system, theme, type, repo, unfree, pkgs, stateVersion}: {
# Choose whether to pull from stable or unstable
pkgs = import inputs.${repo} {
inherit system;
config.allowUnfree = unfree;
hostPlatform = system;
};
# Some packages (ie, Vintage Story) I want to keep on unstable no matter what default repo I use
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit system;
config.allowUnfree = unfree;
hostPlatform = system;
};
imports = [ ../nixos/containers/rdesktop ];
};
};
# Helper function for generating host configs # Helper function for generating host configs
mkHost = { mkHost = {
hostname, hostname,
@ -42,7 +74,7 @@
repo ? "nixpkgs", repo ? "nixpkgs",
unfree ? false unfree ? false
}:inputs.${repo}.lib.nixosSystem { }:inputs.${repo}.lib.nixosSystem {
specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu system theme; specialArgs = { inherit inputs outputs desktop hostname username hmStateVersion stateVersion gpu system theme self;
# Choose whether to pull from stable or unstable # Choose whether to pull from stable or unstable
pkgs = import inputs.${repo} { pkgs = import inputs.${repo} {
inherit system; inherit system;

View file

@ -1,30 +0,0 @@
{ username, stateVersion, desktop, ... }: {
networking.firewall.allowedTCPPorts = [ 3390 ];
containers.rdesktop = {
autoStart = true;
privateNetwork = false;
specialArgs = { inherit username stateVersion desktop; };
config = { config, pkgs, lib, username, stateVersion, desktop, ... }: {
networking.hostName = "nixos-rdesktop";
system.stateVersion = stateVersion;
imports = [
../common/desktops/${desktop}
../users/${username}
];
networking.firewall = {
enable = true;
allowedTCPPorts = [ 3390 ];
};
services.xrdp = {
enable = true;
openFirewall = true;
port = 3390;
defaultWindowManager = "xfce4-session";
};
};
};
}

View file

@ -0,0 +1,18 @@
{ username, stateVersion, desktop, ... }: {
imports = [
../../common/desktops/${desktop}
../../users/${username}
];
networking.firewall = {
enable = true;
allowedTCPPorts = [ 3390 ];
};
services.xrdp = {
enable = true;
openFirewall = true;
port = 3390;
defaultWindowManager = "xfce4-session";
};
}

View file

@ -0,0 +1,8 @@
{ self, inputs, outputs, username, stateVersion, hmStateVersion, config, lib, pkgs, modulesPath, system, ... }:
let
libx = import ../../../lib {inherit self inputs outputs stateVersion hmStateVersion; };
in {
containers = {
rdesktop = libx.mkContainer { container = "rdesktop"; };
};
}

View file

@ -1,4 +1,4 @@
{ username, stateVersion, inputs, config, lib, pkgs, modulesPath, system, ... }: { { self, inputs, outputs, username, stateVersion, hmStateVersion, config, lib, pkgs, modulesPath, system, ... }: {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.framework-13th-gen-intel inputs.nixos-hardware.nixosModules.framework-13th-gen-intel
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
@ -8,7 +8,7 @@
../../common/modules/ssh-luks.nix ../../common/modules/ssh-luks.nix
../../common/services/docker.nix ../../common/services/docker.nix
../../common/services/tailscale-autoconnect.nix ../../common/services/tailscale-autoconnect.nix
( import ../../containers/rdesktop.nix { desktop = "xfce"; stateVersion = stateVersion; username = username;} ) ./containers.nix
./disks.nix ./disks.nix
./builder.nix ./builder.nix
./wireguard.nix ./wireguard.nix
@ -16,10 +16,10 @@
./firewall.nix ./firewall.nix
]; ];
environment.systemPackages = [ environment.systemPackages = [
inputs.deploy-rs.packages.${system}.deploy-rs inputs.deploy-rs.packages.${system}.deploy-rs
pkgs.distrobox pkgs.distrobox
]; ];
# backups-rpi4 cron job to back up sysctl.io's Docker files # backups-rpi4 cron job to back up sysctl.io's Docker files
# osaka-linode-01 cron job to copy certs for the DERP relay # osaka-linode-01 cron job to copy certs for the DERP relay