Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing-base. #36

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions testing-base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Testing base

A base GDM + Gnome `nixos` system to experiment with `nix-flatpak`.

Build a qemu virtual machine with
```bash
nix build .#nixosConfigurations.test-system-module.config.system.build.vm
```

start the system with
```bash
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22"
result/bin/run-nixos-vm
```

and ssh into the vm with
```bash
ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no antani@localhost -p 2221
```
54 changes: 54 additions & 0 deletions testing-base/common.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# configuration.nix
{ config, lib, pkgs, ... }: {
users.users.antani = {
isNormalUser = true;
home = "/home/antani";
extraGroups = [ "wheel" ]; # Enables `sudo` for the user.
password = "changeme"; # The password assigned if the user does not already exist.
};

virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {
memorySize = 1024; # Use 1024MiB memory.
cores = 2;
graphics = true; # Boot the vm in a window.
diskSize = 1000; # Virtual machine disk size in MB.
};
};

services.openssh = {
enable = true;
settings.PasswordAuthentication = true;
};

networking.firewall.allowedTCPPorts = [ 22 ];
environment.systemPackages = with pkgs; [
git
vim
];
services.xserver.enable = true;

# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;

# Required to install flatpak
xdg.portal = {
enable = true;
config = {
common = {
default = [
"gtk"
];
};
};
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
# xdg-desktop-portal-kde
# xdg-desktop-portal-gtk
];
};

system.stateVersion = "23.11";
}
13 changes: 13 additions & 0 deletions testing-base/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# configuration.nix
{ config, lib, pkgs, ... }: {
imports = [
./common.nix
];
# nix-flatpak setup
services.flatpak.enable = true;
services.flatpak.update.auto.enable = false;
services.flatpak.uninstallUnmanagedPackages = true;
services.flatpak.packages = [
# ...
];
}
40 changes: 40 additions & 0 deletions testing-base/flake.lock

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

21 changes: 21 additions & 0 deletions testing-base/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flatpaks.url = "../";
};
outputs = inputs@{ self, nixpkgs, flatpaks, ... }:
let
system = "x86_64-linux";
in
{
# hostname = test-system-module
nixosConfigurations.test-system-module = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
flatpaks.nixosModules.nix-flatpak
./configuration.nix
];
};
};
}
Loading