Skip to content

Commit

Permalink
Add testing-base. (#36)
Browse files Browse the repository at this point in the history
Add a base 23.11 nixos system with Gnome, GDM
and nix-flatpak installed.
  • Loading branch information
gmodena authored Feb 7, 2024
1 parent 30f6cb6 commit 6079344
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 0 deletions.
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
];
};
};
}

0 comments on commit 6079344

Please sign in to comment.