diff --git a/default.nix b/default.nix deleted file mode 100755 index 56b4874..0000000 --- a/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -# This is balsoft's configuration file. -# -# https://github.com/balsoft/nixos-config -# -# This is main nixos configuration -# To use this configuration: -# 1. Add your own secret.nix and hardware-configuration/`hostname`.nix to this folder -# 2. Set the hostname to the desired one -# 3. `sudo nixos-rebuild switch --flake .` -# 4. Log in to application and services where neccesary - -{ config, pkgs, lib, inputs, name, ... }: -rec { - imports = [ - (./hardware-configuration + "/${name}.nix") - inputs.home-manager.nixosModules.home-manager - (import ./modules device) - ]; - - home-manager.users.balsoft.home.stateVersion = "20.09"; - - device = name; - - system.stateVersion = "18.03"; -} diff --git a/flake.nix b/flake.nix index 597a586..283e9fc 100644 --- a/flake.nix +++ b/flake.nix @@ -3,28 +3,28 @@ "A collection of crap, hacks and copy-paste to make my localhosts boot"; inputs = { - nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # nixpkgs-mesa.url = github:nixos/nixpkgs-channels/bdac777becdbb8780c35be4f552c9d4518fe0bdb; - lambda-launcher.url = github:balsoft/lambda-launcher; + lambda-launcher.url = "github:balsoft/lambda-launcher"; NUR = { - url = github:nix-community/NUR; + url = "github:nix-community/NUR"; flake = false; }; base16-unclaimed-schemes = { - url = github:chriskempson/base16-unclaimed-schemes; + url = "github:chriskempson/base16-unclaimed-schemes"; flake = false; }; - home-manager.url = github:rycee/home-manager; + home-manager.url = "github:rycee/home-manager"; materia-theme = { - url = github:nana-4/materia-theme; + url = "github:nana-4/materia-theme"; flake = false; }; nixpkgs-old = { - url = github:nixos/nixpkgs/nixos-19.09; + url = "github:nixos/nixpkgs/nixos-19.09"; flake = false; }; weechat-scripts = { - url = github:weechat/scripts; + url = "github:weechat/scripts"; flake = false; }; simple-nixos-mailserver = { @@ -32,11 +32,11 @@ flake = false; }; nixpkgs-wayland = { - url = github:colemickens/nixpkgs-wayland; + url = "github:colemickens/nixpkgs-wayland"; flake = false; }; weechat-notify-send = { - url = github:s3rvac/weechat-notify-send; + url = "github:s3rvac/weechat-notify-send"; flake = false; }; yt-utilities = { @@ -44,20 +44,28 @@ url = "ssh://git@github.com/serokell/yt-utilities"; ref = "flake"; }; - nixos-fhs-compat.url = github:balsoft/nixos-fhs-compat; - simple-osd-daemons.url = github:balsoft/simple-osd-daemons; + nixos-fhs-compat.url = "github:balsoft/nixos-fhs-compat"; + simple-osd-daemons.url = "github:balsoft/simple-osd-daemons"; }; outputs = { nixpkgs, nix, self, ... }@inputs: { + nixosModules = import ./modules; + + nixosProfiles = import ./profiles; + nixosConfigurations = with nixpkgs.lib; let - hosts = map (fname: builtins.head (builtins.match "(.*)\\.nix" fname)) - (builtins.attrNames (builtins.readDir ./hardware-configuration)); + hosts = builtins.attrNames (builtins.readDir ./machines); mkHost = name: nixosSystem { - system = "x86_64-linux"; - modules = [ (import ./default.nix) ]; - specialArgs = { inherit inputs name; }; + system = builtins.readFile (./machines + "/${name}/system"); + modules = [ + (import (./machines + "/${name}")) + { + device = name; + } + ]; + specialArgs = { inherit inputs; }; }; in genAttrs hosts mkHost; diff --git a/hardware-configuration/NixOS-VM.nix b/hardware-configuration/NixOS-VM.nix deleted file mode 100644 index 0db3279..0000000 --- a/hardware-configuration/NixOS-VM.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/machines/AMD-Workstation/default.nix b/machines/AMD-Workstation/default.nix new file mode 100644 index 0000000..158c6fb --- /dev/null +++ b/machines/AMD-Workstation/default.nix @@ -0,0 +1,18 @@ +{ inputs, ... }: { + imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop ]; + deviceSpecific.devInfo = { + cpu = { + vendor = "amd"; + clock = 4200; + cores = 8; + }; + drive = { + type = "ssd"; + speed = 6000; + size = 250; + }; + bigScreen = true; + ram = 32; + }; + services.apcupsd.enable = true; +} diff --git a/hardware-configuration/AMD-Workstation.nix b/machines/AMD-Workstation/hardware-configuration.nix similarity index 100% rename from hardware-configuration/AMD-Workstation.nix rename to machines/AMD-Workstation/hardware-configuration.nix diff --git a/machines/AMD-Workstation/system b/machines/AMD-Workstation/system new file mode 100644 index 0000000..9bdfd5f --- /dev/null +++ b/machines/AMD-Workstation/system @@ -0,0 +1 @@ +x86_64-linux \ No newline at end of file diff --git a/machines/RasPi-Server/default.nix b/machines/RasPi-Server/default.nix new file mode 100644 index 0000000..a60c0dc --- /dev/null +++ b/machines/RasPi-Server/default.nix @@ -0,0 +1,28 @@ +{ inputs, ... }: { + imports = with inputs.self.nixosModules; [ + ./hardware-configuration.nix + inputs.self.nixosProfiles.server + gitea + jitsi + mailserver + matrix-synapse + minidlna + nextcloud + nginx + vsftpd + ]; + deviceSpecific.devInfo = { + cpu = { + vendor = "broadcom"; + clock = 4200; + cores = 8; + }; + drive = { + type = "ssd"; + speed = 6000; + size = 250; + }; + bigScreen = true; + ram = 32; + }; +} diff --git a/machines/RasPi-Server/hardware-configuration.nix b/machines/RasPi-Server/hardware-configuration.nix new file mode 100644 index 0000000..297c9ae --- /dev/null +++ b/machines/RasPi-Server/hardware-configuration.nix @@ -0,0 +1,24 @@ +# 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 + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/machines/RasPi-Server/system b/machines/RasPi-Server/system new file mode 100644 index 0000000..ab65297 --- /dev/null +++ b/machines/RasPi-Server/system @@ -0,0 +1 @@ +aarch64-linux \ No newline at end of file diff --git a/machines/T420-Laptop/default.nix b/machines/T420-Laptop/default.nix new file mode 100644 index 0000000..cc9c11c --- /dev/null +++ b/machines/T420-Laptop/default.nix @@ -0,0 +1,17 @@ +{ inputs, ... }: { + imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop ]; + deviceSpecific.devInfo = { + legacy = false; + cpu = { + vendor = "intel"; + clock = 2500; + cores = 2; + }; + drive = { + type = "ssd"; + speed = 1000; + size = 120; + }; + ram = 8; + }; +} diff --git a/hardware-configuration/T420-Laptop.nix b/machines/T420-Laptop/hardware-configuration.nix similarity index 100% rename from hardware-configuration/T420-Laptop.nix rename to machines/T420-Laptop/hardware-configuration.nix diff --git a/machines/T420-Laptop/system b/machines/T420-Laptop/system new file mode 100644 index 0000000..9bdfd5f --- /dev/null +++ b/machines/T420-Laptop/system @@ -0,0 +1 @@ +x86_64-linux \ No newline at end of file diff --git a/machines/T490s-Laptop/default.nix b/machines/T490s-Laptop/default.nix new file mode 100644 index 0000000..afcf46c --- /dev/null +++ b/machines/T490s-Laptop/default.nix @@ -0,0 +1,75 @@ +{ inputs, ... }: { + imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop ]; + deviceSpecific.devInfo = { + cpu = { + vendor = "intel"; + clock = 4600; + cores = 4; + }; + drive = { + type = "ssd"; + speed = 2000; + size = 250; + }; + ram = 16; + }; + services.throttled = { + enable = true; + extraConfig = '' + [GENERAL] + # Enable or disable the script execution + Enabled: True + # SYSFS path for checking if the system is running on AC power + Sysfs_Power_Path: /sys/class/power_supply/AC*/online + + ## Settings to apply while connected to Battery power + [BATTERY] + # Update the registers every this many seconds + Update_Rate_s: 30 + # Max package power for time window #1 + PL1_Tdp_W: 29 + # Time window #1 duration + PL1_Duration_s: 28 + # Max package power for time window #2 + PL2_Tdp_W: 44 + # Time window #2 duration + PL2_Duration_S: 0.002 + # Max allowed temperature before throttling + Trip_Temp_C: 85 + # Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL) + cTDP: 1 + + ## Settings to apply while connected to AC power + [AC] + # Update the registers every this many seconds + Update_Rate_s: 5 + # Max package power for time window #1 + PL1_Tdp_W: 44 + # Time window #1 duration + PL1_Duration_s: 28 + # Max package power for time window #2 + PL2_Tdp_W: 44 + # Time window #2 duration + PL2_Duration_S: 0.002 + # Max allowed temperature before throttling + Trip_Temp_C: 95 + # Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL) + HWP_Mode: True + # Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL) + cTDP: 2 + + [UNDERVOLT] + # CPU core voltage offset (mV) + CORE: -200 + # Integrated GPU voltage offset (mV) + GPU: -60 + # CPU cache voltage offset (mV) + CACHE: -50 + # System Agent voltage offset (mV) + UNCORE: 0 + # Analog I/O voltage offset (mV) + ANALOGIO: 0 + ''; + }; + +} diff --git a/hardware-configuration/T490s-Laptop.nix b/machines/T490s-Laptop/hardware-configuration.nix similarity index 100% rename from hardware-configuration/T490s-Laptop.nix rename to machines/T490s-Laptop/hardware-configuration.nix diff --git a/machines/T490s-Laptop/system b/machines/T490s-Laptop/system new file mode 100644 index 0000000..9bdfd5f --- /dev/null +++ b/machines/T490s-Laptop/system @@ -0,0 +1 @@ +x86_64-linux \ No newline at end of file diff --git a/machines/X2100-Laptop/default.nix b/machines/X2100-Laptop/default.nix new file mode 100644 index 0000000..092a9e5 --- /dev/null +++ b/machines/X2100-Laptop/default.nix @@ -0,0 +1,19 @@ +{ inputs, ... }: { + imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop ]; + deviceSpecific.devInfo = { + cpu = { + vendor = "intel"; + clock = 4800; + cores = 4; + }; + drive = { + type = "ssd"; + speed = 6000; + size = 256; + }; + ram = 16; + }; + boot.extraModprobeConfig = '' + options iwlwifi bt_coex_active=0 + ''; +} diff --git a/hardware-configuration/X2100-Laptop.nix b/machines/X2100-Laptop/hardware-configuration.nix similarity index 100% rename from hardware-configuration/X2100-Laptop.nix rename to machines/X2100-Laptop/hardware-configuration.nix diff --git a/machines/X2100-Laptop/system b/machines/X2100-Laptop/system new file mode 100644 index 0000000..9bdfd5f --- /dev/null +++ b/machines/X2100-Laptop/system @@ -0,0 +1 @@ +x86_64-linux \ No newline at end of file diff --git a/hardware-configuration/iso-image.nix b/machines/iso-image/default.nix similarity index 81% rename from hardware-configuration/iso-image.nix rename to machines/iso-image/default.nix index 4e1656c..b853a99 100644 --- a/hardware-configuration/iso-image.nix +++ b/machines/iso-image/default.nix @@ -1,6 +1,7 @@ -{ modulesPath, lib, ... }: { +{ modulesPath, lib, inputs, ... }: { imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" + inputs.self.nixosProfiles.base ]; networking.wireless.enable = lib.mkForce false; services.openssh.permitRootLogin = lib.mkForce "no"; diff --git a/machines/iso-image/system b/machines/iso-image/system new file mode 100644 index 0000000..9bdfd5f --- /dev/null +++ b/machines/iso-image/system @@ -0,0 +1 @@ +x86_64-linux \ No newline at end of file diff --git a/modules/applications.nix b/modules/applications.nix index 1f4534f..63f246e 100755 --- a/modules/applications.nix +++ b/modules/applications.nix @@ -43,6 +43,12 @@ with import ../support.nix { inherit lib config; }; { desktop = "gnumeric"; }; }; + + environment.sessionVariables = { + EDITOR = config.defaultApplications.editor.cmd; + VISUAL = config.defaultApplications.editor.cmd; + }; + home-manager.users.balsoft.xdg.mimeApps = { enable = true; defaultApplications = diff --git a/modules/boot.nix b/modules/boot.nix new file mode 100644 index 0000000..530aa4a --- /dev/null +++ b/modules/boot.nix @@ -0,0 +1,28 @@ +{ lib, pkgs, config, ... }: { + boot = { + loader.timeout = 1; + + loader.systemd-boot.enable = lib.mkIf (pkgs.system == "x86_64-linux") true; + + # loader.raspberryPi = lib.mkIf (pkgs.system == "aarch64-linux") { + # enable = true; + # version = 4; + # }; + + loader.grub.enable = false; + + # kernelParams = [ "quiet" "scsi_mod.use_blk_mq=1" "modeset" "nofb" ] + # ++ lib.optional (pkgs.system == "x86_64-linux") [ + # "rd.systemd.show_status=auto" + # "rd.udev.log_priority=3" + # "pti=off" + # "spectre_v2=off" + # ]; + + kernelPackages = pkgs.linuxPackages_latest; + + consoleLogLevel = 3; + kernel.sysctl."vm.swappiness" = 0; + kernel.sysctl."kernel/sysrq" = 1; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 4791ba2..9fa3810 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,46 +1,55 @@ -device: -{ pkgs, lib, ... }: { - imports = [ - ./applications/packages.nix - ./applications/emacs - ./applications/alacritty.nix - ./applications/geary.nix - ./applications/weechat.nix - ./applications/okular.nix - ./applications/yt-utilities.nix - ./applications/firefox.nix - ./workspace/sway - ./workspace/i3blocks - ./workspace/zsh.nix - ./workspace/gtk.nix - ./workspace/gnome3 - ./workspace/misc.nix - ./workspace/kde - ./workspace/ssh.nix - ./workspace/locale.nix - ./workspace/fonts.nix - ./workspace/light.nix - ./workspace/mako.nix - ./workspace/xresources.nix - ./themes.nix - ./applications.nix - ./secrets.nix - ./secrets-envsubst.nix - ./devices.nix - ./packages.nix - ./users.nix - ./hardware.nix - ./services.nix - ./power.nix - ./network.nix - ./simple-osd-daemons.nix - ] ++ lib.optionals (device == "AMD-Workstation") [ - ./nextcloud.nix - ./mailserver.nix - ./matrix-synapse.nix - # ./workspace/kanshi.nix - ./nginx.nix - ./gitea.nix - ./minidlna.nix - ]; -} +builtins.listToAttrs (builtins.map (path: { + name = builtins.head (let + b = builtins.baseNameOf path; + m = builtins.match "(.*)\\.nix" b; + in if isNull m then [ b ] else m); + value = import path; +}) [ + ./applications.nix + ./applications/alacritty.nix + ./applications/emacs + ./applications/firefox.nix + ./applications/geary.nix + ./applications/okular.nix + ./applications/packages.nix + ./applications/weechat.nix + ./applications/yt-utilities.nix + ./boot.nix + ./devices.nix + ./hardware.nix + ./network.nix + ./nix.nix + ./overlay.nix + ./power.nix + ./secrets-envsubst.nix + ./secrets.nix + ./security.nix + ./servers/gitea.nix + ./servers/jitsi.nix + ./servers/mailserver.nix + ./servers/matrix-synapse.nix + ./servers/minidlna.nix + ./servers/nextcloud.nix + ./servers/nginx.nix + ./servers/vsftpd.nix + ./services.nix + ./themes.nix + ./virtualisation.nix + ./workspace/cursor.nix + ./workspace/fonts.nix + ./workspace/git.nix + ./workspace/gnome3 + ./workspace/gpg.nix + ./workspace/gtk.nix + ./workspace/i3blocks + ./workspace/kde + ./workspace/light.nix + ./workspace/locale.nix + ./workspace/mako.nix + ./workspace/misc.nix + ./workspace/simple-osd-daemons.nix + ./workspace/ssh.nix + ./workspace/sway + ./workspace/xresources.nix + ./workspace/zsh.nix +]) diff --git a/modules/devices.nix b/modules/devices.nix index 27765a1..1dc8eda 100644 --- a/modules/devices.nix +++ b/modules/devices.nix @@ -2,135 +2,45 @@ with lib; with types; { options = { - device = mkOption { type = strMatching "[A-z|0-9]*-(Laptop|Workstation|VM|image)"; }; - devices = mkOption { type = attrs; }; - deviceSpecific = mkOption { type = attrs; }; - }; - config = { - deviceSpecific = let - device = config.device; - devInfo = config.devices.${config.device}; - in rec { - isLaptop = (!isNull (builtins.match ".*Laptop" device)); - smallScreen = (device == "Prestigio-Laptop"); - isShared = device == "Lenovo-Workstation"; - cpu = devInfo.cpu.vendor; - inherit devInfo; - isSSD = devInfo.drive.type == "ssd"; + device = mkOption { type = str; }; + deviceSpecific = { + isLaptop = mkOption { + type = bool; + default = + !isNull (builtins.match ".*Laptop" config.networking.hostName); + }; + devInfo = { + cpu = { + arch = mkOption { type = enum [ "x86_64" "aarch64" ]; }; + vendor = mkOption { type = enum [ "amd" "intel" "broadcom" ]; }; + clock = mkOption { type = int; }; + cores = mkOption { type = int; }; + }; + drive = { + type = mkOption { type = enum [ "hdd" "ssd" ]; }; + speed = mkOption { type = int; }; + size = mkOption { type = int; }; + }; + ram = mkOption { type = int; }; + bigScreen = mkOption { + type = bool; + default = true; + }; + }; # Whether machine is powerful enough for heavy stuff - goodMachine = devInfo.cpu.clock * devInfo.cpu.cores >= 4000 - && devInfo.drive.size >= 100 && devInfo.ram >= 8; - isHost = isSSD; - bigScreen = devInfo ? bigScreen; - }; - - devices = { - T490s-Laptop = { - cpu = { - vendor = "intel"; - clock = 4600; - cores = 4; + goodMachine = with config.deviceSpecific; + mkOption { + type = bool; + default = devInfo.cpu.clock * devInfo.cpu.cores >= 4000 + && devInfo.drive.size >= 100 && devInfo.ram >= 8; }; - drive = { - type = "ssd"; - speed = 2000; - size = 250; - }; - ram = 16; + isHost = mkOption { + type = bool; + default = with config.deviceSpecific; goodMachine; }; - T420-Laptop = { - legacy = false; - cpu = { - vendor = "intel"; - clock = 2500; - cores = 2; - }; - drive = { - type = "ssd"; - speed = 1000; - size = 120; - }; - ram = 8; - }; - Lenovo-Workstation = { - legacy = true; - cpu = { - vendor = "intel"; - clock = 2500; - cores = 2; - }; - drive = { - type = "ssd"; - speed = 250; - size = 120; - }; - ram = 8; - }; - AMD-Workstation = { - cpu = { - vendor = "amd"; - clock = 4200; - cores = 8; - }; - drive = { - type = "ssd"; - speed = 6000; - size = 250; - }; - bigScreen = true; - ram = 32; - }; - Prestigio-Laptop = { - cpu = { - vendor = "intel"; - clock = 1400; - cores = 2; - }; - drive = { - type = "flash"; - speed = 100; - size = 32; - }; - ram = 2; - }; - X2100-Laptop = { - cpu = { - vendor = "intel"; - clock = 4800; - cores = 4; - }; - drive = { - type = "ssd"; - speed = 6000; - size = 256; - }; - ram = 16; - }; - NixOS-VM = { - cpu = { - vendor = "intel"; - clock = 1000; - cores = 1; - }; - drive = { - type = "ssd"; - speed = 50; - size = 1; - }; - ram = 4; - }; - iso-image = { - cpu = { - vendor = "intel"; - clock = 1000; - cores = 1; - }; - drive = { - type = "ssd"; - speed = 50; - size = 8; - }; - ram = 4; + bigScreen = mkOption { + type = bool; + default = config.deviceSpecific.devInfo ? bigScreen; }; }; }; diff --git a/modules/hardware.nix b/modules/hardware.nix index e90797e..ab01ac3 100644 --- a/modules/hardware.nix +++ b/modules/hardware.nix @@ -1,12 +1,7 @@ { pkgs, config, lib, ... }: -with rec { inherit (config) device devices deviceSpecific; }; +with rec { inherit (config) device deviceSpecific; }; with deviceSpecific; { - - hardware.sensor.iio.enable = (device == "HP-Laptop"); - hardware.cpu.${devices.${device}.cpu.vendor}.updateMicrocode = - true; # Update microcode - hardware.enableRedistributableFirmware = true; # For some unfree drivers hardware.opengl.enable = true; @@ -17,116 +12,14 @@ with deviceSpecific; { hardware.bluetooth.enable = true; hardware.bluetooth.package = pkgs.bluezFull; - services.throttled = { - enable = device == "T490s-Laptop"; - extraConfig = '' - [GENERAL] - # Enable or disable the script execution - Enabled: True - # SYSFS path for checking if the system is running on AC power - Sysfs_Power_Path: /sys/class/power_supply/AC*/online - - ## Settings to apply while connected to Battery power - [BATTERY] - # Update the registers every this many seconds - Update_Rate_s: 30 - # Max package power for time window #1 - PL1_Tdp_W: 29 - # Time window #1 duration - PL1_Duration_s: 28 - # Max package power for time window #2 - PL2_Tdp_W: 44 - # Time window #2 duration - PL2_Duration_S: 0.002 - # Max allowed temperature before throttling - Trip_Temp_C: 85 - # Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL) - cTDP: 1 - - ## Settings to apply while connected to AC power - [AC] - # Update the registers every this many seconds - Update_Rate_s: 5 - # Max package power for time window #1 - PL1_Tdp_W: 44 - # Time window #1 duration - PL1_Duration_s: 28 - # Max package power for time window #2 - PL2_Tdp_W: 44 - # Time window #2 duration - PL2_Duration_S: 0.002 - # Max allowed temperature before throttling - Trip_Temp_C: 95 - # Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL) - HWP_Mode: True - # Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL) - cTDP: 2 - - [UNDERVOLT] - # CPU core voltage offset (mV) - CORE: -200 - # Integrated GPU voltage offset (mV) - GPU: -60 - # CPU cache voltage offset (mV) - CACHE: -50 - # System Agent voltage offset (mV) - UNCORE: 0 - # Analog I/O voltage offset (mV) - ANALOGIO: 0 - ''; - }; - boot.kernelModules = [ "ec_sys" ]; - systemd.services.thinkpad_leds = { - enable = config.device == "T490s-Laptop"; - description = "Set up thinkpad leds"; - wantedBy = [ "multi-user.target" ]; - script = '' - echo -n -e "\x0e" | dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null''; - serviceConfig.Type = "oneshot"; - }; - - boot = { - loader = lib.mkIf (config.device != "iso-image") ({ - timeout = 1; - } // (if deviceSpecific.devInfo.legacy or false then { # Non-UEFI config - grub.enable = true; - grub.version = 2; - grub.useOSProber = true; - grub.device = "/dev/sda"; - } else { # UEFI config - systemd-boot.enable = true; - })); - kernelPackages = pkgs.linuxPackages_latest; - consoleLogLevel = 3; - extraModprobeConfig = '' - options ec_sys write_support=1 - '' + lib.optionalString (device == "X2100-Laptop") '' - options iwlwifi bt_coex_active=0 - ''; - kernel.sysctl."vm.swappiness" = 0; - kernel.sysctl."kernel/sysrq" = 1; - kernelParams = [ - "quiet" - "scsi_mod.use_blk_mq=1" - "modeset" - "nofb" - "rd.systemd.show_status=auto" - "rd.udev.log_priority=3" - "pti=off" - "spectre_v2=off" - ]; - }; - - hardware.sane = { - enable = true; - # extraBackends = [ pkgs.hplipWithPlugin ]; - }; + hardware.sane.enable = true; services.saned.enable = true; services.logind.lidSwitchExternalPower = "ignore"; services.logind.extraConfig = "HandlePowerKey=suspend"; + sound.enable = true; hardware.pulseaudio = { enable = true; diff --git a/modules/network.nix b/modules/network.nix index 6c4c68e..c1943ee 100644 --- a/modules/network.nix +++ b/modules/network.nix @@ -2,7 +2,6 @@ let localRanges = [ { from = 1714; to = 1764; } # KDE connect - { from = 6600; to = 6600; } # Mopidy ]; in { networking = { @@ -23,6 +22,7 @@ in { usePredictableInterfaceNames = false; hostName = config.device; }; + networking.firewall.trustedInterfaces = [ "eth0" ]; systemd.services.ModemManager.wantedBy = lib.optional (config.device == "T490s-Laptop") "network.target"; } diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..227db0a --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,25 @@ +{ lib, inputs, ... }: { + nix = rec { + nixPath = lib.mkForce [ "nixpkgs=/etc/nixpkgs" ]; + binaryCaches = [ "https://cache.nixos.org" ]; + + registry.self.flake = inputs.self; + + trustedUsers = [ "root" "balsoft" "@wheel" ]; + + nrBuildUsers = 16; + + optimise.automatic = true; + + binaryCachePublicKeys = + [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; + + package = inputs.nix.packages.x86_64-linux.nix; + + extraOptions = '' + experimental-features = nix-command flakes + ''; + requireSignedBinaryCaches = false; + }; + environment.etc.nixpkgs.source = inputs.nixpkgs; +} diff --git a/modules/packages.nix b/modules/overlay.nix similarity index 67% rename from modules/packages.nix rename to modules/overlay.nix index 3e21cb9..5b517e5 100644 --- a/modules/packages.nix +++ b/modules/overlay.nix @@ -43,27 +43,4 @@ in { allowUnfree = true; android_sdk.accept_license = true; }; - environment.etc.nixpkgs.source = inputs.nixpkgs; - nix = rec { - nixPath = lib.mkForce [ "nixpkgs=/etc/nixpkgs" ]; - binaryCaches = [ "https://cache.nixos.org" ]; - - registry.self.flake = inputs.self; - - trustedUsers = [ "root" "balsoft" "@wheel" ]; - - nrBuildUsers = 16; - - optimise.automatic = true; - - binaryCachePublicKeys = - [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; - - package = inputs.nix.packages.x86_64-linux.nix; - - extraOptions = '' - experimental-features = nix-command flakes - ''; - requireSignedBinaryCaches = false; - }; } diff --git a/modules/users.nix b/modules/security.nix similarity index 100% rename from modules/users.nix rename to modules/security.nix diff --git a/modules/gitea.nix b/modules/servers/gitea.nix similarity index 100% rename from modules/gitea.nix rename to modules/servers/gitea.nix diff --git a/modules/servers/jitsi.nix b/modules/servers/jitsi.nix new file mode 100644 index 0000000..c27cb9e --- /dev/null +++ b/modules/servers/jitsi.nix @@ -0,0 +1,12 @@ +{ config, ... }: { + services.jitsi-meet = { + enable = true; + hostName = "meet.balsoft.ru"; + }; + + services.nginx.virtualHosts.${config.services.jitsi-meet.hostName} = { + enableACME = true; + forceSSL = true; + basicAuthFile = "/var/lib/jitsi-auth"; + }; +} diff --git a/modules/mailserver.nix b/modules/servers/mailserver.nix similarity index 100% rename from modules/mailserver.nix rename to modules/servers/mailserver.nix diff --git a/modules/matrix-synapse.nix b/modules/servers/matrix-synapse.nix similarity index 100% rename from modules/matrix-synapse.nix rename to modules/servers/matrix-synapse.nix diff --git a/modules/minidlna.nix b/modules/servers/minidlna.nix similarity index 100% rename from modules/minidlna.nix rename to modules/servers/minidlna.nix diff --git a/modules/nextcloud.nix b/modules/servers/nextcloud.nix similarity index 100% rename from modules/nextcloud.nix rename to modules/servers/nextcloud.nix diff --git a/modules/nginx.nix b/modules/servers/nginx.nix similarity index 100% rename from modules/nginx.nix rename to modules/servers/nginx.nix diff --git a/modules/servers/vsftpd.nix b/modules/servers/vsftpd.nix new file mode 100644 index 0000000..dd22104 --- /dev/null +++ b/modules/servers/vsftpd.nix @@ -0,0 +1,10 @@ +{ + services.vsftpd = { + enable = true; + anonymousUser = true; + allowWriteableChroot = true; + anonymousMkdirEnable = true; + anonymousUploadEnable = true; + writeEnable = true; + }; +} diff --git a/modules/services.nix b/modules/services.nix index d6f3d2c..c4f1f8e 100644 --- a/modules/services.nix +++ b/modules/services.nix @@ -3,10 +3,8 @@ services.acpid.enable = true; - services.apcupsd = { enable = config.device == "AMD-Workstation"; }; - services.earlyoom = { - enable = config.devices.${config.device}.ram < 16; + enable = config.deviceSpecific.devInfo.ram < 16; freeMemThreshold = 5; freeSwapThreshold = 100; }; @@ -15,19 +13,6 @@ enable = true; drivers = [ pkgs.gutenprint ]; }; - programs.dconf.enable = true; - - services.tor = { - enable = true; - client.enable = true; - torsocks.enable = true; - settings.SOCKSPort = [ 9050 ]; - }; - - services.privoxy = { - enable = true; - enableTor = true; - }; programs.mosh.enable = true; @@ -37,41 +22,7 @@ systemd.services.systemd-udev-settle.enable = false; - services.nix-serve.enable = config.device == "AMD-Workstation"; - services.pcscd.enable = true; - services.keybase.enable = true; - services.upower.enable = true; - virtualisation.docker.enable = config.deviceSpecific.isHost; - virtualisation.libvirtd = { - enable = config.deviceSpecific.isHost; - }; - - networking.firewall.trustedInterfaces = [ "eth0" ]; - - services.nginx.enable = config.device == "AMD-Workstation"; - - services.vsftpd = { - enable = config.device == "AMD-Workstation"; - anonymousUser = true; - allowWriteableChroot = true; - anonymousMkdirEnable = true; - anonymousUploadEnable = true; - writeEnable = true; - }; - - services.jitsi-meet = { - enable = config.device == "AMD-Workstation"; - hostName = "meet.balsoft.ru"; - }; - - services.nginx.virtualHosts.${config.services.jitsi-meet.hostName} = { - enableACME = true; - forceSSL = true; - basicAuthFile = "/var/lib/jitsi-auth"; - }; - - virtualisation.spiceUSBRedirection.enable = true; } diff --git a/modules/virtualisation.nix b/modules/virtualisation.nix new file mode 100644 index 0000000..5aced07 --- /dev/null +++ b/modules/virtualisation.nix @@ -0,0 +1,7 @@ +{ config, ... }: { + virtualisation.docker.enable = config.deviceSpecific.isHost; + virtualisation.libvirtd = { + enable = config.deviceSpecific.isHost; + }; + virtualisation.spiceUSBRedirection.enable = true; +} diff --git a/modules/workspace/cursor.nix b/modules/workspace/cursor.nix new file mode 100644 index 0000000..f3f0b44 --- /dev/null +++ b/modules/workspace/cursor.nix @@ -0,0 +1,17 @@ +{ pkgs, lib, ... }: { + + environment.sessionVariables = { + XCURSOR_PATH = lib.mkForce "/home/balsoft/.icons"; + }; + + home-manager.users.balsoft = { + + xsession.pointerCursor = { + package = pkgs.breeze-qt5; + name = "Breeze"; + }; + + home.file.".icons/default".source = + "${pkgs.breeze-qt5}/share/icons/breeze_cursors"; + }; +} diff --git a/modules/workspace/git.nix b/modules/workspace/git.nix new file mode 100644 index 0000000..97fb4b3 --- /dev/null +++ b/modules/workspace/git.nix @@ -0,0 +1,12 @@ +{ + home-manager.users.balsoft.programs.git = { + enable = true; + userEmail = "balsoft@balsoft.ru"; + userName = "Alexander Bantyev"; + extraConfig.pull.rebase = true; + signing = { + signByDefault = true; + key = "687558B21E04FE92B255BED0E081FF12ADCB4AD5"; + }; + }; +} diff --git a/modules/workspace/gpg.nix b/modules/workspace/gpg.nix new file mode 100644 index 0000000..707a356 --- /dev/null +++ b/modules/workspace/gpg.nix @@ -0,0 +1,10 @@ +{ + home-manager.users.balsoft = { + services.gpg-agent = { + enable = true; + enableSshSupport = true; + pinentryFlavor = "gtk2"; + }; + programs.gpg.enable = true; + }; +} diff --git a/modules/workspace/gtk.nix b/modules/workspace/gtk.nix index 25dba15..eede992 100644 --- a/modules/workspace/gtk.nix +++ b/modules/workspace/gtk.nix @@ -46,6 +46,7 @@ in { }; }) ]; + programs.dconf.enable = true; services.dbus.packages = with pkgs; [ gnome3.dconf ]; home-manager.users.balsoft = { gtk = { @@ -65,7 +66,7 @@ in { "davs://nextcloud.balsoft.ru/remote.php/dav/files/balsoft nextcloud.balsoft.ru" "sftp://balsoft.ru/home/balsoft balsoft.ru" ] ++ map (machine: "sftp://${machine}/home/balsoft ${machine}") - (builtins.attrNames config.devices); + (builtins.attrNames inputs.self.nixosConfigurations); extraConfig = { gtk-cursor-theme-name = "Breeze"; }; diff --git a/modules/workspace/kde/default.nix b/modules/workspace/kde/default.nix index 05e1aae..1cf0060 100644 --- a/modules/workspace/kde/default.nix +++ b/modules/workspace/kde/default.nix @@ -1,15 +1,9 @@ { pkgs, lib, config, ... }: with import ../../../support.nix { inherit lib config; }; { xdg.portal.enable = true; - services.dbus.packages = [ - pkgs.firefox - pkgs.systemd - pkgs.papirus-icon-theme - ]; - services.udev.packages = [ - pkgs.libmtp - pkgs.media-player-info - ]; + services.dbus.packages = + [ pkgs.firefox pkgs.systemd pkgs.papirus-icon-theme ]; + services.udev.packages = [ pkgs.libmtp pkgs.media-player-info ]; environment.sessionVariables = { DESKTOP_SESSION = "kde"; @@ -20,113 +14,118 @@ with import ../../../support.nix { inherit lib config; }; { QT_AUTO_SCREEN_SCALE_FACTOR = "0"; DE = "kde"; QT_QPA_PLATFORMTHEME = "kde"; - KDEDIRS = "/run/current-system/sw:/run/current-system/sw/share/kservices5:/run/current-system/sw/share/kservicetypes5:/run/current-system/sw/share/kxmlgui5"; + KDEDIRS = + "/run/current-system/sw:/run/current-system/sw/share/kservices5:/run/current-system/sw/share/kservicetypes5:/run/current-system/sw/share/kxmlgui5"; }; - home-manager.users.balsoft.xdg.configFile."kdeglobals".text = genIni { - "Colors:Button" = { - BackgroundAlternate = thmDec.dark; - BackgroundNormal = thmDec.bg; - DecorationFocus = thmDec.alt; - DecorationHover = thmDec.alt; - ForegroundActive = thmDec.alt; - ForegroundInactive = thmDec.dark; - ForegroundLink = thmDec.blue; - ForegroundNegative = thmDec.red; - ForegroundNeutral = thmDec.orange; - ForegroundNormal = thmDec.fg; - ForegroundPositive = thmDec.green; - ForegroundVisited = thmDec.gray; + home-manager.users.balsoft = { + services.kdeconnect.enable = true; + + xdg.configFile."kdeglobals".text = genIni { + "Colors:Button" = { + BackgroundAlternate = thmDec.dark; + BackgroundNormal = thmDec.bg; + DecorationFocus = thmDec.alt; + DecorationHover = thmDec.alt; + ForegroundActive = thmDec.alt; + ForegroundInactive = thmDec.dark; + ForegroundLink = thmDec.blue; + ForegroundNegative = thmDec.red; + ForegroundNeutral = thmDec.orange; + ForegroundNormal = thmDec.fg; + ForegroundPositive = thmDec.green; + ForegroundVisited = thmDec.gray; + }; + "Colors:Complementary" = { + BackgroundAlternate = thmDec.dark; + BackgroundNormal = thmDec.bg; + DecorationFocus = thmDec.alt; + DecorationHover = thmDec.alt; + ForegroundActive = thmDec.orange; + ForegroundInactive = thmDec.dark; + ForegroundLink = thmDec.blue; + ForegroundNegative = thmDec.red; + ForegroundNeutral = thmDec.yellow; + ForegroundNormal = thmDec.fg; + ForegroundPositive = thmDec.green; + ForegroundVisited = thmDec.alt; + }; + "Colors:Selection" = { + BackgroundAlternate = thmDec.alt; + BackgroundNormal = thmDec.alt; + DecorationFocus = thmDec.alt; + DecorationHover = thmDec.alt; + ForegroundActive = thmDec.fg; + ForegroundInactive = thmDec.fg; + ForegroundLink = thmDec.blue; + ForegroundNegative = thmDec.red; + ForegroundNeutral = thmDec.orange; + ForegroundNormal = thmDec.fg; + ForegroundPositive = thmDec.green; + ForegroundVisited = thmDec.alt; + }; + "Colors:Tooltip" = { + BackgroundAlternate = thmDec.dark; + BackgroundNormal = thmDec.bg; + DecorationFocus = thmDec.alt; + DecorationHover = thmDec.alt; + ForegroundActive = thmDec.alt; + ForegroundInactive = thmDec.dark; + ForegroundLink = thmDec.blue; + ForegroundNegative = thmDec.red; + ForegroundNeutral = thmDec.orange; + ForegroundNormal = thmDec.fg; + ForegroundPositive = thmDec.green; + ForegroundVisited = thmDec.gray; + }; + "Colors:View" = { + BackgroundAlternate = thmDec.dark; + BackgroundNormal = thmDec.bg; + DecorationFocus = thmDec.alt; + DecorationHover = thmDec.alt; + ForegroundActive = thmDec.alt; + ForegroundInactive = thmDec.dark; + ForegroundLink = thmDec.blue; + ForegroundNegative = thmDec.red; + ForegroundNeutral = thmDec.orange; + ForegroundNormal = thmDec.fg; + ForegroundPositive = thmDec.green; + ForegroundVisited = thmDec.gray; + }; + "Colors:Window" = { + BackgroundAlternate = thmDec.dark; + BackgroundNormal = thmDec.bg; + DecorationFocus = thmDec.alt; + DecorationHover = thmDec.alt; + ForegroundActive = thmDec.alt; + ForegroundInactive = thmDec.dark; + ForegroundLink = thmDec.blue; + ForegroundNegative = thmDec.red; + ForegroundNeutral = thmDec.orange; + ForegroundNormal = thmDec.fg; + ForegroundPositive = thmDec.green; + ForegroundVisited = thmDec.gray; + }; + General = { + ColorScheme = "Generated"; + Name = "Generated"; + fixed = "IBM Plex Mono,11,-1,5,50,0,0,0,0,0"; + font = "IBM Plex,11,-1,5,50,0,0,0,0,0"; + menuFont = "IBM Plex,11,-1,5,50,0,0,0,0,0"; + shadeSortColumn = true; + smallestReadableFont = "IBM Plex,8,-1,5,57,0,0,0,0,0,Medium"; + toolBarFont = "IBM Plex,11,-1,5,50,0,0,0,0,0"; + }; + KDE = { + DoubleClickInterval = 400; + ShowDeleteCommand = true; + SingleClick = false; + StartDragDist = 4; + StartDragTime = 500; + WheelScrollLines = 3; + contrast = 4; + widgetStyle = "Breeze"; + }; + Icons = { Theme = "Papirus-Dark"; }; }; - "Colors:Complementary" = { - BackgroundAlternate = thmDec.dark; - BackgroundNormal = thmDec.bg; - DecorationFocus = thmDec.alt; - DecorationHover = thmDec.alt; - ForegroundActive = thmDec.orange; - ForegroundInactive = thmDec.dark; - ForegroundLink = thmDec.blue; - ForegroundNegative = thmDec.red; - ForegroundNeutral = thmDec.yellow; - ForegroundNormal = thmDec.fg; - ForegroundPositive = thmDec.green; - ForegroundVisited = thmDec.alt; - }; - "Colors:Selection" = { - BackgroundAlternate = thmDec.alt; - BackgroundNormal = thmDec.alt; - DecorationFocus = thmDec.alt; - DecorationHover = thmDec.alt; - ForegroundActive = thmDec.fg; - ForegroundInactive = thmDec.fg; - ForegroundLink = thmDec.blue; - ForegroundNegative = thmDec.red; - ForegroundNeutral = thmDec.orange; - ForegroundNormal = thmDec.fg; - ForegroundPositive = thmDec.green; - ForegroundVisited = thmDec.alt; - }; - "Colors:Tooltip" = { - BackgroundAlternate = thmDec.dark; - BackgroundNormal = thmDec.bg; - DecorationFocus = thmDec.alt; - DecorationHover = thmDec.alt; - ForegroundActive = thmDec.alt; - ForegroundInactive = thmDec.dark; - ForegroundLink = thmDec.blue; - ForegroundNegative = thmDec.red; - ForegroundNeutral = thmDec.orange; - ForegroundNormal = thmDec.fg; - ForegroundPositive = thmDec.green; - ForegroundVisited = thmDec.gray; - }; - "Colors:View" = { - BackgroundAlternate = thmDec.dark; - BackgroundNormal = thmDec.bg; - DecorationFocus = thmDec.alt; - DecorationHover = thmDec.alt; - ForegroundActive = thmDec.alt; - ForegroundInactive = thmDec.dark; - ForegroundLink = thmDec.blue; - ForegroundNegative = thmDec.red; - ForegroundNeutral = thmDec.orange; - ForegroundNormal = thmDec.fg; - ForegroundPositive = thmDec.green; - ForegroundVisited = thmDec.gray; - }; - "Colors:Window" = { - BackgroundAlternate = thmDec.dark; - BackgroundNormal = thmDec.bg; - DecorationFocus = thmDec.alt; - DecorationHover = thmDec.alt; - ForegroundActive = thmDec.alt; - ForegroundInactive = thmDec.dark; - ForegroundLink = thmDec.blue; - ForegroundNegative = thmDec.red; - ForegroundNeutral = thmDec.orange; - ForegroundNormal = thmDec.fg; - ForegroundPositive = thmDec.green; - ForegroundVisited = thmDec.gray; - }; - General = { - ColorScheme = "Generated"; - Name = "Generated"; - fixed = "IBM Plex Mono,11,-1,5,50,0,0,0,0,0"; - font = "IBM Plex,11,-1,5,50,0,0,0,0,0"; - menuFont = "IBM Plex,11,-1,5,50,0,0,0,0,0"; - shadeSortColumn = true; - smallestReadableFont = "IBM Plex,8,-1,5,57,0,0,0,0,0,Medium"; - toolBarFont = "IBM Plex,11,-1,5,50,0,0,0,0,0"; - }; - KDE = { - DoubleClickInterval = 400; - ShowDeleteCommand = true; - SingleClick = false; - StartDragDist = 4; - StartDragTime = 500; - WheelScrollLines = 3; - contrast = 4; - widgetStyle = "Breeze"; - }; - Icons = { Theme = "Papirus-Dark"; }; }; } diff --git a/modules/workspace/locale.nix b/modules/workspace/locale.nix index b11506f..f76d8d6 100644 --- a/modules/workspace/locale.nix +++ b/modules/workspace/locale.nix @@ -4,19 +4,22 @@ environment.sessionVariables = { XKB_DEFAULT_LAYOUT = "us,ru"; - XKB_DEFAULT_OPTIONS = "grp:lctrl_toggle,grp_led:caps,ctrl:nocaps,misc:typo,lv3:ralt_switch"; + XKB_DEFAULT_OPTIONS = + "grp:lctrl_toggle,grp_led:caps,ctrl:nocaps,misc:typo,lv3:ralt_switch"; LANG = lib.mkForce "en_GB.UTF-8"; }; time.timeZone = "Europe/Moscow"; # Mother Russia - home-manager.users.balsoft.home.language = let - en = "en_GB.UTF-8"; - ru = "ru_RU.UTF-8"; - in { - address = ru; - monetary = ru; - paper = ru; - time = en; - base = en; + home-manager.users.balsoft = { + home.language = let + en = "en_GB.UTF-8"; + ru = "ru_RU.UTF-8"; + in { + address = ru; + monetary = ru; + paper = ru; + time = en; + base = en; + }; }; } diff --git a/modules/workspace/misc.nix b/modules/workspace/misc.nix index 7c66903..9cf2eed 100644 --- a/modules/workspace/misc.nix +++ b/modules/workspace/misc.nix @@ -1,31 +1,8 @@ { pkgs, lib, config, inputs, ... }: { - programs.sway.enable = true; - users.users.balsoft.extraGroups = [ "sway" ]; systemd.coredump.enable = true; + environment.sessionVariables = config.home-manager.users.balsoft.home.sessionVariables // { - EDITOR = config.defaultApplications.editor.cmd; - VISUAL = config.defaultApplications.editor.cmd; - LESS = "-asrRix8"; - XDG_SESSION_TYPE = "wayland"; - QT_QPA_PLATFORM = "wayland"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; NIX_AUTO_RUN = "1"; - XCURSOR_PATH = lib.mkForce "/home/balsoft/.icons"; - }; - - services.atd.enable = true; - - containers.fhs-compat.config = {...}: { - imports = [ inputs.nixos-fhs-compat.nixosModules.combined ]; - - environment.fhs.enable = true; - environment.fhs.linkLibs = true; - environment.lsb.enable = true; - - users.users.balsoft = { - isNormalUser = true; - password = ""; - }; }; home-manager.users.balsoft = { @@ -36,41 +13,18 @@ after = [ ]; data = "rm -f /home/balsoft/.config/mimeapps.list"; }; - services.udiskie.enable = true; - programs.git = { - enable = true; - userEmail = "balsoft@balsoft.ru"; - userName = "Alexander Bantyev"; - extraConfig.pull.rebase = true; - signing = { - signByDefault = true; - key = "687558B21E04FE92B255BED0E081FF12ADCB4AD5"; - }; - }; - services.gpg-agent = { - enable = true; - enableSshSupport = true; - pinentryFlavor = "gtk2"; - }; - programs.gpg.enable = true; + news.display = "silent"; programs.command-not-found = { enable = true; dbPath = ../../misc/programs.sqlite; }; - home.keyboard = { - options = [ "grp:win_space_toggle,grp_led:caps,ctrl:nocaps" ]; - layout = "us,ru"; - }; systemd.user.startServices = true; - services.kdeconnect.enable = true; - - xsession.pointerCursor = { - package = pkgs.breeze-qt5; - name = "Breeze"; - }; - - home.file.".icons/default".source = "${pkgs.breeze-qt5}/share/icons/breeze_cursors"; }; + + home-manager.users.balsoft.home.stateVersion = "20.09"; + + system.stateVersion = "18.03"; + } diff --git a/modules/simple-osd-daemons.nix b/modules/workspace/simple-osd-daemons.nix similarity index 91% rename from modules/simple-osd-daemons.nix rename to modules/workspace/simple-osd-daemons.nix index 90e57d3..a90e9e3 100644 --- a/modules/simple-osd-daemons.nix +++ b/modules/workspace/simple-osd-daemons.nix @@ -7,7 +7,7 @@ let Restart = "always"; }; }; - inherit (import ../support.nix { inherit lib config; }) genIni; + inherit (import ../../support.nix { inherit lib config; }) genIni; daemons = names: builtins.listToAttrs (builtins.map (name: { diff --git a/modules/workspace/sway/default.nix b/modules/workspace/sway/default.nix index e324144..cee3862 100755 --- a/modules/workspace/sway/default.nix +++ b/modules/workspace/sway/default.nix @@ -7,12 +7,21 @@ let lock = pkgs.writeShellScript "lock" "swaymsg 'output * dpms off'; sudo /run/current-system/sw/bin/lock; swaymsg 'output * dpms on'"; in { - environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1"; + environment.sessionVariables = { + _JAVA_AWT_WM_NONREPARENTING = "1"; + XDG_SESSION_TYPE = "wayland"; + QT_QPA_PLATFORM = "wayland"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + }; + + programs.sway.enable = true; programs.sway.wrapperFeatures.gtk = true; programs.sway.extraPackages = lib.mkForce (with pkgs; [ swayidle xwayland ]); + users.users.balsoft.extraGroups = [ "sway" ]; + home-manager.users.balsoft.wayland.windowManager.sway = { enable = true; config = rec { diff --git a/profiles/base.nix b/profiles/base.nix new file mode 100644 index 0000000..b2d7d64 --- /dev/null +++ b/profiles/base.nix @@ -0,0 +1,20 @@ +{ inputs, ... }: { + imports = with inputs.self.nixosModules; [ + inputs.home-manager.nixosModules.home-manager + + boot + secrets + secrets-envsubst + + locale + network + overlay + devices + nix + security + ssh + git + gpg + zsh + ]; +} diff --git a/profiles/default.nix b/profiles/default.nix new file mode 100644 index 0000000..1eb2b24 --- /dev/null +++ b/profiles/default.nix @@ -0,0 +1,5 @@ +{ + server = ./server.nix; + desktop = ./desktop.nix; + base = ./base.nix; +} diff --git a/profiles/desktop.nix b/profiles/desktop.nix new file mode 100644 index 0000000..cff570f --- /dev/null +++ b/profiles/desktop.nix @@ -0,0 +1,33 @@ +{ inputs, ... }: { + imports = with inputs.self.nixosModules; [ + ./base.nix + + applications + hardware + power + services + themes + virtualisation + + alacritty + emacs + firefox + geary + packages + weechat + yt-utilities + + cursor + fonts + gnome3 + gtk + i3blocks + kde + light + mako + misc + simple-osd-daemons + sway + xresources + ]; +} diff --git a/profiles/server.nix b/profiles/server.nix new file mode 100644 index 0000000..6dae84d --- /dev/null +++ b/profiles/server.nix @@ -0,0 +1,5 @@ +{ inputs, ... }: { + imports = [ + ./base.nix + ]; +}