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

Customizable nix installer #40

Open
wants to merge 14 commits into
base: calamares
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ insert_final_newline = true
indent_style = tab
insert_final_newline = true

[*.snippet]
indent_style = space
indent_size = 2
insert_final_newline = true

[*.nix]
indent_style = space
indent_size = 2
insert_final_newline = true
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,27 @@ jobs:
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix run

build-pkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build .#calamares-nixos-extensions

build-iso:
needs: build-pkg
runs-on: ubuntu-latest
strategy:
matrix:
name:
- "defaultCalamaresIso"
- "customCalamaresIso"
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build .#${{ matrix.name }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ build/
*.qmlc
.vscode/
**/__pycache__/

results
result
4 changes: 2 additions & 2 deletions branding/nixos/branding.desc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ navigation: widget
strings:
productName: "${NAME}"
shortProductName: NixOS
version:
shortVersion:
version: ""
shortVersion: ""
versionedName: NixOS
shortVersionedName: NixOS
bootloaderEntryName: NixOS
Expand Down
53 changes: 44 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs = { nixpkgs, ... }:
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";

Expand All @@ -14,17 +15,51 @@
};

packages = [
(pkgs.python3.withPackages (pp: with pp; [ pytest pytest-mock ]))
(pkgs.python3.withPackages (
pp: with pp; [
pytest
pytest-mock
]
))
];

mkISO = (import ./nix/lib/mkISO.nix);
calamaresIsoBuilder =
nixpkgsSource: name: extraModules:
(mkISO name {
inherit
system
;
inherit (nixpkgsSource) lib;
nixosSystem = import (nixpkgsSource + "/nixos/lib/eval-config.nix");
withModules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix"
./nix/calamares-nixos-extensions-upstream.nix
] ++ extraModules;
}).config.system.build.isoImage;
in
{
packages.${system}.default = pkgs.writeShellApplication {
name = "test-nixos-install";
runtimeInputs = packages;
text = ''
#!${pkgs.stdenv.shell}
pytest -vv testing
'';
packages.${system} = {
default = pkgs.writeShellApplication {
name = "test-nixos-install";
runtimeInputs = packages;
text = ''
#!${pkgs.stdenv.shell}
pytest -vv testing
'';
};

calamares-nixos-extensions = pkgs.callPackage ./nix/calamares-nixos-extensions/package.nix { };

defaultCalamaresIso = calamaresIsoBuilder nixpkgs "defaultCalamaresISO" [ ];

customCalamaresIso = calamaresIsoBuilder nixpkgs "customCalamaresISO" [
# Add custom modules to the iso (runtime)
./nix/modules/virtualboxGuest.nix
./nix/modules/zsh.nix
# Configure the calamares extension with custom snippets
./nix/modules/calamares-customizations.nix
];
};

devShells.${system}.default = pkgs.mkShell {
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions modules/nixos/defaultConfigs/snippets/audio.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;

# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
3 changes: 3 additions & 0 deletions modules/nixos/defaultConfigs/snippets/autologin.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable automatic login for the user.
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "@@username@@";
3 changes: 3 additions & 0 deletions modules/nixos/defaultConfigs/snippets/autologingdm.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/autologintty.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable automatic login for the user.
services.getty.autologinUser = "@@username@@";
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootbios.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "@@bootdev@@";
boot.loader.grub.useOSProber = true;
boot.tmp.useTmpfs = true;
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootefi.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 42;
boot.loader.efi.canTouchEfiVariables = true;
boot.tmp.useTmpfs = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootgrubcrypt.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Setup keyfile
boot.initrd.secrets = {
"/boot/crypto_keyfile.bin" = null;
};

boot.loader.grub.enableCryptodisk = true;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootnone.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Disable bootloader.
boot.loader.grub.enable = false;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/connman.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable networking
services.connman.enable = true;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/console.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Configure console keymap
console.keyMap = "@@vconsole@@";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Budgie Desktop environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.budgie.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Cinnamon Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.cinnamon.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Deepin Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.deepin.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Enlightenment Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.enlightenment.enable = true;

# Enable acpid
services.acpid.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Lumina Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.lumina.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/desktopEnv/lxqt.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the LXQT Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.lxqt.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/desktopEnv/mate.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the MATE Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.mate.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Pantheon Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.pantheon.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;

# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/desktopEnv/xfce.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the XFCE Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.xfce.enable = true;
18 changes: 18 additions & 0 deletions modules/nixos/defaultConfigs/snippets/extra.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };

# List services that you want to enable:

# Enable the OpenSSH daemon.
# services.openssh.enable = true;

# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
1 change: 1 addition & 0 deletions modules/nixos/defaultConfigs/snippets/firefox.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
programs.firefox.enable = true;
7 changes: 7 additions & 0 deletions modules/nixos/defaultConfigs/snippets/head.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/imports.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
];
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/keymap.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configure keymap in X11
services.xserver.xkb = {
layout = "@@kblayout@@";
variant = "@@kbvariant@@";
};
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/latestkernel.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackages_latest;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/locale.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Select internationalisation properties.
i18n.defaultLocale = "@@LANG@@";
11 changes: 11 additions & 0 deletions modules/nixos/defaultConfigs/snippets/localeextra.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
i18n.extraLocaleSettings = {
LC_ADDRESS = "@@LC_ADDRESS@@";
LC_IDENTIFICATION = "@@LC_IDENTIFICATION@@";
LC_MEASUREMENT = "@@LC_MEASUREMENT@@";
LC_MONETARY = "@@LC_MONETARY@@";
LC_NAME = "@@LC_NAME@@";
LC_NUMERIC = "@@LC_NUMERIC@@";
LC_PAPER = "@@LC_PAPER@@";
LC_TELEPHONE = "@@LC_TELEPHONE@@";
LC_TIME = "@@LC_TIME@@";
};
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/misc.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Enable CUPS to print documents.
services.printing.enable = true;

# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/network.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
networking.hostName = "@@hostname@@"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.

# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
networking.networkmanager.enable = true;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/nmapplet.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable network manager applet
programs.nm-applet.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/pkgs.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
9 changes: 9 additions & 0 deletions modules/nixos/defaultConfigs/snippets/tail.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "@@nixosversion@@"; # Did you read the comment?

}
1 change: 1 addition & 0 deletions modules/nixos/defaultConfigs/snippets/time.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
time.timeZone = "@@timezone@@";
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/unfree.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
7 changes: 7 additions & 0 deletions modules/nixos/defaultConfigs/snippets/users.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.@@username@@ = {
isNormalUser = true;
description = "@@fullname@@";
extraGroups = [ @@groups@@ ];
packages = with pkgs; [@@pkgs@@];
};
Loading