diff --git a/common/firefox.nix b/common/firefox.nix new file mode 100644 index 0000000..25bf8f8 --- /dev/null +++ b/common/firefox.nix @@ -0,0 +1,48 @@ +{ inputs, pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && firefox.enable) { + environment.systemPackages = [] + ++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ]; + + programs.firefox = { + # package = grimm-shared-inputs.ff_nightly.packages.${pkgs.system}.firefox-nightly-bin; + enable = true; + nativeMessagingHosts.packages = [] + ++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ]; + languagePacks = [ "de" "en-US" ]; + policies = { + ExtensionSettings = lib.mkMerge [ + (lib.mkIf cfg.firefox.disableUserPlugins { + "*".installation_mode = "blocked"; + } ) + (lib.mapAttrs (guid: shortId: { # explicit plugins by config + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; + installation_mode = "force_installed"; + } ) cfg.firefox.plugins ) + (lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) { # password-store support + "passff@invicem.pro" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi"; + installation_mode = "force_installed"; + }; + }) + ]; + DisableTelemetry = true; + DisableFirefoxStudies = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisableFirefoxAccounts = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + DontCheckDefaultBrowser = true; + }; + }; + }; +} diff --git a/common/gaming.nix b/common/gaming.nix new file mode 100644 index 0000000..dd35c7e --- /dev/null +++ b/common/gaming.nix @@ -0,0 +1,47 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && gaming) { + programs.steam = { + enable = true; + gamescopeSession.enable = true; + gamescopeSession.env = { + DRI_PRIME = "1"; + }; + }; + + programs.gamemode = { + enable = true; + settings = { + general = { + inhibit_screensaver=0; + renice = 10; + }; + custom = { + start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; + end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; + }; + }; + }; + + services.udev.packages = [ pkgs.wooting-udev-rules ]; + + environment.sessionVariables = { + GAMEMODERUNEXEC="env DRI_PRIME=1"; + }; + + environment.systemPackages = with pkgs; [ + heroic + prismlauncher + wootility + (pkgs.symlinkJoin { + name = "osu"; + paths = [ + (pkgs.writeShellScriptBin "osu!" ''exec gamemoderun ${pkgs.osu-lazer-bin}/bin/'osu!' + '') + pkgs.osu-lazer-bin + ]; + }) + ]; + }; +} diff --git a/common/localisation.nix b/common/localisation.nix new file mode 100644 index 0000000..f82be35 --- /dev/null +++ b/common/localisation.nix @@ -0,0 +1,29 @@ +{ config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && locale) { + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + console.keyMap = "de"; + + services.xserver.xkb = { + layout = "de"; + variant = ""; + }; + }; +} diff --git a/common/networking.nix b/common/networking.nix new file mode 100644 index 0000000..4fef019 --- /dev/null +++ b/common/networking.nix @@ -0,0 +1,29 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = lib.mkMerge [ + (with cfg; lib.mkIf (enable && network) { + networking.networkmanager.enable = true; + networking.useDHCP = lib.mkDefault true; + networking.firewall.enable = true; + + hardware.bluetooth.enable = true; + + environment.systemPackages = with pkgs; [ + wireguard-tools + bluetuith + ]; + }) + (with cfg; lib.mkIf (enable && network && graphical) { + services.blueman.enable = true; + }) + (with cfg; lib.mkIf (enable && network && sound) { + systemd.user.services.mpris-proxy = { + description = "Mpris proxy"; + after = [ "network.target" "sound.target" ]; + wantedBy = [ "default.target" ]; + serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + }) + ]; +} diff --git a/common/opengl.nix b/common/opengl.nix new file mode 100644 index 0000000..dc41b89 --- /dev/null +++ b/common/opengl.nix @@ -0,0 +1,29 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && graphical) { + # Enable OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; []; + }; + + boot.kernelParams = [ "nouveau.config=NvGspRm=1" ]; + + environment.sessionVariables = { + __GL_LOG_MAX_ANISO = "0"; + __GL_SHADER_DISK_CACHE = "1"; + __GL_SYNC_TO_VBLANK = "0"; + __GL_THREADED_OPTIMIZATIONS = "1"; + __GL_VRR_ALLOWED = "1"; +# MESA_LOADER_DRIVER_OVERRIDE="zink"; +# FLATPAK_GL_DRIVERS="mesa-git"; + }; + + environment.systemPackages = with pkgs; [ + glfw + ]; + }; +} diff --git a/common/pass.nix b/common/pass.nix new file mode 100644 index 0000000..b818606 --- /dev/null +++ b/common/pass.nix @@ -0,0 +1,28 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && tooling.enable && tooling.pass) { + security.polkit.enable = true; + + environment.systemPackages = with pkgs; [ + mkpasswd + pinentry + gnupg + pass + libsecret + (writeShellScriptBin "passw" "pass $@") + ] ++ lib.optionals cfg.graphical [ + lxqt.lxqt-policykit + ]; + + services.passSecretService.enable = true; + programs.gnupg.agent = { + settings = { +# default-cache-ttl = 6000; + }; + pinentryPackage = lib.mkForce pkgs.pinentry; + enable = true; + # enableSSHSupport = true; + }; + }; +} diff --git a/common/portals.nix b/common/portals.nix new file mode 100644 index 0000000..6663c8b --- /dev/null +++ b/common/portals.nix @@ -0,0 +1,22 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && portals) { + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-kde + xdg-desktop-portal-gtk + ]; + }; + + environment.sessionVariables = { + XDG_CONFIG_HOME = "$HOME/.config"; + FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"; + }; + + fonts.fontDir.enable = true; + }; +} diff --git a/common/printing.nix b/common/printing.nix new file mode 100644 index 0000000..6ff5ae7 --- /dev/null +++ b/common/printing.nix @@ -0,0 +1,20 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && printing) { + # Enable CUPS to print documents. + services.printing.enable = true; + services.printing.drivers = with pkgs; [ brgenml1lpr brgenml1cupswrapper ]; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + services.printing.cups-pdf.enable = true; + hardware.sane.brscan4.enable = true; # enables support for SANE scanners + + environment.systemPackages = with pkgs; [ + skanpage + ]; + }; +} diff --git a/common/sound.nix b/common/sound.nix new file mode 100644 index 0000000..0dab593 --- /dev/null +++ b/common/sound.nix @@ -0,0 +1,24 @@ +{ grimm-shared-inputs, pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && sound) { + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; # osu uses jack + lowLatency.enable = true; + systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user + }; + + environment.systemPackages = with pkgs; [ + pavucontrol + playerctl + pulseaudio + ]; + }; +} diff --git a/common/sway-defaults.nix b/common/sway-defaults.nix new file mode 100644 index 0000000..ebc243c --- /dev/null +++ b/common/sway-defaults.nix @@ -0,0 +1,190 @@ +{ inputs, system, pkgs, config, lib, ... }: let + cfg = config.grimmShared; + swaymux_pkg = inputs.swaymux.packages."${system}".default; +in { + config = with cfg; lib.mkIf (enable && sway.enable && sway.populateDefaultConfig ) { + environment.systemPackages = (with pkgs; [ + alacritty + wmenu + grim + slurp + wl-clipboard + ]) + ++ [ swaymux_pkg ]; + + grimmShared.sway = { + definitions = { + mod = "Mod4"; + left = "h"; + down = "j"; + up = "k"; + right = "l"; + term = "alacritty"; + menu = "dmenu_path | wmenu | xargs swaymsg exec --"; + + primecol = "#8800FF"; + accentcol = "#5700a0"; + splitcol = "#69507f"; + actsplitcol = "#cd97fc"; + darkcol = "#202020"; + urgentcol = "#9e3c3c"; + realwhite = "#C7D3E3"; + }; + keybinds = { + "$mod+d" = "exec $menu"; + "$mod+Shift+s" = ''exec grim -g "$(slurp -d)" - | wl-copy''; + "$mod+Return" = "exec $term"; + "$mod+Shift+q" = "kill"; + "$mod+Shift+c" = "reload"; + "$mod+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'"; + + # Move your focus around + "$mod+$left" = "focus left"; + "$mod+$down" = "focus down"; + "$mod+$up" = "focus up"; + "$mod+$right" = "focus right"; + # Or use $mod+[up|down|left|right] + "$mod+Left" = "focus left"; + "$mod+Down" = "focus down"; + "$mod+Up" = "focus up"; + "$mod+Right" = "focus right"; + + # Move the focused window with the same, but add Shift + "$mod+Shift+$left" = "move left"; + "$mod+Shift+$down" = "move down"; + "$mod+Shift+$up" = "move up"; + "$mod+Shift+$right" = "move right"; + # Ditto, with arrow keys + "$mod+Shift+Left" = "move left"; + "$mod+Shift+Down" = "move down"; + "$mod+Shift+Up" = "move up"; + "$mod+Shift+Right" = "move right"; +# +# Workspaces: +# + # Switch to workspace + "$mod+1" = "workspace number 1"; + "$mod+2" = "workspace number 2"; + "$mod+3" = "workspace number 3"; + "$mod+4" = "workspace number 4"; + "$mod+5" = "workspace number 5"; + "$mod+6" = "workspace number 6"; + "$mod+7" = "workspace number 7"; + "$mod+8" = "workspace number 8"; + "$mod+9" = "workspace number 9"; + "$mod+0" = "workspace number 10"; + # Move focused container to workspace + "$mod+Shift+1" = "move container to workspace number 1"; + "$mod+Shift+2" = "move container to workspace number 2"; + "$mod+Shift+3" = "move container to workspace number 3"; + "$mod+Shift+4" = "move container to workspace number 4"; + "$mod+Shift+5" = "move container to workspace number 5"; + "$mod+Shift+6" = "move container to workspace number 6"; + "$mod+Shift+7" = "move container to workspace number 7"; + "$mod+Shift+8" = "move container to workspace number 8"; + "$mod+Shift+9" = "move container to workspace number 9"; + "$mod+Shift+0" = "move container to workspace number 10"; + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + "$mod+b" = "splith"; + "$mod+v" = "splitv"; + + # Switch the current container between different layout styles + "$mod+s" = "layout stacking"; + "$mod+w" = "layout tabbed"; + "$mod+e" = "layout toggle split"; + + # Make the current focus fullscreen + "$mod+f" = "fullscreen"; + + # Toggle the current focus between tiling and floating mode + "$mod+Shift+space" = "floating toggle"; + + # Swap focus between the tiling area and the floating area + "$mod+space" = "focus mode_toggle"; + + # Move focus to the parent container + "$mod+a" = "focus parent"; + + "$mod+Shift+minus" = "move scratchpad"; + "$mod+minus" = "scratchpad show"; + + "$mod+r" = ''mode "resize"''; + + "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + "$mod+c" = "exec swaymux"; + }; + autolaunch = [ # fixme: absolute paths + "blueman-applet" + "lxqt-policykit-agent" + "otd-daemon" + "dunst" + "systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP" + ]; + extraConfig = '' +# fixme: wallpaper +output * bg ${./wallpapers/spain.jpg} fill +output HDMI-A-1 mode 1920x1080@60Hz position 0,0 +for_window [app_id="lxqt-policykit-agent"] floating enable; +floating_modifier $mod normal + +bar { + swaybar_command waybar +} +input type:keyboard xkb_numlock enabled +include /etc/sway/config.d/* + +# Borders, gaps, titlebars, behavior +default_border pixel 3 +default_floating_border pixel 3 +gaps inner 5 +titlebar_padding 5 5 + +#5Smart things +smart_gaps on +hide_edge_borders --i3 smart + + +input * { + xkb_layout "de" +} + +for_window [app_id="swaymux"] floating enable + +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrrnk width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +# test + ''; + }; + }; +} + diff --git a/common/sway.nix b/common/sway.nix new file mode 100644 index 0000000..7e8fcf9 --- /dev/null +++ b/common/sway.nix @@ -0,0 +1,80 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = let + build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}"); + build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}"); + build_exec_lines = map (item: "exec " + item); + + text = lib.strings.concatLines [ + (lib.strings.concatLines (build_definition_lines cfg.sway.definitions)) + (lib.strings.concatLines (build_keybind_lines cfg.sway.keybinds)) + (lib.strings.concatLines (build_exec_lines cfg.sway.autolaunch)) + cfg.sway.extraConfig + ]; + + sway_conf = pkgs.writeText "sway.conf" text; + in with cfg; lib.mkIf (enable && sway.enable) { + environment.etc."sway.conf" = { + source = sway_conf; + }; + + environment.systemPackages = with pkgs; [ + procps + slurp + libnotify + ]; + + systemd.services.reload-sway = { + description = "Reload all running sway instances"; + wantedBy = [ "multi-user.target" ]; + + serviceConfig.Type = "oneshot"; + script ='' +for pid in $(${pkgs.procps}/bin/pgrep sway -x) +do + uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid)) + export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock" + if [[ -e "$SWAYSOCK" ]] ; then + echo "sock is $SWAYSOCK" + ${config.programs.sway.package}/bin/swaymsg reload + fi +done +''; + reloadTriggers = [ text ]; + }; + + programs.waybar.enable = true; + + programs.sway = { + enable = true; + wrapperFeatures = { + gtk = true; + base = true; + }; + + extraPackages = with pkgs; [ + swaylock + swayidle + wl-clipboard + wf-recorder + dmenu + wmenu + ]; + extraOptions = [ + "--unsupported-gpu" + "--config" + "/etc/sway.conf" + ]; + extraSessionCommands = '' + export XDG_CURRENT_DESKTOP=sway + export SDL_VIDEODRIVER=wayland + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export _JAVA_AWT_WM_NONREPARENTING=1 + export MOZ_ENABLE_WAYLAND=1 +# export MESA_LOADER_DRIVER_OVERRIDE="zink" + ''; + }; + }; +} diff --git a/common/toolchains.nix b/common/toolchains.nix new file mode 100644 index 0000000..b882a90 --- /dev/null +++ b/common/toolchains.nix @@ -0,0 +1,106 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && tooling.enable) { + environment.systemPackages = with pkgs; [ + (writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@") + (writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@") + (writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@") + gcc + jdk17 + python3 + pkg-config + + tea + acpi + + fbcat + gomuks + gotop + ranger + nix-search-cli + + wget + tree + file + util-linux + visualvm + ffmpeg-full + lm_sensors + imagemagick + pypy3 + nmap + + hyfetch + acpi + lshw + pciutils + usbutils + powertop + parted + ] ++ lib.optionals cfg.graphical [ + qdirstat + libva-utils + glxinfo + alacritty + vulkan-tools + pdfarranger + nomacs + gparted + ]; + + programs.git = { + enable = true; + lfs.enable = true; + config = { + init.defaultBranch = "main"; + credential.username = cfg.tooling.git_user; + core.editor = "${pkgs.neovim}/bin/nvim"; + user.name = cfg.tooling.git_user; + user.email = cfg.tooling.git_email; + }; + }; + + programs.tmux = { + enable = true; + historyLimit = 42000; + #keyMode = "vi"; + }; + + virtualisation.docker.enable = true; + + + programs.neovim = { + enable = true; + viAlias = true; + defaultEditor = true; + configure = { + customRC = '' + set number + set hidden + set fileencodings=utf-8 + set nocompatible + set clipboard+=unnamedplus + if filereadable($HOME . "/.vimrc") + source ~/.vimrc + endif +''; + packages.myVimPackage = with pkgs.vimPlugins; { + # loaded on launch + start = [ + vim-nix + vim-scala + fugitive + ]; + + # manually loadable by calling `:packadd $plugin-name` + opt = [ ]; + }; + }; + }; + + programs.xonsh.enable = true; + programs.ssh.startAgent = true; + programs.thefuck.enable = true; + }; +} diff --git a/common/wallpapers/spain.jpg b/common/wallpapers/spain.jpg new file mode 100644 index 0000000..55df2d9 Binary files /dev/null and b/common/wallpapers/spain.jpg differ diff --git a/common/wallpapers/switzerland.jpg b/common/wallpapers/switzerland.jpg new file mode 100644 index 0000000..7729593 Binary files /dev/null and b/common/wallpapers/switzerland.jpg differ diff --git a/configuration.nix b/configuration.nix index 2534f02..d7aeaed 100644 --- a/configuration.nix +++ b/configuration.nix @@ -6,17 +6,10 @@ { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix + ./modules/fonts.nix + ./modules/tabletdriver.nix ]; - nix.settings.system-features = [ - "gccarch-icelake-client" - "kvm" - "big-parallel" - "benchmark" - "nixos-test" - ]; - # Bootloader. boot = { loader.systemd-boot.enable = true; @@ -45,7 +38,6 @@ }; sound = true; graphical = true; - gaming = true; firefox = { enable = true; plugins = { @@ -70,13 +62,8 @@ platformTheme = "kde"; }; - age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ]; - - networking.hostName = "grimmauld-nixos"; - environment.sessionVariables = { NIXPKGS_ALLOW_UNFREE="1"; - OMP_NUM_THREADS = "12"; MOZ_ENABLE_WAYLAND="1"; # QT_QPA_PLATFORM="wayland-egl"; OCI_CLI_RC_FILE="/home/grimmauld/.oci/config"; @@ -87,26 +74,6 @@ nix.settings.experimental-features = [ "nix-command" "flakes" ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # 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"; # "23.05"; # Did you read the comment? programs.dconf.enable = true; diff --git a/flake.lock b/flake.lock index 97902fc..a2dbdc0 100644 --- a/flake.lock +++ b/flake.lock @@ -56,22 +56,6 @@ "url": "https://flakehub.com/f/zhaofengli/attic/0.1.%2A.tar.gz" } }, - "cachix": { - "locked": { - "lastModified": 1635350005, - "narHash": "sha256-tAMJnUwfaDEB2aa31jGcu7R7bzGELM9noc91L2PbVjg=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-20.09", - "repo": "nixpkgs", - "type": "github" - } - }, "chaotic": { "inputs": { "attic": "attic", @@ -94,11 +78,11 @@ "yafas": "yafas" }, "locked": { - "lastModified": 1710954445, - "narHash": "sha256-vU2OGteZS6dMKZcu+btwsNN4HxIwhEb8dzP+h5NgKps=", + "lastModified": 1711229481, + "narHash": "sha256-mugLPd8wlCx1s1PDv/sIFJq5xK3sycf+fROFHvE8boE=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "2952a351037582a8aeb11be9cf57901d872bcf30", + "rev": "1520b69fa40d96c5e95b6e0da65831d3c7130fb0", "type": "github" }, "original": { @@ -230,31 +214,6 @@ "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A.tar.gz" } }, - "ff_nightly": { - "inputs": { - "cachix": "cachix", - "flake-compat": "flake-compat_2", - "lib-aggregate": "lib-aggregate", - "mozilla": "mozilla", - "nixpkgs": [ - "shared", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1710982600, - "narHash": "sha256-KC8V8aTUHZAORn0uJ5ENKkF8VIBvNmZvkF/O/nSaB1A=", - "owner": "nix-community", - "repo": "flake-firefox-nightly", - "rev": "6778dc738c3a40a63df286005d44d2ddf5903e47", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "flake-firefox-nightly", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -270,40 +229,9 @@ "url": "https://flakehub.com/f/edolstra/flake-compat/%2A.tar.gz" } }, - "flake-compat_2": { - "locked": { - "lastModified": 1688025799, - "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", - "owner": "nix-community", - "repo": "flake-compat", - "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { "lastModified": 1709336216, @@ -353,24 +281,6 @@ "url": "https://flakehub.com/f/numtide/flake-utils/0.1.%2A.tar.gz" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -460,41 +370,6 @@ "type": "github" } }, - "lib-aggregate": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1710677371, - "narHash": "sha256-yqjXunc+Zvqf6rcH7W9wMvhr18jMZhDvIdnretlfj78=", - "owner": "nix-community", - "repo": "lib-aggregate", - "rev": "f890211817b941d9ed9de48d62ba8553fa2c20f3", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "lib-aggregate", - "type": "github" - } - }, - "mozilla": { - "flake": false, - "locked": { - "lastModified": 1704373101, - "narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=", - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2", - "type": "github" - }, - "original": { - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "type": "github" - } - }, "niri": { "inputs": { "crane": [ @@ -551,16 +426,15 @@ "inputs": { "flake-parts": "flake-parts", "nixpkgs": [ - "shared", "nixpkgs" ] }, "locked": { - "lastModified": 1711003080, - "narHash": "sha256-YAycKYKMytiQe9L6yZuVcq/1rCFcDHIA6/G78oSofV8=", + "lastModified": 1711242788, + "narHash": "sha256-6m6hw6uoIIvoAMR5RLhw7kGfNu3Govof9vnPAzveUgI=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "1e435616e688c2b9125cd5282febcad3ab981d5e", + "rev": "04028200841ec3b4ce163de4d136296d03123001", "type": "github" }, "original": { @@ -594,11 +468,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1710806803, - "narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=", + "lastModified": 1711163522, + "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3", + "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4", "type": "github" }, "original": { @@ -609,21 +483,6 @@ } }, "nixpkgs-lib": { - "locked": { - "lastModified": 1710636348, - "narHash": "sha256-/kB+ZWSdkZjbZ0FTqm0u84sf2jFS+30ysaEajmBjtoY=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "fa827dda806c5aa98f454da4c567991ab8ce422c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixpkgs-lib_2": { "locked": { "dir": "lib", "lastModified": 1709237383, @@ -661,8 +520,9 @@ "inputs": { "agenix": "agenix", "chaotic": "chaotic", + "nix-gaming": "nix-gaming", "nixpkgs": "nixpkgs", - "shared": "shared" + "swaymux": "swaymux" } }, "rust-analyzer-src": { @@ -709,34 +569,9 @@ "type": "github" } }, - "shared": { - "inputs": { - "ff_nightly": "ff_nightly", - "flake-compat": "flake-compat_3", - "nix-gaming": "nix-gaming", - "nixpkgs": [ - "nixpkgs" - ], - "swaymux": "swaymux", - "utils": "utils" - }, - "locked": { - "dirtyRev": "154b9aa8ec511edf7c3a62c94f5d04f5d070e36e-dirty", - "dirtyShortRev": "154b9aa-dirty", - "lastModified": 1710718492, - "narHash": "sha256-eonlerwNvoyXvtoLDQKtHXR/aP6pRX6YrbakcOfKY7Q=", - "type": "git", - "url": "file:///home/grimmauld/shared" - }, - "original": { - "type": "git", - "url": "file:///home/grimmauld/shared" - } - }, "swaymux": { "inputs": { "nixpkgs": [ - "shared", "nixpkgs" ] }, @@ -784,54 +619,6 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "inputs": { - "systems": "systems_4" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "yafas": { "inputs": { "flake-schemas": [ diff --git a/flake.nix b/flake.nix index 9090aa0..578de27 100644 --- a/flake.nix +++ b/flake.nix @@ -13,14 +13,17 @@ url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; }; - shared = { -# url = "git+https://git.grimmauld.de/Grimmauld/grimm-nix-shared"; - url = "git+file:///home/grimmauld/shared"; + nix-gaming = { + url = "github:fufexan/nix-gaming"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + swaymux = { + url = "git+https://git.grimmauld.de/Grimmauld/swaymux"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = inputs @ { self, agenix, shared, nixpkgs, chaotic, ... }: let + outputs = inputs @ { self, swaymux, nix-gaming, agenix, nixpkgs, chaotic, ... }: let system = "x86_64-linux"; in { nixosConfigurations = { @@ -30,15 +33,16 @@ modules = [ agenix.nixosModules.default chaotic.nixosModules.default - shared.nixosModules.default + inputs.nix-gaming.nixosModules.pipewireLowLatency + ./load_common.nix + ./specific/grimm-nixos-laptop.nix + # ./kernel.nix ./configuration.nix ./modules/users.nix # ./modules/tlp.nix - ./modules/fonts.nix ./modules/screenshare_select.nix ./modules/spotify-tui.nix - ./modules/tabletdriver.nix ./modules/xserver.nix ./modules/system-packages.nix ./modules/kvm.nix diff --git a/load_common.nix b/load_common.nix new file mode 100644 index 0000000..0e61963 --- /dev/null +++ b/load_common.nix @@ -0,0 +1,138 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.grimmShared; +in { + options.grimmShared = { + enable = mkEnableOption "grimm-shared-common"; + + locale = mkOption { + type = types.bool; + default = true; + description = "Sets german units but english language"; + }; + + printing = mkOption { + type = types.bool; + default = false; + description = "Enables print and scan related options"; + }; + + portals = mkOption { + type = types.bool; + default = false; + description = "Enables portals for wlr, gtk and kde as well as fixes fonts"; + }; + + network = mkOption { + type = types.bool; + default = false; + description = "Enables network manager, wifi and bluetooth"; + }; + + tooling = { + enable = mkEnableOption "grimm-tooling"; + + pass = mkOption { + type = types.bool; + default = true; + description = "Enables password-store, gnupg and such secret handling"; + }; + + git_user = mkOption { + type = types.str; + default = "Grimmauld"; + description = "Username for git to use"; + }; + + git_email = mkOption { + type = types.str; + default = "${config.grimmShared.tooling.git_user}@grimmauld.de"; + description = "Email for git to use"; + }; + }; + + sound = mkOption { + type = types.bool; + default = false; + description = "whether to enable sound"; + }; + + graphical = mkOption { + type = types.bool; + default = false; + description = "whether to enable graphical components"; + }; + + gaming = mkOption { + type = types.bool; + default = false; + description = "enables steam, heroic, prism and gamemoded"; + }; + + firefox = { + enable = mkEnableOption "grimm-firefox"; + + plugins = mkOption { + type = types.attrsOf types.str; + default = {}; + description = "set of plugins to install. Format: guid = short-id"; + }; + + disableUserPlugins = mkOption { + type = types.bool; + default = false; + description = "disables user controlled plugins"; + }; + }; + + sway = { + enable = mkEnableOption "grimm-sway"; + + definitions = mkOption { + type = types.attrsOf types.str; + default = {}; + description = "set of definitions assigning variable to value"; + }; + + keybinds = mkOption { + type = types.attrsOf types.str; + default = {}; + description = "set of keybinds assigning key combo to action"; + }; + + autolaunch = mkOption { + type = types.listOf types.str; + default = []; + description = "set of commands to be run at sway startup"; + }; + + extraConfig = mkOption { + type = types.str; + default = ""; + description = "additional sway config to be included"; + }; + + populateDefaultConfig = mkOption { + type = types.bool; + default = false; + description = "puts my personal config in place using above methods"; + }; + }; + }; + + imports = [ + ./common/localisation.nix + ./common/printing.nix + ./common/portals.nix + ./common/networking.nix + ./common/toolchains.nix + ./common/sound.nix + ./common/opengl.nix + ./common/gaming.nix + ./common/firefox.nix + ./common/pass.nix + ./common/sway.nix + ./common/sway-defaults.nix + ]; +} diff --git a/hardware-configuration.nix b/specific/grimm-nixos-laptop-hardware.nix similarity index 100% rename from hardware-configuration.nix rename to specific/grimm-nixos-laptop-hardware.nix diff --git a/specific/grimm-nixos-laptop.nix b/specific/grimm-nixos-laptop.nix new file mode 100644 index 0000000..f1aa240 --- /dev/null +++ b/specific/grimm-nixos-laptop.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: { + imports = [ # Include the results of the hardware scan. + ./grimm-nixos-laptop-hardware.nix + ]; + + age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ]; + + networking.hostName = "grimmauld-nixos"; + + environment.sessionVariables = { + OMP_NUM_THREADS = "12"; + }; + + system.stateVersion = "23.05"; + + grimmShared.gaming = true; +}