diff --git a/autologin.nix b/autologin.nix deleted file mode 100644 index f501412..0000000 --- a/autologin.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, pkgs, ... }: - -let cfg = config.autologin; -in -{ - options = { - autologin.username = pkgs.lib.mkOption { - description = "Username of user to be automatically logged in at tty1"; - }; - }; - config = { - systemd.services."autovt@tty1".description = "Autologin at the TTY1"; - systemd.services."autovt@tty1".after = [ "systemd-logind.service" ]; # without it user session not started and xorg can't be run from this tty - systemd.services."autovt@tty1".wantedBy = [ "multi-user.target" ]; - systemd.services."autovt@tty1".serviceConfig = { - ExecStart = [ - "" # override upstream default with an empty ExecStart - "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login --autologin '${cfg.username}' --noclear %I $TERM" - ]; - Restart = "always"; - Type = "idle"; - }; - }; -} diff --git a/fish.nix b/fish.nix deleted file mode 100644 index 79c14d9..0000000 --- a/fish.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - unstable.fish - ]; - programs.fish.enable = true; -} - diff --git a/flake.nix b/flake.nix index 1f46d00..701c036 100644 --- a/flake.nix +++ b/flake.nix @@ -53,7 +53,7 @@ modules = [ (./machines + "/${hostname}/configuration.nix") - + ./modules { _module.args.inputs = inputs; } diff --git a/hardware/brother/hl3172cdw.nix b/hardware/brother/hl3172cdw.nix deleted file mode 100644 index 928c71d..0000000 --- a/hardware/brother/hl3172cdw.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - services.printing.enable = true; - services.printing.drivers = [ - pkgs.brlaser - ]; -} - diff --git a/hardware/cadmium.nix b/hardware/cadmium.nix deleted file mode 100644 index a8a721d..0000000 --- a/hardware/cadmium.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ -} diff --git a/hardware/t14.nix b/hardware/t14.nix deleted file mode 100644 index a8a721d..0000000 --- a/hardware/t14.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ -} diff --git a/hardware/t520.nix b/hardware/t520.nix deleted file mode 100644 index dd2bf71..0000000 --- a/hardware/t520.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - boot.initrd.availableKernelModules = [ - "i915" - ]; - - environment.systemPackages = with pkgs; [ - intel-media-driver - libva - libva-utils - libva1 - ]; - hardware.opengl.extraPackages = lib.singleton pkgs.vaapiIntel; -} diff --git a/machines/cadmium/configuration.nix b/machines/cadmium/configuration.nix index 1bd2eae..f19c219 100644 --- a/machines/cadmium/configuration.nix +++ b/machines/cadmium/configuration.nix @@ -1,51 +1,10 @@ -# 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, ... }: { - imports = - [ - ./hardware-configuration.nix - ../../hardware/cadmium.nix - ../../sway.nix - ../../unstable.nix - ../../fish.nix - ../../autologin.nix - ../../obs.nix - ../../pipewire.nix - ]; - - hardware.cpu.intel.updateMicrocode = true; - powerManagement.cpuFreqGovernor = "performance"; - - nix.autoOptimiseStore = true; - nix.useSandbox = true; - - boot = { - kernelParams = [ "radeon.dpm=1" ]; - loader = { - systemd-boot.enable = true; - efi.efiSysMountPoint = "/boot"; - efi.canTouchEfiVariables = true; - }; - initrd = { - availableKernelModules = [ - "aes_generic" - "cryptd" - "nvme" - "xhci_pci" - ]; - luks.devices = { - pvcrypt = { - device = "/dev/disk/by-uuid/b706883f-3979-41ea-b72e-497c0ada5092"; - preLVM = true; - allowDiscards = true; - }; - }; - }; - }; + imports = [ + ./hardware-configuration.nix + ../../home-manager/users/jalr.nix + ]; networking = { hostName = "cadmium"; @@ -63,18 +22,10 @@ ]; }; extraHosts = '' - #10.10.10.10 example.com + #10.10.10.10 example.com ''; }; - i18n.defaultLocale = "de_DE.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "neo"; - }; - - time.timeZone = "UTC"; - environment.systemPackages = with pkgs; [ file fzf @@ -94,14 +45,6 @@ virt-manager ]; - xdg.icons.enable = true; - - fonts.fonts = with pkgs; [ - powerline-fonts - roboto - font-awesome - ]; - environment.variables.EDITOR = "nvim"; nixpkgs.overlays = [ @@ -116,9 +59,9 @@ programs.mtr.enable = true; programs.gnupg.agent = { - enable = true; - pinentryFlavor = "gnome3"; - }; + enable = true; + pinentryFlavor = "gnome3"; + }; hardware.bluetooth.enable = true; services.blueman.enable = true; @@ -152,22 +95,11 @@ security.polkit.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.jalr = { - isNormalUser = true; - extraGroups = [ - "dialout" - "docker" - "libvirtd" - "networkmanager" - "video" - "wheel" - ]; # Enable ‘sudo’ for the user. - shell = pkgs.fish; + myConfig = { + gui.enable = true; + autologin.enable = true; }; - autologin.username = "jalr"; - # 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 diff --git a/machines/cadmium/hardware-configuration.nix b/machines/cadmium/hardware-configuration.nix index 9dfe46f..b44d53f 100644 --- a/machines/cadmium/hardware-configuration.nix +++ b/machines/cadmium/hardware-configuration.nix @@ -1,33 +1,58 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ modulesPath, ... }: { imports = [ "${modulesPath}/installer/scan/not-detected.nix" ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot = { + initrd = { + availableKernelModules = [ + "aes_generic" + "ahci" + "cryptd" + "ehci_pci" + "nvme" + "sd_mod" + "sr_mod" + "usb_storage" + "usbhid" + "xhci_pci" + ]; + kernelModules = [ "dm-snapshot" ]; + luks.devices = { + pvcrypt = { + device = "/dev/disk/by-uuid/b706883f-3979-41ea-b72e-497c0ada5092"; + preLVM = true; + allowDiscards = true; + }; + }; + }; + kernelModules = [ "kvm-amd" ]; + kernelParams = [ "radeon.dpm=1" ]; + loader = { + systemd-boot.enable = true; + efi.efiSysMountPoint = "/boot"; + efi.canTouchEfiVariables = true; + }; + }; - fileSystems."/" = - #{ device = "/dev/disk/by-uuid/d6302c3c-1100-4cc4-86d7-fc3a84db9a37"; - { device = "/dev/disk/by-uuid/6de83731-af29-4ba2-a0b2-48d3a1f5537e"; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/6de83731-af29-4ba2-a0b2-48d3a1f5537e"; fsType = "ext4"; }; - fileSystems."/boot" = - #{ device = "/dev/disk/by-uuid/BBF2-C8B1"; - { device = "/dev/disk/by-uuid/D384-54D8"; + "/boot" = { + device = "/dev/disk/by-uuid/D384-54D8"; fsType = "vfat"; }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/f14ae966-ac3f-467f-9263-ba9136967782"; + "/home" = { + device = "/dev/disk/by-uuid/f14ae966-ac3f-467f-9263-ba9136967782"; fsType = "ext4"; noCheck = true; }; + }; - swapDevices = [ ]; - - nix.maxJobs = lib.mkDefault 8; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + nix.maxJobs = 8; + powerManagement.cpuFreqGovernor = "powersave"; } diff --git a/machines/hafnium/configuration.nix b/machines/hafnium/configuration.nix index 2a6e15d..ce3cbe1 100644 --- a/machines/hafnium/configuration.nix +++ b/machines/hafnium/configuration.nix @@ -1,36 +1,10 @@ -# 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, ... }: { - imports = - [ - ./hardware-configuration.nix - ../../hardware/t14.nix - ../../sway.nix - ../../unstable.nix - ../../fish.nix - ../../autologin.nix - ../../obs.nix - ../../lxc.nix - ../../pipewire.nix - ]; - - nix.autoOptimiseStore = true; - nix.useSandbox = true; - - # Use the systemd-boot EFI boot loader. - boot = { - loader = { - systemd-boot.enable = true; - efi = { - efiSysMountPoint = "/boot/efi"; - canTouchEfiVariables = true; - }; - }; - }; + imports = [ + ./hardware-configuration.nix + ../../home-manager/users/jal.nix + ]; networking = { hostName = "hafnium"; @@ -52,26 +26,29 @@ ]; }; extraHosts = '' - #10.10.10.10 example.com - #10.158.228.70 support.demo.core.tradebyte.com - #10.158.228.28 demo.core.tradebyte.com - #10.158.227.210 supporttest.tradebyte.com - #10.158.227.132 test.tradebyte.com - #10.158.227.23 sandbox.tradebyte.com - #10.158.227.89 supportsandbox.tradebyte.com - 10.158.226.157 staging.tradebyte.com - 10.158.226.209 supportstaging.tradebyte.com + #10.10.10.10 example.com + #10.158.228.70 support.demo.core.tradebyte.com + #10.158.228.28 demo.core.tradebyte.com + #10.158.227.210 supporttest.tradebyte.com + #10.158.227.132 test.tradebyte.com + #10.158.227.23 sandbox.tradebyte.com + #10.158.227.89 supportsandbox.tradebyte.com + 10.158.226.157 staging.tradebyte.com + 10.158.226.209 supportstaging.tradebyte.com ''; }; - i18n.defaultLocale = "de_DE.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "neo"; + # Use the systemd-boot EFI boot loader. + boot = { + loader = { + systemd-boot.enable = true; + efi = { + efiSysMountPoint = "/boot/efi"; + canTouchEfiVariables = true; + }; + }; }; - time.timeZone = "UTC"; - environment.systemPackages = with pkgs; [ brightnessctl file @@ -93,14 +70,6 @@ virt-manager ]; - xdg.icons.enable = true; - - fonts.fonts = with pkgs; [ - powerline-fonts - roboto - font-awesome - ]; - environment.variables.EDITOR = "nvim"; nixpkgs.overlays = [ @@ -113,10 +82,10 @@ ]; programs.mtr.enable = true; - + programs.gnupg.agent = { - enable = true; - pinentryFlavor = "gnome3"; + enable = true; + pinentryFlavor = "gnome3"; }; hardware.bluetooth.enable = true; @@ -124,7 +93,7 @@ services.ofono.enable = true; services.udisks2.enable = true; - + services.openssh.enable = true; services.udev.extraRules = '' @@ -149,22 +118,13 @@ security.polkit.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.jal = { - isNormalUser = true; - extraGroups = [ - "dialout" - "docker" - "libvirtd" - "networkmanager" - "video" - "wheel" - ]; # Enable ‘sudo’ for the user. - shell = pkgs.fish; + myConfig = { + gui.enable = true; + autologin.enable = true; + autologin.username = "jal"; + tradebyte.enable = true; }; - autologin.username = "jal"; - networking.wg-quick.interfaces.tbcore = { address = [ "172.27.27.16/32" diff --git a/machines/hafnium/hardware-configuration.nix b/machines/hafnium/hardware-configuration.nix index 7f5e39c..5133e09 100644 --- a/machines/hafnium/hardware-configuration.nix +++ b/machines/hafnium/hardware-configuration.nix @@ -1,14 +1,21 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ modulesPath, ... }: { imports = [ "${modulesPath}/installer/scan/not-detected.nix" ]; - boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot = { + initrd.availableKernelModules = [ + "nvme" + "ehci_pci" + "xhci_pci" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; + kernelModules = [ "kvm-amd" ]; + }; fileSystems = { "/" = { @@ -18,7 +25,7 @@ "discard=async" "noatime" "subvol=/nixos" - "compress=zstd:12" + "compress=zstd:6" ]; }; "/boot" = { @@ -35,7 +42,4 @@ device = "/dev/disk/by-uuid/d9b120c1-5e80-4893-92fe-497e5b44c25b"; allowDiscards = true; }; - - swapDevices = [ ]; - } diff --git a/machines/jalr-t520/configuration.nix b/machines/jalr-t520/configuration.nix index 76e74da..bad358d 100644 --- a/machines/jalr-t520/configuration.nix +++ b/machines/jalr-t520/configuration.nix @@ -1,69 +1,17 @@ -# 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, ... }: { - imports = - [ - ./hardware-configuration.nix - ../../hardware/t520.nix - ../../hardware/brother/hl3172cdw.nix - ../../sway.nix - ../../unstable.nix - ../../fish.nix - ../../autologin.nix - ../../hardware/brother/p-touch_p700.nix - ../../obs.nix - ]; - - nix = { - autoOptimiseStore = true; - trustedUsers = [ - "@wheel" - ]; - package = pkgs.nixUnstable; # FIXME: can be removed with NixOS 21.11 - extraOptions = '' - experimental-features = nix-command flakes - ''; - }; - - hardware.cpu.intel.updateMicrocode = true; - - boot.loader.grub = { - enable = true; - version = 2; - device = "/dev/sda"; - }; - - boot.initrd.availableKernelModules = [ - "aes_generic" - "aesni_intel" - "cryptd" + imports = [ + ./hardware-configuration.nix + ../../home-manager/users/jalr.nix ]; - boot.initrd.luks.devices = { - pvcrypt = { - device = "/dev/disk/by-uuid/3a1a8fec-b028-45c0-8432-7fcbe4615f44"; - preLVM = true; - }; - }; - networking = { hostName = "jalr-t520"; networkmanager.enable = true; useDHCP = false; }; - i18n.defaultLocale = "de_DE.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "neo"; - }; - - time.timeZone = "UTC"; - # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ @@ -80,14 +28,6 @@ virt-manager ]; - xdg.icons.enable = true; - - fonts.fonts = with pkgs; [ - powerline-fonts - roboto - font-awesome - ]; - environment.variables.EDITOR = "nvim"; nixpkgs.overlays = [ @@ -101,20 +41,12 @@ programs.mtr.enable = true; programs.wireshark.enable = true; - + programs.gnupg.agent = { - enable = true; - pinentryFlavor = "gnome3"; + enable = true; + pinentryFlavor = "gnome3"; }; - sound.enable = true; - hardware.pulseaudio.enable = true; - - hardware.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ]; - - obs.kernel.packages = pkgs.linuxPackages_latest; - boot.kernelPackages = pkgs.linuxPackages_latest; - hardware.bluetooth.enable = true; hardware.sane.enable = true; @@ -152,25 +84,11 @@ security.polkit.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.jalr = { - isNormalUser = true; - extraGroups = [ - "dialout" - "docker" - "libvirtd" - "lp" - "networkmanager" - "scanner" - "video" - "wheel" - "wireshark" - ]; # Enable ‘sudo’ for the user. - shell = pkgs.fish; + myConfig = { + gui.enable = true; + autologin.enable = true; }; - autologin.username = "jalr"; - networking.wg-quick.interfaces.wgkalle = { address = [ "172.16.254.5/24" diff --git a/machines/jalr-t520/hardware-configuration.nix b/machines/jalr-t520/hardware-configuration.nix index 4b9a1b0..9de7155 100644 --- a/machines/jalr-t520/hardware-configuration.nix +++ b/machines/jalr-t520/hardware-configuration.nix @@ -1,27 +1,63 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ lib, pkgs, modulesPath, ... }: { imports = [ "${modulesPath}/installer/scan/not-detected.nix" ]; - boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot = { + loader.grub = { + enable = true; + version = 2; + device = "/dev/sda"; + }; + initrd = { + availableKernelModules = [ + "aes_generic" + "aesni_intel" + "ahci" + "cryptd" + "ehci_pci" + "firewire_ohci" + "i915" + "sd_mod" + "sdhci_pci" + "usb_storage" + "usbhid" + ]; + kernelModules = [ "dm-snapshot" ]; + luks.devices = { + pvcrypt = { + device = "/dev/disk/by-uuid/3a1a8fec-b028-45c0-8432-7fcbe4615f44"; + preLVM = true; + }; + }; + }; + kernelModules = [ "kvm-intel" ]; + }; - fileSystems."/" = - { device = "/dev/disk/by-uuid/62e31097-dc6e-4f91-a043-1a6b8a154201"; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/62e31097-dc6e-4f91-a043-1a6b8a154201"; fsType = "ext4"; }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/c4df83d7-8985-47df-b5cd-bf18bd490a50"; + "/boot" = { + device = "/dev/disk/by-uuid/c4df83d7-8985-47df-b5cd-bf18bd490a50"; fsType = "ext2"; }; + }; - swapDevices = [ ]; + nix.maxJobs = 4; - nix.maxJobs = lib.mkDefault 4; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = true; + + powerManagement.cpuFreqGovernor = "performance"; + + environment.systemPackages = with pkgs; [ + intel-media-driver + libva + libva-utils + libva1 + ]; + hardware.opengl.extraPackages = lib.singleton pkgs.vaapiIntel; } diff --git a/modules/autologin.nix b/modules/autologin.nix new file mode 100644 index 0000000..c9f0f15 --- /dev/null +++ b/modules/autologin.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.myConfig; +in +{ + options.myConfig = { + autologin = { + enable = pkgs.lib.mkEnableOption "Enable tty1 autologin"; + username = pkgs.lib.mkOption { + type = lib.types.str; + description = "Username of user to be automatically logged in at tty1"; + }; + }; + }; + config = lib.mkIf cfg.autologin.enable { + systemd.services."autovt@tty1" = { + description = "Autologin at the TTY1"; + after = [ "systemd-logind.service" ]; # without it user session not started and xorg can't be run from this tty + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = [ + "" # override upstream default with an empty ExecStart + "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login --autologin '${cfg.autologin.username}' --noclear %I $TERM" + ]; + Restart = "always"; + Type = "idle"; + }; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..9358548 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,20 @@ +{ lib, ... }: + +{ + options.myConfig = { + gui.enable = lib.mkEnableOption "GUI"; + }; + + imports = [ + ./autologin.nix + ./fonts.nix + ./localization.nix + ./nix.nix + ./obs.nix + ./pipewire.nix + ./printers + ./sdr.nix + ./sway.nix + ./tradebyte + ]; +} diff --git a/modules/fonts.nix b/modules/fonts.nix new file mode 100644 index 0000000..ba2fee6 --- /dev/null +++ b/modules/fonts.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: + +{ + console.font = "Lat2-Terminus16"; + fonts.fonts = with pkgs; lib.mkIf config.myConfig.gui.enable [ + powerline-fonts + roboto + font-awesome + ]; +} diff --git a/modules/localization.nix b/modules/localization.nix new file mode 100644 index 0000000..3c3d813 --- /dev/null +++ b/modules/localization.nix @@ -0,0 +1,19 @@ +{ + i18n = { + defaultLocale = "en_GB.UTF-8"; + extraLocaleSettings = { + LC_MONETARY = "de_DE.UTF-8"; + }; + }; + + console.keyMap = "neo"; + + time.timeZone = "UTC"; + + location = { + latitude = 49.5; + longitude = 10.5; + }; +} + + diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..3297e3b --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: + +{ + nix = { + trustedUsers = [ "@wheel" ]; + + package = pkgs.nixUnstable; # FIXME: can be removed with NixOS 21.11 + extraOptions = '' + experimental-features = nix-command flakes + ''; + + daemonNiceLevel = 19; + daemonIONiceLevel = 7; + + autoOptimiseStore = true; + }; +} diff --git a/obs.nix b/modules/obs.nix similarity index 54% rename from obs.nix rename to modules/obs.nix index 239ba32..18fd2fd 100644 --- a/obs.nix +++ b/modules/obs.nix @@ -1,23 +1,22 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.myConfig.gui.enable { boot = { - kernelPackages = pkgs.linuxPackages_latest; - extraModulePackages = [ - (pkgs.linuxPackages_latest.v4l2loopback.overrideAttrs ({ ... }: { - src = pkgs.fetchFromGitHub { - owner = "umlaeute"; - repo = "v4l2loopback"; - # master 2020-04-17 - rev = "10b1c7e6bda4255fdfaa187ce2b3be13433416d2"; - sha256 = "0xsn4yzj7lwdg0n7q3rnqpz07i9i011k2pwn06hasd45313zf8j2"; - }; - })) - ]; kernelModules = [ "v4l2loopback" ]; extraModprobeConfig = '' options v4l2loopback exclusive_caps=1 card_label=OBS video_nr=10 ''; + extraModulePackages = [ + (pkgs.linuxPackages.v4l2loopback.overrideAttrs ({ ... }: { + src = pkgs.fetchFromGitHub { + owner = "umlaeute"; + repo = "v4l2loopback"; + rev = "edf0f10bc079e5e3922bddbb8185dc626ab14a1b"; + sha256 = "nHwC6/miECn8RuAeWoOxYv+9NWcBeeGHlcr0ai827Uo="; + fetchSubmodules = false; + }; + })) + ]; }; environment.systemPackages = with pkgs; [ v4l-utils diff --git a/pipewire.nix b/modules/pipewire.nix similarity index 64% rename from pipewire.nix rename to modules/pipewire.nix index 968aa5d..8749d8f 100644 --- a/pipewire.nix +++ b/modules/pipewire.nix @@ -1,5 +1,12 @@ { config, lib, pkgs, ... }: -{ + +lib.mkIf config.myConfig.gui.enable { + sound.enable = true; + hardware.pulseaudio.enable = false; + + # FIXME + #hardware.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ]; + services.pipewire = { enable = true; pulse = { @@ -18,9 +25,4 @@ pavucontrol pulseaudio # pacmd and pactl ]; - - xdg.portal = { - enable = true; - extraPortals = [pkgs.xdg-desktop-portal-wlr]; - }; } diff --git a/modules/printers/default.nix b/modules/printers/default.nix new file mode 100644 index 0000000..a29723f --- /dev/null +++ b/modules/printers/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./hl3172cdw.nix + ./p-touch_p700.nix + ]; +} + diff --git a/modules/printers/hl3172cdw.nix b/modules/printers/hl3172cdw.nix new file mode 100644 index 0000000..49ae01e --- /dev/null +++ b/modules/printers/hl3172cdw.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ... }: + +lib.mkIf config.myConfig.gui.enable { + services.printing = { + enable = true; + drivers = [ pkgs.brlaser ]; + }; +} + diff --git a/hardware/brother/p-touch_p700.nix b/modules/printers/p-touch_p700.nix similarity index 85% rename from hardware/brother/p-touch_p700.nix rename to modules/printers/p-touch_p700.nix index 2799acb..627ad56 100644 --- a/hardware/brother/p-touch_p700.nix +++ b/modules/printers/p-touch_p700.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: { services.udev.extraRules = '' diff --git a/modules/sdr.nix b/modules/sdr.nix new file mode 100644 index 0000000..55ff119 --- /dev/null +++ b/modules/sdr.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.myConfig; +in +{ + options.myConfig = { + sdr = { + enable = pkgs.lib.mkEnableOption "Enable software defined radio"; + }; + }; + config = lib.mkIf cfg.sdr.enable { + services.udev.extraRules = '' + # rad10 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="cc15", GROUP="users", MODE="0660" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6089", GROUP="users", MODE="0660" + ''; + }; +} diff --git a/sway.nix b/modules/sway.nix similarity index 54% rename from sway.nix rename to modules/sway.nix index 2582eb0..6b54ee5 100644 --- a/sway.nix +++ b/modules/sway.nix @@ -1,24 +1,9 @@ { config, lib, pkgs, ... }: -{ -# environment.systemPackages = with pkgs; [ -# sway -# ]; - -# nixpkgs.overlays = [ -# (self: super: { -# sway = super.neovim.override { -# extraOptions = [ -# "--unsupported-gpu" -# ]; -# }; -# }) -# ]; +lib.mkIf config.myConfig.gui.enable { programs.sway = { enable = true; -# extraOptions = [ -# "--unsupported-gpu" -# ]; + # FIXME: move to home manager extraPackages = with pkgs; [ alacritty grim @@ -32,15 +17,22 @@ wofi xwayland ]; - extraSessionCommands = - '' - export XKB_DEFAULT_LAYOUT=de - export XKB_DEFAULT_VARIANT=neo + extraSessionCommands = '' + export XKB_DEFAULT_LAYOUT=de # TODO: test if we need it + export XKB_DEFAULT_VARIANT=neo # TODO: test if we need it export QT_QPA_PLATFORM=wayland export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 export ELM_ENGINE=wayland_shm export GDK_BACKEND=wayland export _JAVA_AWT_WM_NONREPARENTING=1 - ''; + ''; + }; + + xdg = { + portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; + }; + icons.enable = true; }; } diff --git a/modules/tradebyte/default.nix b/modules/tradebyte/default.nix new file mode 100644 index 0000000..5b66860 --- /dev/null +++ b/modules/tradebyte/default.nix @@ -0,0 +1,12 @@ +{ lib, ... }: + +{ + options.myConfig = { + tradebyte.enable = lib.mkEnableOption "TB.config"; + }; + + imports = [ + ./lxc.nix + ]; +} + diff --git a/lxc.nix b/modules/tradebyte/lxc.nix similarity index 56% rename from lxc.nix rename to modules/tradebyte/lxc.nix index d97fed2..3cabfd4 100644 --- a/lxc.nix +++ b/modules/tradebyte/lxc.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: let dnsmasq = pkgs.dnsmasq; @@ -19,7 +19,7 @@ let server=127.0.0.1 ''; in -{ +lib.mkIf config.myConfig.tradebyte.enable { virtualisation = { lxc.enable = true; lxc.defaultConfig = '' @@ -50,39 +50,34 @@ in }; firewall.extraCommands = '' iptables -t mangle -A POSTROUTING -o lxcbr0 -p udp -j CHECKSUM --checksum-fill - ''; - networkmanager.unmanaged = ["lxcbr0"]; + ''; + networkmanager.unmanaged = [ "lxcbr0" ]; nat = { enable = true; - internalInterfaces = ["lxcbr0"]; - internalIPs = ["10.0.3.1"]; + internalInterfaces = [ "lxcbr0" ]; + internalIPs = [ "10.0.3.1" ]; }; }; systemd.services."dnsmasq-lxc" = { - description = "Dnsmasq Daemon for LXC"; - after = [ "network.target" "systemd-resolved.service" ]; - wantedBy = [ "multi-user.target" ]; - path = [ dnsmasq ]; - preStart = '' - mkdir -m 755 -p ${stateDir} - touch ${stateDir}/dnsmasq-lxc.leases - dnsmasq --test -C ${dnsmasqConf} - ''; - #chown -R dnsmasq ${stateDir} - #touch /etc/dnsmasq-{conf,resolv}.conf - serviceConfig = { - Type = "dbus"; - BusName = "uk.org.thekelleys.dnsmasq-lxc"; - ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}"; - ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; - PrivateTmp = true; - ProtectSystem = true; - ProtectHome = true; - Restart = "on-failure"; - }; - #restartTriggers = [ config.environment.etc.hosts.source ]; + description = "Dnsmasq Daemon for LXC"; + after = [ "network.target" "systemd-resolved.service" ]; + wantedBy = [ "multi-user.target" ]; + path = [ dnsmasq ]; + preStart = '' + mkdir -m 755 -p ${stateDir} + touch ${stateDir}/dnsmasq-lxc.leases + dnsmasq --test -C ${dnsmasqConf} + ''; + serviceConfig = { + Type = "dbus"; + BusName = "uk.org.thekelleys.dnsmasq-lxc"; + ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}"; + ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; + PrivateTmp = true; + ProtectSystem = true; + ProtectHome = true; + Restart = "on-failure"; + }; }; - - boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ]; } diff --git a/pulseaudio.nix b/pulseaudio.nix deleted file mode 100644 index d1959fa..0000000 --- a/pulseaudio.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - tap-plugins = pkgs.callPackage pkgs/tap-plugins/default.nix {}; - enable_bluetooth = config.hardware.bluetooth.enable; -in { - sound.enable = true; - hardware.pulseaudio = { - enable = true; - extraModules = if enable_bluetooth then [pkgs.pulseaudio-modules-bt] else []; - }; - - systemd.user.services.pulseaudio.environment = { - LD_LIBRARY_PATH = "${tap-plugins}/lib/ladspa"; - }; -} diff --git a/unstable.nix b/unstable.nix deleted file mode 100644 index 744f0ff..0000000 --- a/unstable.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, pkgs, ... }: - -let - unstableTarball = - fetchTarball - https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz; -in -{ - nixpkgs.config = { - packageOverrides = pkgs: { - unstable = import unstableTarball { - config = config.nixpkgs.config; - }; - }; - }; -}