From e2d99b628d497459450a92ebaefb3d0807ff3d86 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 27 Jul 2024 16:28:37 +0200 Subject: [PATCH] Initial commit --- .gitignore | 5 +++ LICENSE | 2 +- README.md | 32 ++++++++++++++ flake.lock | 27 ++++++++++++ flake.nix | 64 +++++++++++++++++++++++++++ machines/demo/default.nix | 36 ++++++++++++++++ modules/desk-os/default.nix | 86 +++++++++++++++++++++++++++++++++++++ 7 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 machines/demo/default.nix create mode 100644 modules/desk-os/default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e0e9d46 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +result-* +result +.direnv +*.qcow2 +*.img diff --git a/LICENSE b/LICENSE index b1f0ed0..b3c074e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 nixup +Copyright (c) 2024 Michael Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md new file mode 100644 index 0000000..136a017 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Desk OS - A simple, general purpose operating system for desktop computers + +## Installation + +1. Download the latest [Desk OS installation ISO](https://github.com/nixup-io/desk-os/releases/download/v1.0.0/desk-os-v1.0.0-installer.iso) + +2. Flash it to a suitable USB drive + +3. Boot it and install it + +**Notes** + +- The installation ISO assumes you are booting with UEFI and will partition the destination disk with GPT and enable full disk encryption (LUKS). +- After booting into the installed system for the first time and entering the chosen full disk encryption password, you'll be greeted with the login screen. You log in with the user account name you set during installation and the default password is `changeme`. + +## Run a Desk OS demo in a virtual machine + +This assumes you're running NixOS or another Linux distribution and have the Nix package manager installed. + +```sh +nix run github:nixup-io/desk-os +``` + +## Contact + +- E-mail: [info@nixup.io](mailto:info@nixup.io) +- X: [@michaelshmitty](https://x.com/michaelshmitty) +- Fediverse: [@neo](https://social.hacktheplanet.be/@neo) + +## Acknowledgements + +Desk OS is based on [Linux](https://en.wikipedia.org/wiki/Linux) and [NixOS](https://nixos.org/) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1cd801e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1720954236, + "narHash": "sha256-1mEKHp4m9brvfQ0rjCca8P1WHpymK3TOr3v34ydv9bs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "53e81e790209e41f0c1efa9ff26ff2fd7ab35e27", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5199401 --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "Desk OS - A simple, general purpose operating system for desktop computers"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + }; + + outputs = { + self, + nixpkgs, + } @ inputs: let + supportedSystems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + + # Function to generate a set based on supported systems: + forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems; + + # Attribute set of nixpkgs for each system: + nixpkgsFor = forAllSystems (system: + import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }); + in { + packages = forAllSystems (system: let + pkgs = nixpkgsFor.${system}; + in { + default = self.packages.${system}.demo; + demo = + (inputs.nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + ./modules/desk-os + (import ./machines/demo {inherit pkgs;}) + ]; + }) + .config + .system + .build + .vm; + }); + + apps = forAllSystems (system: { + default = self.apps.${system}.demo; + demo = let + clean-state-demo = nixpkgsFor.${system}.writeShellScriptBin "run" '' + ${self.packages.${system}.demo}/bin/run-desk-os-demo-vm + if [ -f ./desk-os-demo.qcow2 ]; then + rm ./desk-os-demo.qcow2 + fi + ''; + in { + type = "app"; + program = "${clean-state-demo}/bin/run"; + }; + }); + + formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra); + }; +} diff --git a/machines/demo/default.nix b/machines/demo/default.nix new file mode 100644 index 0000000..d36648a --- /dev/null +++ b/machines/demo/default.nix @@ -0,0 +1,36 @@ +{pkgs}: {modulesPath, ...}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + (modulesPath + "/virtualisation/qemu-vm.nix") + ]; + + config = { + virtualisation = { + memorySize = 8192; + qemu.options = [ + "-enable-kvm" + "-vga virtio" + ]; + }; + + networking.hostName = "desk-os-demo"; + + # Localization + time.timeZone = "Europe/Brussels"; + i18n.defaultLocale = "en_US.UTF-8"; + services.xserver.xkb.layout = "us"; + services.xserver.xkb.variant = "dvorak"; + + services.displayManager.autoLogin = { + enable = true; + user = "demo"; + }; + security.sudo.wheelNeedsPassword = false; + users.users.demo = { + createHome = true; + isNormalUser = true; + extraGroups = ["networkmanager" "wheel"]; + initialPassword = "demo"; + }; + }; +} diff --git a/modules/desk-os/default.nix b/modules/desk-os/default.nix new file mode 100644 index 0000000..c345829 --- /dev/null +++ b/modules/desk-os/default.nix @@ -0,0 +1,86 @@ +{ + pkgs, + lib, + config, + ... +}: { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = ["nix-command" "flakes"]; + + boot = { + consoleLogLevel = 0; + kernelParams = ["quiet"]; + initrd.verbose = false; + loader.systemd-boot.enable = true; + loader.systemd-boot.configurationLimit = 3; + loader.efi.canTouchEfiVariables = true; + plymouth = { + enable = true; + theme = "breeze"; + }; + }; + + system.autoUpgrade.enable = true; + + services.printing.enable = true; + hardware.bluetooth.enable = true; + + networking.networkmanager.enable = true; + + console.useXkbConfig = true; + + # 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; + }; + + i18n.inputMethod.enabled = "ibus"; + + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + desktopManager.gnome = { + enable = true; + extraGSettingsOverrides = '' + [org.gnome.desktop.background] + picture-uri='file://${pkgs.nixos-artwork.wallpapers.mosaic-blue.gnomeFilePath}' + picture-options='scaled' + + [org.gnome.shell] + # Favorite apps in gnome-shell + # favorite-apps=['org.gnome.Console.desktop', 'org.gnome.Nautilus.desktop'] + # Enabled extensions + enabled-extensions=['${pkgs.gnomeExtensions.arcmenu.extensionUuid}','${pkgs.gnomeExtensions.dash-to-panel.extensionUuid}'] + + [org.gnome.mutter] + edge-tiling=true + ''; + + extraGSettingsOverridePackages = [ + pkgs.gsettings-desktop-schemas # for org.gnome.desktop + pkgs.gnome.gnome-shell # for org.gnome.shell + pkgs.gnome.mutter # for org.gnome.mutter + ]; + }; + }; + + services.udev.packages = with pkgs; [gnome.gnome-settings-daemon]; + + environment.systemPackages = with pkgs; [ + firefox + gnomeExtensions.arcmenu + gnomeExtensions.dash-to-panel + ]; + + environment.gnome.excludePackages = with pkgs; [ + pkgs.gnome-tour + pkgs.gnome.epiphany + ]; + + system.stateVersion = "24.05"; # Did you read the comment? +}