commit 27bc941d29361934642901c2f6a107f32f213047 Author: Paul Zinselmeyer Date: Wed Aug 28 11:39:24 2024 +0200 init diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4fae6dc --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.jpg filter=lfs diff=lfs merge=lfs -text diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5dfd0c8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,81 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "impermanence": { + "locked": { + "lastModified": 1724489415, + "narHash": "sha256-ey8vhwY/6XCKoh7fyTn3aIQs7WeYSYtLbYEG87VCzX4=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "c7f5b394397398c023000cf843986ee2571a1fd7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1724316499, + "narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1724754492, + "narHash": "sha256-oTQ3H993c2hJREkqEN5zyff5ifIRKDRtFTvHlxFcHdI=", + "owner": "nix-community", + "repo": "NUR", + "rev": "d39c7ced498d546513270b314d682ac5d7de734d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "impermanence": "impermanence", + "nixpkgs": "nixpkgs", + "nur": "nur" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5451d86 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + nixConfig.experimental-features = [ "nix-command" "flakes" ]; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nur.url = "github:nix-community/NUR"; + home-manager = { + url = "github:nix-community/home-manager/release-24.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + impermanence.url = "github:nix-community/impermanence"; + }; + + outputs = { self, nixpkgs, nur, home-manager, impermanence }@inputs: { + nixosConfigurations."stube-pc" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + ./stube-pc/system.nix + home-manager.nixosModules.home-manager + impermanence.nixosModules.impermanence + { + nixpkgs.overlays = [ nur.overlay ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = inputs; + sharedModules = [ impermanence.nixosModules.home-manager.impermanence ]; + users.stube.imports = [ ./stube-pc/home-manager.nix ]; + }; + } + ]; + }; + }; +} diff --git a/stube-pc/background.jpg b/stube-pc/background.jpg new file mode 100644 index 0000000..26497dd --- /dev/null +++ b/stube-pc/background.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c3fb8c676d003cf3d30215a21edf180e9ba23eb194adc19ade601a26ac7f0ad +size 753584 diff --git a/stube-pc/hardware-configuration.nix b/stube-pc/hardware-configuration.nix new file mode 100644 index 0000000..b43f0c1 --- /dev/null +++ b/stube-pc/hardware-configuration.nix @@ -0,0 +1,55 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "sd_mod" "sr_mod" "usb_storage" ]; + boot.initrd.kernelModules = [ "amdgpu" ]; + boot.kernelModules = [ "kvm-amd" "radeon.cik_support=0" "amdgpu.cik_support=1" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "none"; + fsType = "tmpfs"; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/a1872869-9d8d-4ef2-9fce-16cb0a562e6c"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/persist" = + { device = "/dev/disk/by-uuid/a1872869-9d8d-4ef2-9fce-16cb0a562e6c"; + fsType = "btrfs"; + options = [ "subvol=persist" ]; + neededForBoot = true; + }; + + fileSystems."/swap" = + { device = "/dev/disk/by-uuid/a1872869-9d8d-4ef2-9fce-16cb0a562e6c"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3b635ee4-a134-4d2b-af7d-36e3930314d9"; + fsType = "ext4"; + }; + + swapDevices = [ { device = "/swap/swapfile"; } ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/stube-pc/home-manager.nix b/stube-pc/home-manager.nix new file mode 100644 index 0000000..de5ff17 --- /dev/null +++ b/stube-pc/home-manager.nix @@ -0,0 +1,387 @@ +{ config, pkgs, lib, ... }: +let + # a custom qlcplus desktop file to launch in kiosk mode with the correct workspace + qlcplus_launcher_entry = pkgs.writeText "qlcplus.desktop" '' + [Desktop Entry] + Type=Application + Name=Q Light Controller Plus + GenericName=Lighting control + Keywords=qlc;light;controller;dmx;analog;midi;artnet;e131;osc; + Exec=${pkgs.qlcplus}/bin/qlcplus --kiosk --open /home/stube/.stube.qxw + Icon=qlcplus + MimeType=application/x-qlc-workspace; + Categories=Qt;AudioVideo; + X-XFCE-Source=${pkgs.qlcplus}/share/applications/qlcplus.desktop + ''; + + custom-menu-file = pkgs.writeText "custom.menu" '' + + + + Xfce + + + + + + xfce4-file-manager.desktop + xfce4-web-browser.desktop + shutdown.desktop + restart.desktop + + + + xfce4-file-manager.desktop + xfce4-web-browser.desktop + + + + shutdown.desktop + restart.desktop + + + + Development + xfce-development.directory + + Development + + + + + Education + xfce-education.directory + + Education + + + math.desktop + + + + + Games + xfce-games.directory + + Game + + + + + Graphics + xfce-graphics.directory + + Graphics + + + draw.desktop + + + + + Multimedia + xfce-multimedia.directory + + Audio + Video + AudioVideo + + + qlcplus-fixtureeditor.desktop + + + + + Network + xfce-network.directory + + Network + + + + xfce4-mail-reader.desktop + xfce4-web-browser.desktop + xfce4-web-browser.desktop + firefox.desktop + + + + + + Office + xfce-office.directory + + Office + + + + + Science + xfce-science.directory + + Science + + + math.desktop + + + + + System + xfce-system.directory + + + Emulator + System + + + + xfce4-session-logout.desktop + + + + Settings + xfce-settings.directory + + Settings + + + + xfce-settings-manager.desktop + + + + + + Screensavers + xfce-screensavers.directory + + Screensaver + + + + + + Accessories + xfce-accessories.directory + + + Accessibility + Core + Legacy + Utility + + qlcplus-fixtureeditor.desktop + + + + + xfce4-file-manager.desktop + xfce4-terminal-emulator.desktop + xfce4-about.desktop + xfce4-run.desktop + + + + + + + Other + xfce-other.directory + + + + + + + + + ''; +in +{ + + home.persistence."/persist/home/stube" = { + files = [ + ".stube.qxw" + ]; + directories = [ + ".mixxx" + # xfconf.settings needs an existing installation + ".config/xfce4" + ]; + allowOther = false; + }; + + home.activation.restart-xfce4-panel = lib.hm.dag.entryAfter ["writeBoundary"] '' + run /bin/sh -c "${pkgs.xfce.xfce4-panel}/bin/xfce4-panel -r || true" + ''; + xfconf.settings = { + xfwm4 = { + "general/workspace_count" = 1; + }; + xfce4-power-manager = { + "xfce4-power-manager/presentation-mode" = true; + "xfce4-power-manager/lock-screen-suspend-hibernate" = false; + }; + xfce4-notifyd."do-not-disturb" = true; + xfce4-panel = { + "plugins/plugin-100" = "applicationsmenu"; + "plugins/plugin-100/custom-menu" = true; + "plugins/plugin-100/custom-menu-file" = "${custom-menu-file}"; + "plugins/plugin-100/button-icon" = "org.xfce.panel.actions"; + "plugins/plugin-100/button-title" = "Anwendungen"; + "plugins/plugin-110" = "separator"; + "plugins/plugin-110/style" = 0; + "plugins/plugin-101" = "tasklist"; + "plugins/plugin-101/grouping" = "1"; + "plugins/plugin-101/show-handle" = false; + "plugins/plugin-102" = "separator"; + "plugins/plugin-102/expand" = true; + "plugins/plugin-102/style" = 0; + "plugins/plugin-103" = "systray"; + "plugins/plugin-103/square-icons" = true; + "plugins/plugin-104" = "separator"; + "plugins/plugin-104/style" = 0; + "plugins/plugin-105" = "pulseaudio"; + "plugins/plugin-105/enable-keyboard-shortcuts" = true; + "plugins/plugin-106" = "separator"; + "plugins/plugin-106/style" = 0; + "plugins/plugin-107" = "clock"; + "plugins/plugin-107/digital-date-format" = "%d %b %Y"; + "plugins/plugin-108" = "separator"; + "plugins/plugin-108/style" = 0; + /* + "plugins/plugin-109" = "actions"; + "plugins/plugin-109/items" = [ + "-lock-screen" + "-switch-user" + "-separator" + "-suspend" + "-hibernate" + "-hybrid-sleep" + "-separator" + "+shutdown" + "-restart" + "-separator" + "-logout" + "-logout-dialog" + ]; + */ + "panels/panel-1/plugin-ids" = [ 100 110 101 102 103 104 105 106 107 108 ]; + + "plugins/plugin-200" = "showdesktop"; + "plugins/plugin-201" = "launcher"; + "plugins/plugin-201/items" = ["${pkgs.xfce.xfce4-settings}/share/applications/xfce4-file-manager.desktop"]; + + "plugins/plugin-210" = "separator"; + "plugins/plugin-210/style" = 0; + + "plugins/plugin-211" = "launcher"; + "plugins/plugin-211/items" = ["${pkgs.firefox}/share/applications/firefox.desktop"]; + "plugins/plugin-212" = "launcher"; + "plugins/plugin-212/items" = ["${pkgs.spotify}/share/applications/spotify.desktop"]; + "plugins/plugin-213" = "launcher"; + "plugins/plugin-213/items" = ["${pkgs.mixxx}/share/applications/org.mixxx.Mixxx.desktop"]; + + "plugins/plugin-220" = "separator"; + "plugins/plugin-220/style" = 0; + + + "plugins/plugin-221" = "launcher"; + "plugins/plugin-221/items" = [ "${qlcplus_launcher_entry}" ]; + + "panels/panel-2/plugin-ids" = [ 200 201 210 211 212 213 220 221 ]; + }; + xfce4-desktop = { + "backdrop/screen0/monitorVirtual-1/workspace0/last-image" = "${./background.jpg}"; + "desktop-icons/file-icons/show-home" = false; + "desktop-icons/file-icons/show-filesystem" = false; + "desktop-icons/file-icons/show-trash" = false; + }; + }; + + xdg.desktopEntries.shutdown = { + name = "Herunterfahren"; + terminal = false; + icon = "xfsm-shutdown"; + exec = "shutdown -h now"; + }; + xdg.desktopEntries.restart = { + name = "Neustarten"; + terminal = false; + icon = "xfsm-reboot"; + exec = "reboot"; + }; + + + home.packages = with pkgs; [ + qlcplus + spotify + mixxx + vlc + mpv + libreoffice-still + ]; + + programs.firefox = { + enable = true; + profiles.default = { + settings = { + "browser.startup.homepage" = "https://duckduckgo.com"; + "general.useragent.locale" = "de-DE"; + }; + search = { + default = "DuckDuckGo"; + force = true; + }; + /* + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + decentraleyes + privacy-badger + ]; + */ + }; + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisableFirefoxAccounts = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + DontCheckDefaultBrowser = true; + DisplayBookmarksToolbar = "never"; + DisplayMenuBar = "default-off"; + SearchBar = "unified"; + + ExtensionSettings = { + "*".installation_mode = "blocked"; + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + /* + "jid1-MnnxcxisBPnSXQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; + installation_mode = "force_installed"; + }; + "jid1-BoFifL9Vbdl2zQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/decentraleyes/latest.xpi"; + installation_mode = "force_installed"; + }; + */ + }; + }; + }; + + home.stateVersion = "24.05"; +} diff --git a/stube-pc/system.nix b/stube-pc/system.nix new file mode 100644 index 0000000..87ddf5d --- /dev/null +++ b/stube-pc/system.nix @@ -0,0 +1,88 @@ +{ self, config, pkgs, lib, ...}: { + imports = [ ./hardware-configuration.nix ]; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "spotify" ]; + + boot.loader.grub = { + enable = true; + device = "/dev/sda"; + }; + + boot.loader.timeout = 1; + + networking.hostName = "stube-pc"; + networking.networkmanager.enable = true; + networking.firewall.enable = true; + + time.timeZone = "Europe/Berlin"; + + users.mutableUsers = false; + users.users.root.password = "start1234"; + users.users.stube = { + isNormalUser = true; + extraGroups = [ "networkmanager" ]; + password = "stube"; + }; + + systemd.services."display-manager".after = [ "home-manager-stube.service" ]; + + console.keyMap = "de"; + + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + services.xserver = { + enable = true; + xkb.layout = "de"; + desktopManager.xfce.enable = true; + }; + services.displayManager = { + enable = true; + defaultSession = "xfce"; + autoLogin = { + enable = true; + user = "stube"; + }; + }; + services.xserver.displayManager.lightdm.greeter.enable = false; + services.xserver.displayManager.lightdm.autoLogin.timeout = 0; + services.xserver.desktopManager.xfce.enableScreensaver = false; + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + environment.systemPackages = with pkgs; [ + vim + xfce.xfce4-pulseaudio-plugin + pavucontrol + ]; + + environment.etc."current-nixos".source = self; + + environment.persistence."/persist" = { + enable = true; + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + ]; + }; + + security.polkit.enable = true; + + system.stateVersion = "24.05"; +}