From 45c6da610d43c45246671565414db163dc1bcb8a Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 22 Mar 2024 22:36:01 +0900 Subject: [PATCH] test --- lib/default.nix | 26 ++++++++++++--------- nixos/containers/rdesktop/default.nix | 7 +++--- nixos/hosts/framework-server/containers.nix | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index c34925b4..77e68414 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -33,24 +33,28 @@ mkContainer = { hostname, username ? "albert", + desktop ? null, system ? "x86_64-linux", theme ? "stylix", + type ? "default", repo ? "nixpkgs", - unfree ? false + unfree ? false, + pkgs ? import inputs.${repo} + { inherit system; config.allowUnfree = unfree; hostPlatform = system; }, + pkgs-unstable ? import inputs.nixpkgs-unstable + { inherit system; config.allowUnfree = unfree; hostPlatform = system; } }: { bindMounts = import ../nixos/containers/${hostname}/mounts.nix; autoStart = true; privateNetwork = false; - specialArgs = { inherit inputs unfree repo hostname username theme system; }; - config = { inputs, unfree, repo, hostname, username, theme, system, ... }: { - # Choose whether to pull from stable or unstable - # pkgs-unstable will always be inherited from the host system - nixpkgs.pkgs = import inputs.${repo} { - inherit system; - config.allowUnfree = unfree; - hostPlatform = system; - }; - + specialArgs = { inherit pkgs-unstable hostname username desktop theme system repo unfree stateVersion; }; + config = { lib, config, pkgs-unstable, hostname, username, desktop, theme, system, repo, stateVersion, ... }: { + # Choose whether to pull from stable or unstable + nixpkgs.pkgs = import inputs.${repo} { + inherit system; + config.allowUnfree = unfree; + hostPlatform = system; + }; imports = [ ../nixos/containers ]; diff --git a/nixos/containers/rdesktop/default.nix b/nixos/containers/rdesktop/default.nix index eb9e0691..713997fa 100644 --- a/nixos/containers/rdesktop/default.nix +++ b/nixos/containers/rdesktop/default.nix @@ -1,9 +1,8 @@ -{ ... }: { +{ lib, desktop, ... }: { imports = [ ../../common/software/packages.nix - ../../common/desktops/plasma6 - ]; - + ] ++ lib.optional (builtins.isString desktop) ../../common/desktops/${desktop}; + networking.firewall.allowedTCPPorts = [ 3389 ]; services.xrdp.enable = true; } diff --git a/nixos/hosts/framework-server/containers.nix b/nixos/hosts/framework-server/containers.nix index 905b8d5a..56889719 100644 --- a/nixos/hosts/framework-server/containers.nix +++ b/nixos/hosts/framework-server/containers.nix @@ -6,6 +6,6 @@ in { # Set up the bridge network: containers = { - rdesktop = libx.mkContainer { hostname = "rdesktop"; unfree = true; repo = "nixpkgs-unstable"; }; + rdesktop = libx.mkContainer { hostname = "rdesktop"; unfree = true; repo = "nixpkgs-unstable"; desktop = "xfce"; }; }; }