diff --git a/hosts/main.nix b/hosts/main.nix new file mode 100644 index 0000000..33d97a6 --- /dev/null +++ b/hosts/main.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: + +{ + imports = [ + ../nix-os/core.nix + ../nix-os/core-desktop.nix + ../nix-os/nvidia.nix + ../nix-os/docker.nix + ../nix-os/razer.nix + ../nix-os/desktopManagers/gnome.nix + ../nix-os/displayManagers/gdm.nix + #../nix-os/desktop/kde-plasma.nix + ../nix-os/shell.nix + ../nix-os/virtualization.nix + ../nix-os/polkit/disable-shutdown.nix + ../nix-os/locale.nix + ../nix-os/adb.nix + ../nix-os/account.nix + ../nix-os/xdg-default-apps.nix + ../nix-os/services/nix-binary-cache.nix + ../nix-os/udev.nix + + (builtins.fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/fc900c16efc6a5ed972fb6be87df018bcf3035bc") + ]; + + config = { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "wroclaw-main"; + + services.xrdp.enable = true; + users.groups."tsusers".members = [ "wroclaw" ]; + + services.printing.drivers = with pkgs; [ + hplip + ]; + + # nixos-vscode-server module needs this + programs.nix-ld.enable = true; + services.vscode-server = { + enable = true; + extraRuntimeDependencies = with pkgs; [ + docker + ]; + }; + + system.stateVersion = "23.05"; + }; +} diff --git a/hosts/tablet.nix b/hosts/tablet.nix new file mode 100644 index 0000000..32de99d --- /dev/null +++ b/hosts/tablet.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../nix-os/core.nix + ../nix-os/core-desktop.nix + ../nix-os/account.nix + ../nix-os/adb.nix + ../nix-os/locale.nix + ../nix-os/shell.nix + + ../nix-os/desktopManagers/gnome.nix + ../nix-os/displayManagers/gdm.nix + ../nix-os/udev.nix + ]; + + config = { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "wroclaw-hp"; + networking.networkmanager.enable = true; + networking.firewall.enable = true; + services.xserver.displayManager.gdm.wayland = lib.mkForce true; + hardware.sensor.iio.enable = true; + + networking.firewall.allowedTCPPortRanges = [ + # KDE Connect + rec { from = 1714; to = from + 50; } + ]; + + networking.firewall.allowedUDPPortRanges = [ + # KDE Connect + rec { from = 1714; to = from + 50; } + ]; + + services.logind.extraConfig = '' + HandlePowerKey=suspend + HandlePowerKeyLongPress=poweroff + HandleSuspendKey=suspend-then-hibernate + HandleSuspendKeyLongPress=hibernate + HandleLidSwitch=lock + HandleLidSwitchDocked=ignore + HandleLidSwitchExternalPower=lock + ''; + + system.stateVersion = "23.11"; + }; +} + diff --git a/nix-os-configs/vm-cosmic.nix b/hosts/vm-cosmic.nix similarity index 92% rename from nix-os-configs/vm-cosmic.nix rename to hosts/vm-cosmic.nix index 5981688..5507267 100644 --- a/nix-os-configs/vm-cosmic.nix +++ b/hosts/vm-cosmic.nix @@ -3,6 +3,7 @@ { imports = [ ../nix-os/core.nix + ../nix-os/core-desktop.nix ../nix-os/docker.nix ../nix-os/desktopManagers/cosmic.nix ../nix-os/displayManagers/cosmic-greeter.nix @@ -15,4 +16,4 @@ ../nix-os/account.nix ../nix-os/xdg-default-apps.nix ]; -} \ No newline at end of file +} diff --git a/nix-os-configs/vm.nix b/hosts/vm.nix similarity index 94% rename from nix-os-configs/vm.nix rename to hosts/vm.nix index c91a794..0b99d01 100644 --- a/nix-os-configs/vm.nix +++ b/hosts/vm.nix @@ -14,5 +14,6 @@ ../nix-os/adb.nix ../nix-os/account.nix ../nix-os/xdg-default-apps.nix + ../nix-os/udev.nix ]; } \ No newline at end of file diff --git a/nix-os-configs/main.nix b/nix-os-configs/main.nix deleted file mode 100644 index e09af33..0000000 --- a/nix-os-configs/main.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ ... }: - -{ - imports = [ - # Include the results of the hardware scan. - (if builtins.pathExists /etc/nixos/hardware-configuration.nix then /etc/nixos/hardware-configuration.nix else null) - # Include device-specific overrides - (if builtins.pathExists /etc/nixos/device-configuration.nix then /etc/nixos/device-configuration.nix else null) - ../nix-os/core.nix - ../nix-os/nvidia.nix - ../nix-os/docker.nix - ../nix-os/razer.nix - ../nix-os/desktopManagers/gnome.nix - ../nix-os/displayManagers/gdm.nix - #../nix-os/desktop/kde-plasma.nix - ../nix-os/shell.nix - ../nix-os/virtualization.nix - ../nix-os/polkit/disable-shutdown.nix - ../nix-os/locale.nix - ../nix-os/adb.nix - ../nix-os/account.nix - ../nix-os/xdg-default-apps.nix - ]; -} \ No newline at end of file diff --git a/nix-os/account.nix b/nix-os/account.nix index d6f763e..2bb15ff 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -14,17 +14,25 @@ (if config.programs.adb.enable then "adbusers" else null) ]; linger = true; - # Initial password for the account - password = "nixos"; + initialPassword = "nixos"; packages = with pkgs; [ firefox vivaldi discord-canary unstablePkgs.vscode + gimp + inkscape + krita + unstablePkgs.zettlr ]; }; users.groups.wroclaw.gid = 1000; + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + }; + services.syncthing = { enable = true; user = "wroclaw"; @@ -32,4 +40,4 @@ dataDir = "/home/wroclaw"; configDir = "/home/wroclaw/.config/syncthing"; }; -} \ No newline at end of file +} diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix new file mode 100644 index 0000000..2f5a087 --- /dev/null +++ b/nix-os/core-desktop.nix @@ -0,0 +1,28 @@ +{config, lib, pkgs, ... }: + +{ + config = { + services.printing.enable = true; + + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + + # Enable audio interfaces renaming + wireplumber.enable = true; + }; + + environment.systemPackages = with pkgs; [ + mpv + ]; + + services.openssh.extraConfig = '' + X11Forwarding yes + ''; + }; +} \ No newline at end of file diff --git a/nix-os/core.nix b/nix-os/core.nix index cd2dc96..7f07c00 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -2,42 +2,34 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running 'nixos-help'). -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: +let + /* + * pkgs: package - nixpkgs package + * exe: string - executable (under bin) in pkgs + * wrapperArgs: string[] - arguments to pass to the wrapper + */ + mkWrappedExecutable = {pkg, exe ? pkg.meta.mainProgram, wrapperArgs}: let inherit (pkgs) lib makeWrapper; in pkgs.stdenv.mkDerivation { + name = "${pkg.name}-wrap-${exe}"; + nativeBuildInputs = [ makeWrapper ]; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} ${lib.concatStringsSep " " wrapperArgs} + ''; + }; + wrapedNixPrograms = builtins.map lib.hiPrio [ + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar-with-logs"];}) + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) + ]; +in { - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - # kernel boot.kernelPackages = pkgs.linuxPackages_latest; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # Enable networking networking.networkmanager.enable = true; - - # X11 and desktop/display manager is enabled using imported files - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable flatpak, some software is newer here unfortunately - services.flatpak.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - - # Enable audio interfaces renaming - wireplumber.enable = true; - }; # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -46,55 +38,20 @@ # $ nix search wget environment.systemPackages = with pkgs; [ wget - git ffmpeg yt-dlp - mpv htop btop - neofetch - ranger - gimp - inkscape - krita + fastfetch smartmontools ddrescue - ]; + ] ++ wrapedNixPrograms; - # terminal text editor - programs.neovim = { - enable = true; - viAlias = true; - defaultEditor = true; - configure = { - customRC = '' - set number - set hlsearch - set incsearch - set tabstop=4 - set softtabstop=4 - set shiftwidth=4 - set expandtab - set autoindent - - syntax on - set encoding=utf-8 - set wildmode=longest,list,full - set listchars=space:·,tab:┄┄» - set indentkeys-=0# - ''; - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ - guess-indent-nvim - vim-visual-multi - ]; - }; - }; - }; - - programs.steam = { - enable = true; - remotePlay.openFirewall = true; + programs.git.enable = true; + programs.git.config = { + init.defaultBranch = "main"; + merge.conflictstyle = "diff3"; + rerere.enabled = true; }; # Enable fail2ban because of the OpenSSH server @@ -111,20 +68,5 @@ 22 8022 ]; - extraConfig = '' - X11Forwarding yes - ''; }; - - # Disable firewall - networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - # I am lazy } diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index bc9c2b0..2993f98 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -1,158 +1,166 @@ -# This file is not a NixOS system module {config, lib, pkgs, ... }: -selection: -let - settings = with lib.gvariant; { - "org/gnome/desktop/background" = { - picture-options = "zoom"; - picture-uri = "file://${../media/wallpaper.png}"; - picture-uri-dark = "file://${../media/wallpaper.png}"; +{ + imports = [ + ./generic/dconf.nix + ]; + + config = { + proot.dconf.rules = with lib.gvariant; { + "org/gnome/desktop/background" = { + picture-options = "zoom"; + picture-uri = "file://${../media/wallpaper.png}"; + picture-uri-dark = "file://${../media/wallpaper.png}"; + }; + + "org/gnome/desktop/interface" = { + clock-show-date = true; + clock-show-seconds = true; + clock-show-weekday = true; + color-scheme = "prefer-dark"; + cursor-theme = "GoogleDot-White"; + }; + + "org/gnome/desktop/media-handling" = { + automount = false; + }; + + "org/gnome/desktop/peripherals/mouse" = { + accel-profile = "flat"; + }; + + "org/gnome/desktop/sound" = { + allow-volume-above-100-percent = true; + }; + + "org/gnome/desktop/wm/preferences" = { + button-layout = "appmenu:close"; + resize-with-right-button = true; + }; + + "org/gnome/mutter" = { + dynamic-workspaces = true; + workspaces-only-on-primary = true; + }; + + "org/gnome/SessionManager" = { + logout-prompt = false; + }; + + "org/gnome/settings-daemon/plugins/power" = { + power-button-action = "notning"; + sleep-inactive-ac-type = "nothing"; + }; + + "org/gnome/shell" = { + enabled-extensions = [ + "drive-menu@gnome-shell-extensions.gcampax.github.com" + "pop-shell@system76.com" + "workspace-indicator@gnome-shell-extensions.gcampax.github.com" + "Vitals@CoreCoding.com" + "trayIconsReloaded@selfmade.pl" + "places-menu@gnome-shell-extensions.gcampax.github.com" + "apps-menu@gnome-shell-extensions.gcampax.github.com" + "top-bar-organizer@julian.gse.jsts.xyz" + "color-picker@tuberry" + ]; + favorite-apps = [ + (if builtins.elem pkgs.kitty config.environment.systemPackages then + "kitty.desktop" + else none) + "vivaldi-stable.desktop" + "code.desktop" + "org.gnome.Nautilus.desktop" + (if config.programs.steam.enable then + "steam.desktop" + else none) + "pavucontrol.desktop" + ]; + }; + + "org/gnome/shell/app-switcher" = { + current-workspace-only = false; + }; + + "org/gnome/shell/extensions/color-picker" = { + color-picker-shortcut = ["c"]; + enable-shortcut = true; + enable-systray = false; + menu-key = ""; + notify-style = mkUint32 1; + preview-style = mkUint32 0; + }; + + "org/gnome/shell/extensions/pop-shell" = { + active-hint = true; + active-hint-border-radius = mkUint32 1; + gap-inner = mkUint32 2; + gap-outer = mkUint32 1; + show-skip-taskbar = true; + show-title = true; + smart-gaps = false; + snap-to-grid = false; + tile-by-default = true; + }; + + "org/gnome/shell/extensions/top-bar-organizer" = { + center-box-order = ["dateMenu"]; + left-box-order = ["activities" "apps-menu" "places-menu" "vitalsMenu"]; + right-box-order = ["TrayIconsReloaded" "workspace-indicator" "pop-shell" "color-picker@tuberry" "drive-menu" "screenRecording" "screenSharing" "dwellClick" "a11y" "keyboard" "quickSettings"]; + }; + + "org/gnome/shell/extensions/trayIconsReloaded" = { + icon-brightness = mkInt32 0; + icon-contrast = mkInt32 0; + icon-margin-horizontal = mkInt32 0; + icon-margin-vertical = mkInt32 0; + icon-padding-horizontal = mkInt32 4; + icon-padding-vertical = mkInt32 0; + icon-saturation = mkInt32 0; + icon-size = mkInt32 16; + icons-limit = mkInt32 16; + invoke-to-workspace = true; + position-weight = mkInt32 0; + tray-margin-left = mkInt32 0; + tray-margin-right = mkInt32 0; + }; + + "org/gnome/shell/extensions/vitals" = { + hide-icons = false; + hot-sensors = ["_processor_usage_" "_memory_allocated_"]; + memory-measurement = mkInt32 1; + update-time = mkInt32 2; + use-higher-precision = true; + }; + + "org/gnome/shell/keybindings" = { + show-screenshot-ui = ["Print" "S"]; + }; + + "org/gnome/desktop/default-applications/terminal" = + if builtins.elem pkgs.kitty config.environment.systemPackages then { + exec = "kitty"; + exec-arg = ""; + } else null; + + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + ( + if builtins.elem pkgs.kitty config.environment.systemPackages then + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + else null + ) + ]; + help = mkEmptyArray "s"; + screensaver = ["l"]; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = + if builtins.elem pkgs.kitty config.environment.systemPackages then { + binding = "t"; + command = "kitty"; + name = "Terminal"; + } else null; }; - - "org/gnome/desktop/interface" = { - clock-show-date = true; - clock-show-seconds = true; - clock-show-weekday = true; - color-scheme = "prefer-dark"; - cursor-theme = "GoogleDot-White"; - }; - - "org/gnome/desktop/media-handling" = { - automount = false; - }; - - "org/gnome/desktop/peripherals/mouse" = { - accel-profile = "flat"; - }; - - "org/gnome/desktop/sound" = { - allow-volume-above-100-percent = true; - }; - - "org/gnome/mutter" = { - dynamic-workspaces = true; - workspaces-only-on-primary = true; - }; - - "org/gnome/SessionManager" = { - logout-prompt = false; - }; - - "org/gnome/settings-daemon/plugins/power" = { - power-button-action = "notning"; - sleep-inactive-ac-type = "nothing"; - }; - - "org/gnome/shell" = { - enabled-extensions = [ - "drive-menu@gnome-shell-extensions.gcampax.github.com" - "pop-shell@system76.com" - "workspace-indicator@gnome-shell-extensions.gcampax.github.com" - "Vitals@CoreCoding.com" - "trayIconsReloaded@selfmade.pl" - "places-menu@gnome-shell-extensions.gcampax.github.com" - "apps-menu@gnome-shell-extensions.gcampax.github.com" - "top-bar-organizer@julian.gse.jsts.xyz" - "color-picker@tuberry" - ]; - favorite-apps = [ - (if builtins.elem pkgs.kitty config.environment.systemPackages then - "kitty.desktop" - else none) - "vivaldi-stable.desktop" - "code.desktop" - "org.gnome.Nautilus.desktop" - (if config.programs.steam.enable then - "steam.desktop" - else none) - "pavucontrol.desktop" - ]; - }; - - "org/gnome/shell/app-switcher" = { - current-workspace-only = false; - }; - - "org/gnome/shell/extensions/color-picker" = { - color-picker-shortcut = ["c"]; - enable-shortcut = true; - enable-systray = false; - menu-key = ""; - notify-style = mkUint32 1; - preview-style = mkUint32 0; - }; - - "org/gnome/shell/extensions/pop-shell" = { - active-hint = true; - active-hint-border-radius = mkUint32 1; - gap-inner = mkUint32 2; - gap-outer = mkUint32 1; - show-skip-taskbar = true; - show-title = true; - smart-gaps = false; - snap-to-grid = false; - tile-by-default = true; - }; - - "org/gnome/shell/extensions/top-bar-organizer" = { - center-box-order = ["dateMenu"]; - left-box-order = ["activities" "apps-menu" "places-menu" "vitalsMenu"]; - right-box-order = ["TrayIconsReloaded" "workspace-indicator" "pop-shell" "color-picker@tuberry" "drive-menu" "screenRecording" "screenSharing" "dwellClick" "a11y" "keyboard" "quickSettings"]; - }; - - "org/gnome/shell/extensions/trayIconsReloaded" = { - icon-brightness = mkInt32 0; - icon-contrast = mkInt32 0; - icon-margin-horizontal = mkInt32 0; - icon-margin-vertical = mkInt32 0; - icon-padding-horizontal = mkInt32 4; - icon-padding-vertical = mkInt32 0; - icon-saturation = mkInt32 0; - icon-size = mkInt32 16; - icons-limit = mkInt32 16; - invoke-to-workspace = true; - position-weight = mkInt32 0; - tray-margin-left = mkInt32 0; - tray-margin-right = mkInt32 0; - }; - - "org/gnome/shell/extensions/vitals" = { - hide-icons = false; - hot-sensors = ["_processor_usage_" "_memory_allocated_"]; - memory-measurement = mkInt32 1; - update-time = mkInt32 2; - use-higher-precision = true; - }; - - "org/gnome/shell/keybindings" = { - show-screenshot-ui = ["Print" "S"]; - }; - - "org/gnome/desktop/default-applications/terminal" = - if builtins.elem pkgs.kitty config.environment.systemPackages then { - exec = "kitty"; - exec-arg = ""; - } else null; - - "org/gnome/settings-daemon/plugins/media-keys" = { - custom-keybindings = [ - ( - if builtins.elem pkgs.kitty config.environment.systemPackages then - "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" - else null - ) - ]; - help = mkEmptyArray "s"; - screensaver = ["l"]; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" = - if builtins.elem pkgs.kitty config.environment.systemPackages then { - binding = "t"; - command = "kitty"; - name = "Terminal"; - } else null; }; -in -lib.filterAttrs (n: v: builtins.elem n selection) settings \ No newline at end of file +} diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index 9e7afa8..14c19c6 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -1,8 +1,9 @@ -{pkgs, ... } @ moduleArgs: +{pkgs, ... }: { imports = [ ../unstable-packages.nix + ../dconf-common.nix ]; config = { services.xserver.enable = true; @@ -10,29 +11,28 @@ # environment.sessionVariables.NIXOS_OZONE_WL = "1"; - programs.dconf.profiles.user.databases = [{ - settings = import ../dconf-common.nix moduleArgs [ - "org/gnome/desktop/background" - "org/gnome/desktop/interface" - "org/gnome/desktop/media-handling" - "org/gnome/desktop/peripherals/mouse" - "org/gnome/desktop/sound" - "org/gnome/mutter" - "org/gnome/SessionManager" - "org/gnome/settings-daemon/plugins/power" - "org/gnome/shell" - "org/gnome/shell/app-switcher" - "org/gnome/shell/extensions/color-picker" - "org/gnome/shell/extensions/pop-shell" - "org/gnome/shell/extensions/top-bar-organizer" - "org/gnome/shell/extensions/trayIconsReloaded" - "org/gnome/shell/extensions/vitals" - "org/gnome/shell/keybindings" - "org/gnome/desktop/default-applications/terminal" - "org/gnome/settings-daemon/plugins/media-keys" - "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" - ]; - }]; + proot.dconf.profiles.user.rulesToApply = [ + "org/gnome/desktop/background" + "org/gnome/desktop/interface" + "org/gnome/desktop/media-handling" + "org/gnome/desktop/peripherals/mouse" + "org/gnome/desktop/sound" + "org/gnome/desktop/wm/preferences" + "org/gnome/mutter" + "org/gnome/SessionManager" + "org/gnome/settings-daemon/plugins/power" + "org/gnome/shell" + "org/gnome/shell/app-switcher" + "org/gnome/shell/extensions/color-picker" + "org/gnome/shell/extensions/pop-shell" + "org/gnome/shell/extensions/top-bar-organizer" + "org/gnome/shell/extensions/trayIconsReloaded" + "org/gnome/shell/extensions/vitals" + "org/gnome/shell/keybindings" + "org/gnome/desktop/default-applications/terminal" + "org/gnome/settings-daemon/plugins/media-keys" + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" + ]; environment.gnome.excludePackages = with pkgs; with pkgs.gnome; [ baobab diff --git a/nix-os/displayManagers/gdm.nix b/nix-os/displayManagers/gdm.nix index f040d1c..f3e4cbc 100644 --- a/nix-os/displayManagers/gdm.nix +++ b/nix-os/displayManagers/gdm.nix @@ -1,6 +1,9 @@ -{pkgs, ... } @ moduleArgs: +{pkgs, ... }: { + imports = [ + ../dconf-common.nix + ]; config = { services.xserver.displayManager.gdm = { enable = true; @@ -8,18 +11,16 @@ autoSuspend = false; }; - programs.dconf.profiles.gdm.databases = [{ - settings = import ../dconf-common.nix moduleArgs [ - "org/gnome/desktop/interface" - "org/gnome/desktop/peripherals/mouse" - "org/gnome/desktop/sound" - "org/gnome/settings-daemon/plugins/power" - "org/gnome/shell/keybindings" - ]; - }]; + proot.dconf.profiles.gdm.rulesToApply = [ + "org/gnome/desktop/interface" + "org/gnome/desktop/peripherals/mouse" + "org/gnome/desktop/sound" + "org/gnome/settings-daemon/plugins/power" + "org/gnome/shell/keybindings" + ]; environment.systemPackages = with pkgs; [ google-cursor ]; }; -} \ No newline at end of file +} diff --git a/nix-os/generic/dconf.nix b/nix-os/generic/dconf.nix new file mode 100644 index 0000000..dfcdc04 --- /dev/null +++ b/nix-os/generic/dconf.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, options, ... }: + +# proot.dconf.rules +# proot.dconf.profiles..rulesToApply +# proot.dconf.profiles..extraRules +let + cfg = config.proot.dconf; + profileOpts = lib.types.submodule { + options = { + rulesToApply = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = lib.attrNames cfg.rules; + description = lib.mdDoc "A list of rules keys to apply for profile"; + }; + extraRules = lib.mkOption { + type = lib.types.attrs; + default = {}; + description = lib.mdDoc "An attrset of additional dconf rules to apply ontop of selected"; + }; + }; + }; + + mapper = _: value: { + databases = lib.singleton { + settings = lib.filterAttrs (key: _: lib.elem key value.rulesToApply) cfg.rules // value.extraRules; + }; + }; +in +{ + options.proot.dconf = { + rules = lib.mkOption { + type = lib.types.attrs; + default = {}; + description = lib.mdDoc "An attrset of dconf rules to pull from"; + }; + profiles = lib.mkOption { + type = lib.types.attrsOf profileOpts; + default = {}; + description = lib.mdDoc "An attret of profiles to create, with pulled rules"; + }; + }; + + config = { + programs.dconf.profiles = lib.mapAttrs mapper cfg.profiles; + }; +} diff --git a/nix-os/services/nix-binary-cache.nix b/nix-os/services/nix-binary-cache.nix new file mode 100644 index 0000000..aaff003 --- /dev/null +++ b/nix-os/services/nix-binary-cache.nix @@ -0,0 +1,8 @@ +{ + config = { + services.nix-serve = { + enable = true; + secretKeyFile = "/var/cache-priv-key.pem"; + }; + }; +} diff --git a/nix-os/shell.nix b/nix-os/shell.nix index 5c2bc44..cee283b 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -1,4 +1,4 @@ -{ config, pkgs, unstablePkgs, ... }: +{ config, pkgs, unstablePkgs, lib, ... }: let rangerGit = pkgs.ranger.overrideAttrs (old: { @@ -37,6 +37,7 @@ in ''; programs.bash.interactiveShellInit = '' + HISTCONTROL=ignoreboth if test -n "$KITTY_INSTALLATION_DIR"; then export KITTY_SHELL_INTEGRATION="enabled,no-sudo" source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash" @@ -53,6 +54,8 @@ in ${if config.services.xserver.desktopManager.gnome.enable then "hide_window_decorations yes" else ""} background_opacity 0.8 dynamic_background_opacity yes + + map kitty_mod+alt+c copy_ansi_to_clipboard ''; environment.etc."ranger/rc.conf".text = '' @@ -74,6 +77,41 @@ in programs.direnv.enable = true; + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + configure = { + customRC = '' + set number + set hlsearch + set incsearch + set tabstop=4 + set softtabstop=4 + set shiftwidth=4 + set expandtab + set autoindent + + syntax on + set encoding=utf-8 + set wildmode=longest,list,full + set listchars=space:·,tab:┄┄» + set indentkeys-=0# + ''; + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ + guess-indent-nvim + vim-visual-multi + ]; + }; + }; + }; + + environment.variables = lib.mkIf config.programs.neovim.enable rec { + EDITOR = "/run/current-system/sw/bin/nvim"; + VISUAL = EDITOR; + }; + programs.starship = { enable = true; settings = { @@ -82,6 +120,9 @@ in truncation_length = 5; truncation_symbol = "…/"; }; + hostname = { + ssh_only = false; + }; username = { show_always = true; }; @@ -91,12 +132,6 @@ in command = "echo \"✦\""; style = "bold 208"; }; - # custom.PS1 = { - # when = true; - # command = "echo -e \"\\x1b\\x5d133;A\\x1b\\x5c\""; - # format = "$output"; - # use_stdin = false; - # }; }; }; } diff --git a/nix-os/udev.nix b/nix-os/udev.nix new file mode 100644 index 0000000..5c27b88 --- /dev/null +++ b/nix-os/udev.nix @@ -0,0 +1,5 @@ +{ + config = { + hardware.ledger.enable = true; + }; +} diff --git a/nix-os/unstable-packages.nix b/nix-os/unstable-packages.nix index 67f0f5b..27e0727 100644 --- a/nix-os/unstable-packages.nix +++ b/nix-os/unstable-packages.nix @@ -31,6 +31,7 @@ in }; }; config._module.args.unstablePkgs = config.unstable.pkgs; - # FIXME: move it to the system derivation output (overrideAttrs config.system.build.toplevel?) - config.environment.etc."NIXOS-UNSTABLE-VERSION".text = nixos-unstable-version; + config.system.extraSystemBuilderCmds = lib.mkIf config.unstable.enable '' + echo ${nixos-unstable-version} > $out/nixos-unstable-version + ''; } \ No newline at end of file diff --git a/nix-os/virtualization.nix b/nix-os/virtualization.nix index 7aaa239..c1e062f 100644 --- a/nix-os/virtualization.nix +++ b/nix-os/virtualization.nix @@ -6,5 +6,11 @@ programs.virt-manager.enable = true; virtualisation.libvirtd = { enable = true; + qemu.ovmf = { + enable = true; + packages = [ + pkgs.OVMFFull.fd + ]; + }; }; } diff --git a/nixos-rebuild.sh b/nixos-rebuild.sh deleted file mode 100755 index 0d1dda7..0000000 --- a/nixos-rebuild.sh +++ /dev/null @@ -1 +0,0 @@ -NIXOS_CONFIG="$(pwd)/nix-os-configs/main.nix" nixos-rebuild $@ diff --git a/vm-cosmic.sh b/vm-cosmic.sh index b03a0df..1d5cd30 100755 --- a/vm-cosmic.sh +++ b/vm-cosmic.sh @@ -1 +1 @@ -nix-build '' -A vm -I nixpkgs=channel:nixos-unstable -I nixos-config=./nix-os-configs/vm-cosmic.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 +nix-build '' -A vm -I nixos-config=./hosts/vm-cosmic.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 diff --git a/vm.sh b/vm.sh index 37f0b48..1317383 100755 --- a/vm.sh +++ b/vm.sh @@ -1 +1 @@ -nix-build '' -A vm -I nixpkgs=channel:nixos-23.11 -I nixos-config=./nix-os-configs/vm.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 +nix-build '' -A vm -I nixos-config=./hosts/vm.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2