From 2960b29fb158919f1e98783317b9fe439f22946d Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 22 Mar 2024 22:10:30 +0900 Subject: [PATCH] test --- lib/default.nix | 22 ++++++++++----------- nixos/containers/default.nix | 1 - nixos/containers/rdesktop/default.nix | 12 +++-------- nixos/hosts/framework-server/containers.nix | 12 ++--------- 4 files changed, 16 insertions(+), 31 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index e88a5d16..c34925b4 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -33,24 +33,24 @@ mkContainer = { hostname, username ? "albert", - desktop ? null, system ? "x86_64-linux", theme ? "stylix", - type ? "default", repo ? "nixpkgs", - unfree ? false, - tskey ? null, - pkgs ? import inputs.${repo} - { inherit system; config.allowUnfree = unfree; hostPlatform = system; }, - pkgs-unstable ? import inputs.nixpkgs-unstable - { inherit system; config.allowUnfree = unfree; hostPlatform = system; } + unfree ? false }: { bindMounts = import ../nixos/containers/${hostname}/mounts.nix; autoStart = true; privateNetwork = false; - specialArgs = { inherit pkgs pkgs-unstable hostname username desktop theme system repo unfree stateVersion tskey; }; - config = { lib, config, pkgs, pkgs-unstable, hostname, username, desktop, theme, system, repo, stateVersion, tskey, ... }: { - system.stateVersion = stateVersion; + 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; + }; + imports = [ ../nixos/containers ]; diff --git a/nixos/containers/default.nix b/nixos/containers/default.nix index 594bd98e..d32084d0 100644 --- a/nixos/containers/default.nix +++ b/nixos/containers/default.nix @@ -5,6 +5,5 @@ ../common/modules/nixos.nix ../common/modules/networking.nix ]; - networking.hostName = "${hostname}"; } diff --git a/nixos/containers/rdesktop/default.nix b/nixos/containers/rdesktop/default.nix index 9b921889..eb9e0691 100644 --- a/nixos/containers/rdesktop/default.nix +++ b/nixos/containers/rdesktop/default.nix @@ -1,15 +1,9 @@ -{ desktop, ... }: { +{ ... }: { imports = [ - ../../common/desktops/${desktop} ../../common/software/packages.nix + ../../common/desktops/plasma6 ]; - - system.stateVersion = "24.05"; networking.firewall.allowedTCPPorts = [ 3389 ]; - - services.xrdp = { - enable = true; - openFirewall = true; - }; + services.xrdp.enable = true; } diff --git a/nixos/hosts/framework-server/containers.nix b/nixos/hosts/framework-server/containers.nix index afdfae32..905b8d5a 100644 --- a/nixos/hosts/framework-server/containers.nix +++ b/nixos/hosts/framework-server/containers.nix @@ -1,19 +1,11 @@ { self, inputs, outputs, stateVersion, hmStateVersion, pkgs, pkgs-unstable, ... }: let - libx = import ../../../lib { - inherit self inputs outputs hmStateVersion pkgs-unstable pkgs; - stateVersion = "24.05"; - }; + libx = import ../../../lib { inherit self inputs outputs stateVersion hmStateVersion; }; in { # TODO: Set up Tailscale key # Set up the bridge network: containers = { - rdesktop = libx.mkContainer { - hostname = "rdesktop"; - desktop = "plasma6"; - unfree = true; - repo = "nixpkgs-unstable"; - }; + rdesktop = libx.mkContainer { hostname = "rdesktop"; unfree = true; repo = "nixpkgs-unstable"; }; }; }