summaryrefslogtreecommitdiff
path: root/configuration.nix
blob: 22714928f71a62faab0928d2fbd2696abe961f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
{ config, lib, pkgs, ... }:

let
  get_spotify_status = pkgs.writeShellScript "get_spotify_status.sh" ''
    #!/bin/bash
    PARENT_BAR="example"
    PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1)
    PLAYER="playerctld"
    FORMAT="{{ title }} - {{ artist }}"

    update_hooks() {
      while IFS= read -r id; do
        polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1
      done < <(echo "$1")
    }

    PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null)
    EXIT_CODE=$?

    if [ $EXIT_CODE -eq 0 ]; then
      STATUS=$PLAYERCTL_STATUS
    else
      STATUS="No player is running"
    fi

    if [ "$1" == "--status" ]; then
      echo "$STATUS"
    else
      if [ "$STATUS" = "Stopped" ]; then
        echo "Music Stopped"
      elif [ "$STATUS" = "Paused" ]; then
        update_hooks "$PARENT_BAR_PID" 2
        playerctl --player=$PLAYER metadata --format "$FORMAT"
      elif [ "$STATUS" = "No player is running" ]; then
        echo "Music Off"
      else
        update_hooks "$PARENT_BAR_PID" 1
        playerctl --player=$PLAYER metadata --format "$FORMAT"
      fi
    fi
  '';

  hidePolybarInFullscreen = pkgs.writeShellScript "hidePolybarInFullscreen.sh" ''
    #!/usr/bin/env bash
    sleep 1
    i3-msg -t subscribe -m '[ "window" ]' | while read -r event; do
      if echo "$event" | grep -q '"fullscreen_mode":[[:space:]]*1'; then
        polybar-msg cmd hide
      elif echo "$event" | grep -q '"fullscreen_mode":[[:space:]]*0'; then
        polybar-msg cmd show
      fi
    done
  '';
in
{
  imports = [
    ./hardware-configuration.nix
  ];

  nix.settings = {
    substituters = [
      "https://cache.nixos.org/"
    ];

    trusted-public-keys = [
      "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
    ];
    experimental-features = [
        "nix-command"
        "flakes"
      ];
  };


  # === System Settings ===
  boot = {
    kernelPackages = pkgs.linuxPackages_latest;
    initrd = {
      kernelModules = [ "i915" ];
      systemd.enable = true;
    };
    loader = {
      # Hide the OS choice for bootloaders.
      # It's still possible to open the bootloader list by pressing any key
      # It will just not appear on screen unless a key is pressed
      timeout = 0;
      
      efi = {
        canTouchEfiVariables = true;
        efiSysMountPoint = "/boot";
      };
      grub = {
        enable = false;
        device = "nodev";
        useOSProber = true;
        efiSupport = true;
      };
      systemd-boot = {
        enable = true;
        consoleMode = "keep";
        configurationLimit = 5;
      };
    };
    plymouth = {
      enable = true;
      theme = "deus_ex";
      themePackages = with pkgs; [
        # By default we would install all themes
        (adi1090x-plymouth-themes.override {
          selected_themes = [ "deus_ex" ];
        })
      ];
      logo = pkgs.fetchurl {
        url = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn.icon-icons.com%2Ficons2%2F2699%2FPNG%2F512%2Fnixos_logo_icon_170910.png&f=1&nofb=1&ipt=71345d68f1fc864748db54e81111d5853a24fba1d39bdee7cc6fda3e58181bc0";
        sha256 = "sha256-fr1ZnKdX9EeXl2eTIrxEd17DkVKZL8BV9RGmluSgFfk=";
      };
      extraConfig = ''
        DeviceScale=1
      '';
    };

    # Enable "Silent boot"
    consoleLogLevel = 3;
    initrd.verbose = false;
    kernelParams = [
      "quiet"
      "splash"
      "udev.log_level=3"
      "systemd.show_status=auto"
    ];
  };
  networking.hostName = "kronos";
  networking.networkmanager.enable = true;

  fileSystems."/boot".options = [ "fmask=0077" "dmask=0077" ];

  hardware.bluetooth = {
    enable = true;
    powerOnBoot = true;
    settings = {
      General = {
        Experimental = true;
	Enable = "Source,Sink,Media,Socket";
	AutoConnect = true;
	FastConnectabke = true;
      };
      Policy.AutoEnable = true;
    };
  };

  security.pam.sshAgentAuth.enable = true;

# In your configuration.nix
environment.variables = {
  JAVA_HOME = "${pkgs.jdk17}/lib/openjdk";  # adjust path based on version
};

  time.timeZone = "Europe/Prague";

  services.xserver = {
    wacom.enable = true;
    enable = true;
    windowManager.i3 = {
      enable = true;
      extraPackages = with pkgs; [ polybar  i3lock-fancy-rapid ];
    };
    
  };

    services.displayManager.defaultSession = "none+i3";
  services.displayManager.ly = {
	enable = true;
  };
  services.xserver.xkb.layout = "cz";
  services.xserver.xkb.options = "eurosign:e,caps:escape";

  services.printing.enable = true;
  services.pipewire = { enable = true; pulse.enable = true; };
  services.libinput.enable = true;

  users.users = {
    mun = {
      isNormalUser = true;
      extraGroups = [ "wheel" "bluetooth" "networkmanager" "kvm" "nixos" ];
      packages = with pkgs; [ tree ];
      shell = pkgs.zsh;
    };
  };

  programs.firefox.enable = true;
  programs.zsh.enable = true;
  nixpkgs.config.allowUnfree = true;

  environment.systemPackages = with pkgs; [
    neovim wget stdenv tree-sitter discord kitty xfce.thunar thunderbird
    flameshot libreoffice spotify tor-browser alsa-utils helvum
    blueman bluez cava i3status i3lock-fancy-rapid xss-lock polybar
    rofi feh clipman tree git lazygit killall acpi wirelesstools
    brightnessctl fastfetch auto-cpufreq btop cargo gnome-boxes
    clippy xclip texstudio  godotPackages_4_5.godot 
     clang tree-sitter ripgrep fd unzip lua-language-server stylua
    rust-analyzer rustfmt cargo rustc zathura krita
    ruff vtsls pyright imagemagick ghostscript ruff python314 ly
    prismlauncher vlc lua53Packages.luarocks mermaid-cli lua nil obsidian
    wine bottles comic-mono playerctl zscroll espeak qbittorrent perl bzip2
    libresprite audacity libgcc celestia lutris vscodium peazip vscode

    (texlive.combine {
	  inherit (texlive) scheme-full;
	  notestex = texlivePackages.notestex;
	})


    (retroarch.withCores (cores: with cores; [
    # --- NES --- #
    fceumm

    # --- GBA --- #
    mgba

    # --- GB / GBC --- #
    gambatte
    sameboy
  ])) 
    
  ];

  fonts = {
    enableDefaultPackages = true;
    packages = with pkgs; [ fira-code noto-fonts noto-fonts-color-emoji blackout beon];
  };

  programs.steam = {
  enable = true;
  remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
  dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
  localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
  };

   # enable Java support
  programs.java = {
    enable = true;
    package = pkgs.jdk17;  # or pkgs.jdk11, pkgs.jdk8, whatever you need
  };

  services.xserver.videoDrivers = [ "intel" ];

  hardware.graphics = {
  enable = true;
  extraPackages = with pkgs; [
    intel-vaapi-driver # for video acceleration on Intel
    intel-media-driver
    intel-compute-runtime
    mesa
    ];
  };



  services.openssh.enable = true;



  system.stateVersion = "25.11";

}