diff --git a/apps/firefox.nix b/apps/firefox.nix deleted file mode 100644 index ba77c65..0000000 --- a/apps/firefox.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ pkgs, config, nur, lib, ... }: - - -let - mkAddOn = shortname: addonid: { - "${addonid}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/${shortname}/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - - -in -{ - programs.firefox = { - enable = true; - }; - - programs.firefox.policies = { - ExtensionSettings = lib.mkMerge [ - (mkAddOn "ublock-origin" "uBlock0@raymondhill.net") - (mkAddOn "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}") - (mkAddOn "i-dont-care-about-cookies" "jid1-KKzOGWgsW3Ao4Q@jetpack") - ]; - }; -} diff --git a/flake.nix b/flake.nix index b3762fd..b5799d3 100644 --- a/flake.nix +++ b/flake.nix @@ -7,33 +7,31 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + nur.url = "github:nix-community/NUR"; }; - inputs.nur.url = github:nix-community/NUR; + outputs = { nixpkgs, home-manager, nur, ... }: { + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; - outputs = { nixpkgs, home-manager, nur, ... }: - let - system = "x86_64-linux"; - in - { - nixosConfigurations = { - nixos = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - nur.nixosModules.nur - ./nixos/configuration.nix - home-manager.nixosModules.home-manager - ({ config, ... }: { - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - users.user = ./home-manager/home.nix; - extraSpecialArgs.nur = config.nur; - }; - }) - ]; - }; + modules = [ + ./nixos + + home-manager.nixosModules.home-manager + nur.nixosModules.nur + + ({ config, ... }: { + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + users.user = ./home-manager; + extraSpecialArgs.nur = config.nur; + }; + }) + ]; }; }; + }; } diff --git a/home-manager/apps/firefox.nix b/home-manager/apps/firefox.nix deleted file mode 100644 index ba77c65..0000000 --- a/home-manager/apps/firefox.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ pkgs, config, nur, lib, ... }: - - -let - mkAddOn = shortname: addonid: { - "${addonid}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/${shortname}/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - - -in -{ - programs.firefox = { - enable = true; - }; - - programs.firefox.policies = { - ExtensionSettings = lib.mkMerge [ - (mkAddOn "ublock-origin" "uBlock0@raymondhill.net") - (mkAddOn "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}") - (mkAddOn "i-dont-care-about-cookies" "jid1-KKzOGWgsW3Ao4Q@jetpack") - ]; - }; -} diff --git a/home-manager/apps/jetbrains-clion-override-neo2.nix b/home-manager/apps/jetbrains-clion-override-neo2.nix deleted file mode 100644 index db9d10e..0000000 --- a/home-manager/apps/jetbrains-clion-override-neo2.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ pkgs }: - -let - neo2AwtHackJar = pkgs.fetchurl { - url = "https://github.com/chenkelmann/neo2-awt-hack/blob/master/releases/neo2-awt-hack-0.5-java8oracle.jar?raw=true"; - sha256 = "sha256-/2OGd2Nl7tRqkB73LJjLXMlRwFHwOdX9cnXRk5BP3S8="; - name = "neo2-awt-hack-0.5.jar"; - }; -in - -pkgs.jetbrains.clion.overrideAttrs (oldAttrs: { - - postInstall = oldAttrs.postInstall or "" + '' - cp ${neo2AwtHackJar} $out/clion/neo2-awt-hack-0.5.jar - - # 1. Extrahieren Sie die letzten zwei Zeilen in eine temporäre Datei. - tail -n 2 $out/clion/bin/.clion.sh-wrapped > temp_last_lines.txt - - # 2. Löschen Sie die letzten zwei Zeilen aus der ursprünglichen Datei. - sed -i 'N;$!P;$!D;$d' $out/clion/bin/.clion.sh-wrapped - - # 3. Fügen Sie den gewünschten String zur ursprünglichen Datei hinzu. - # echo "--patch-module=java.desktop=../neo2-awt-hack-0.5.jar \\" >> $out/clion/bin/.clion.sh-wrapped - echo "--patch-module=java.desktop=$out/clion/neo2-awt-hack-0.5.jar \\" >> $out/clion/bin/.clion.sh-wrapped - - # 4. Fügen Sie die ursprünglichen letzten zwei Zeilen wieder an die ursprüngliche Datei an. - cat temp_last_lines.txt >> $out/clion/bin/.clion.sh-wrapped - - # Aufräumen - rm temp_last_lines.txt - ''; -}) - diff --git a/home-manager/apps/jetbrains-idea-ultimate-override-neo2.nix b/home-manager/apps/jetbrains-idea-ultimate-override-neo2.nix deleted file mode 100644 index 9de1a02..0000000 --- a/home-manager/apps/jetbrains-idea-ultimate-override-neo2.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ pkgs }: - -let - neo2AwtHackJar = pkgs.fetchurl { - url = "https://github.com/chenkelmann/neo2-awt-hack/blob/master/releases/neo2-awt-hack-0.5-java8oracle.jar?raw=true"; - sha256 = "sha256-/2OGd2Nl7tRqkB73LJjLXMlRwFHwOdX9cnXRk5BP3S8="; - name = "neo2-awt-hack-0.5.jar"; - }; -in - -pkgs.jetbrains.idea-ultimate.overrideAttrs (oldAttrs: { - postInstall = oldAttrs.postInstall or "" + '' - cp ${neo2AwtHackJar} $out/idea-ultimate/neo2-awt-hack-0.5.jar - - # 1. Extrahieren Sie die letzten zwei Zeilen in eine temporäre Datei. - tail -n 2 $out/idea-ultimate/bin/.idea.sh-wrapped > temp_last_lines.txt - - # 2. Löschen Sie die letzten zwei Zeilen aus der ursprünglichen Datei. - sed -i 'N;$!P;$!D;$d' $out/idea-ultimate/bin/.idea.sh-wrapped - - # 3. Fügen Sie den gewünschten String zur ursprünglichen Datei hinzu. - # echo "--patch-module=java.desktop=../neo2-awt-hack-0.5.jar \\" >> $out/idea-ultimate/bin/.idea.sh-wrapped - echo "--patch-module=java.desktop=$out/idea-ultimate/neo2-awt-hack-0.5.jar \\" >> $out/idea-ultimate/bin/.idea.sh-wrapped - - # 4. Fügen Sie die ursprünglichen letzten zwei Zeilen wieder an die ursprüngliche Datei an. - cat temp_last_lines.txt >> $out/idea-ultimate/bin/.idea.sh-wrapped - - # Aufräumen - rm temp_last_lines.txt - ''; -}) - diff --git a/home-manager/default.nix b/home-manager/default.nix new file mode 100644 index 0000000..7c85f28 --- /dev/null +++ b/home-manager/default.nix @@ -0,0 +1,25 @@ +{ + imports = [ + ./i3.nix + ./i3status.nix + ./misc.nix + ./neovim.nix + ./protonmail-bridge.nix + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Home Manager needs a bit of information about you and the paths it should + home.username = "user"; + home.homeDirectory = "/home/user"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.05"; # Please read the comment before changing. +} diff --git a/home-manager/home.nix b/home-manager/home.nix deleted file mode 100644 index 6e14769..0000000 --- a/home-manager/home.nix +++ /dev/null @@ -1,299 +0,0 @@ -{ config, pkgs, nur, ... }: - -let - ideaUltimateModified = import ./apps/jetbrains-idea-ultimate-override-neo2.nix { inherit pkgs; }; - clionModified = import ./apps/jetbrains-clion-override-neo2.nix { inherit pkgs; }; - mod = "Mod4"; - -in -{ - programs.i3status-rust = { - enable = true; - bars = { - top = { - blocks = [ - { - block = "sound"; - } - { - block = "speedtest"; - interval = 600; - - # format = "$ping.eng(w:4)"; - format = " ^icon_ping $ping ^icon_net_down $speed_down ^icon_net_up $speed_up "; - - } - - { - block = "disk_space"; - } - { - block = "battery"; - } - { - block = "temperature"; - } - { - block = "amd_gpu"; - } - { - block = "cpu"; - } - { - block = "time"; - interval = 1; - format = " $timestamp.datetime(f:'%Y.%m.%d %H:%M:%S') "; - } - ]; - }; - }; - }; - - - # todo move to own file - xsession.windowManager.i3 = { - enable = true; - - extraConfig = '' - font pango:monospace 14 - workspace_layout tabbed - client.focused #4c7899 #2a3843 #ffffff #2e9ef4 #285577 - ''; - config = { - - - bars = [ - { - - fonts = [ "DejaVu Sans Mono, FontAwesome 15" ]; - position = "top"; - statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-top.toml"; - } - ]; - - - modifier = mod; - keybindings = { - - "${mod}+Shift+F1" = "exec --no-startup-id \"xset dpms force off\""; - - # start terminal - "${mod}+Return" = "exec --no-startup-id \"exo-open --launch TerminalEmulator\""; - - - - # Right Hand: - # Focus - "${mod}+n" = "focus left"; - "${mod}+g" = "focus up"; - "${mod}+r" = "focus down"; - "${mod}+t" = "focus right"; - - - - # Move - "${mod}+Shift+n" = "move left"; - "${mod}+Shift+g" = "move up"; - "${mod}+Shift+r" = "move down"; - "${mod}+Shift+t" = "move right"; - - - # Left Hand: - # Focus - "${mod}+u" = "focus left"; - "${mod}+v" = "focus up"; - "${mod}+i" = "focus down"; - "${mod}+a" = "focus right"; - - # Move - "${mod}+Shift+u" = "move left"; - "${mod}+Shift+v" = "move up"; - "${mod}+Shift+i" = "move down"; - "${mod}+Shift+a" = "move right"; - - - - # legacy - # focus - "${mod}+Left" = "focus left"; - "${mod}+Down" = "focus down"; - "${mod}+Up" = "focus up"; - "${mod}+Right" = "focus right"; - - # move - "${mod}+Shift+Left" = "move left"; - "${mod}+Shift+Down" = "move down"; - "${mod}+Shift+Up" = "move up"; - "${mod}+Shift+Right" = "move right"; - - - # workspaces: - "${mod}+1" = "workspace 1"; - "${mod}+2" = "workspace 2"; - "${mod}+3" = "workspace 3"; - "${mod}+4" = "workspace 4"; - "${mod}+5" = "workspace 5"; - "${mod}+6" = "workspace 6"; - "${mod}+7" = "workspace 7"; - "${mod}+8" = "workspace 8"; - "${mod}+9" = "workspace 9"; - "${mod}+0" = "workspace 10"; - - - "${mod}+Shift+1" = "move container to workspace 1"; - "${mod}+Shift+2" = "move container to workspace 2"; - "${mod}+Shift+3" = "move container to workspace 3"; - "${mod}+Shift+4" = "move container to workspace 4"; - "${mod}+Shift+5" = "move container to workspace 5"; - "${mod}+Shift+6" = "move container to workspace 6"; - "${mod}+Shift+7" = "move container to workspace 7"; - "${mod}+Shift+8" = "move container to workspace 8"; - "${mod}+Shift+9" = "move container to workspace 9"; - "${mod}+Shift+0" = "move container to workspace 10"; - - - # Arbeitsbereich nach rechts/links wechseln - # right hand - "${mod}+f" = "workspace next"; - "${mod}+h" = "workspace prev"; - # left hand - "${mod}+l" = "workspace next"; - "${mod}+x" = "workspace prev"; - - "${mod}+shift+q" = "kill"; - - - - "${mod}+Shift+c" = "restart"; - "${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\""; - - # "${mod}+u" = "exec --no-startup-id dmenu_run"; - - "${mod}+s" = "split h"; - "${mod}+Shift+s" = "layout splith"; - - "${mod}+y" = "split v"; - "${mod}+Shift+y" = "layout splitv"; - - - "${mod}+m" = "fullscreen toggle"; - - "${mod}+b" = "layout stacking"; - "${mod}+comma" = "layout tabbed"; - "${mod}+space" = "floating toggle"; - # TODO what is this?? "${mod}+Shift+space" = "focus mode_toggle"; - - }; - }; - }; - - imports = [ - ./apps/neovim.nix - ./modules/protonmail-bridge.nix - ]; - # Home Manager needs a bit of information about you and the paths it should - - home.username = "user"; - home.homeDirectory = "/home/user"; - - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - home.stateVersion = "23.05"; # Please read the comment before changing. - - # The home.packages option allows you to install Nix packages into your - # environment. - home.packages = [ - # # Adds the 'hello' command to your environment. It prints a friendly - # # "Hello, world!" when run. - # pkgs.hello - pkgs.htop - pkgs.vim - pkgs.wget - pkgs.tree - pkgs.git - pkgs.rpi-imager - - pkgs.element-desktop - pkgs.protonmail-bridge - pkgs.thunderbird - - pkgs.mullvad-browser - - # open source (https://github.com/th-ch/youtube-music) - pkgs.youtube-music - #pkgs.jetbrains.idea-ultimate - ideaUltimateModified - clionModified - nur.repos.mic92.hello-nur - - pkgs.joplin-desktop - pkgs.signal-desktop - pkgs.slack - - pkgs.qbittorrent - pkgs.vlc - - - - pkgs.barrier # keyboard and mouse sharing - pkgs.libreoffice - - - pkgs.speedtest-cli - - - pkgs.monero-gui - # dev - # # It is sometimes useful to fine-tune packages, for example, by applying - # # overrides. You can do that directly here, just don't forget the - # # parentheses. Maybe you want to install Nerd Fonts with a limited number of - # # fonts? - # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) - - # # You can also create simple shell scripts directly inside your - # # configuration. For example, this adds a command 'my-hello' to your - # # environment: - # (pkgs.writeShellScriptBin "my-hello" '' - # echo "Hello, ${config.home.username}!" - # '') - ]; - - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - home.file = { - # # Building this configuration will create a copy of 'dotfiles/screenrc' in - # # the Nix store. Activating the configuration will then make '~/.screenrc' a - # # symlink to the Nix store copy. - # ".screenrc".source = dotfiles/screenrc; - - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; - }; - - # You can also manage environment variables but you will have to manually - # source - # - # ~/.nix-profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # /etc/profiles/per-user/user/etc/profile.d/hm-session-vars.sh - # - # if you don't want to manage your shell through Home Manager. - home.sessionVariables = { - # EDITOR = "emacs"; - }; - - - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; -} diff --git a/home-manager/i3.nix b/home-manager/i3.nix new file mode 100644 index 0000000..a872d69 --- /dev/null +++ b/home-manager/i3.nix @@ -0,0 +1,124 @@ +{ pkgs, ... }: + +let + mod = "Mod4"; +in +{ + xsession.windowManager.i3 = { + enable = true; + + extraConfig = '' + font pango:monospace 14 + workspace_layout tabbed + client.focused #4c7899 #2a3843 #ffffff #2e9ef4 #285577 + ''; + + config = { + bars = [{ + fonts = [ "DejaVu Sans Mono, FontAwesome 15" ]; + position = "top"; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-top.toml"; + }]; + + modifier = mod; + keybindings = { + "${mod}+Shift+F1" = "exec --no-startup-id \"xset dpms force off\""; + + # start terminal + "${mod}+Return" = "exec --no-startup-id \"exo-open --launch TerminalEmulator\""; + + # Right Hand: + # Focus + "${mod}+n" = "focus left"; + "${mod}+g" = "focus up"; + "${mod}+r" = "focus down"; + "${mod}+t" = "focus right"; + + # Move + "${mod}+Shift+n" = "move left"; + "${mod}+Shift+g" = "move up"; + "${mod}+Shift+r" = "move down"; + "${mod}+Shift+t" = "move right"; + + # Left Hand: + # Focus + "${mod}+u" = "focus left"; + "${mod}+v" = "focus up"; + "${mod}+i" = "focus down"; + "${mod}+a" = "focus right"; + + # Move + "${mod}+Shift+u" = "move left"; + "${mod}+Shift+v" = "move up"; + "${mod}+Shift+i" = "move down"; + "${mod}+Shift+a" = "move right"; + + # legacy + # focus + "${mod}+Left" = "focus left"; + "${mod}+Down" = "focus down"; + "${mod}+Up" = "focus up"; + "${mod}+Right" = "focus right"; + + # move + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Down" = "move down"; + "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+Right" = "move right"; + + # workspaces: + "${mod}+1" = "workspace 1"; + "${mod}+2" = "workspace 2"; + "${mod}+3" = "workspace 3"; + "${mod}+4" = "workspace 4"; + "${mod}+5" = "workspace 5"; + "${mod}+6" = "workspace 6"; + "${mod}+7" = "workspace 7"; + "${mod}+8" = "workspace 8"; + "${mod}+9" = "workspace 9"; + "${mod}+0" = "workspace 10"; + + + "${mod}+Shift+1" = "move container to workspace 1"; + "${mod}+Shift+2" = "move container to workspace 2"; + "${mod}+Shift+3" = "move container to workspace 3"; + "${mod}+Shift+4" = "move container to workspace 4"; + "${mod}+Shift+5" = "move container to workspace 5"; + "${mod}+Shift+6" = "move container to workspace 6"; + "${mod}+Shift+7" = "move container to workspace 7"; + "${mod}+Shift+8" = "move container to workspace 8"; + "${mod}+Shift+9" = "move container to workspace 9"; + "${mod}+Shift+0" = "move container to workspace 10"; + + # Arbeitsbereich nach rechts/links wechseln + # right hand + "${mod}+f" = "workspace next"; + "${mod}+h" = "workspace prev"; + # left hand + "${mod}+l" = "workspace next"; + "${mod}+x" = "workspace prev"; + + "${mod}+shift+q" = "kill"; + + "${mod}+Shift+c" = "restart"; + "${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\""; + + # "${mod}+u" = "exec --no-startup-id dmenu_run"; + + "${mod}+s" = "split h"; + "${mod}+Shift+s" = "layout splith"; + + "${mod}+y" = "split v"; + "${mod}+Shift+y" = "layout splitv"; + + + "${mod}+m" = "fullscreen toggle"; + + "${mod}+b" = "layout stacking"; + "${mod}+comma" = "layout tabbed"; + "${mod}+space" = "floating toggle"; + # TODO what is this?? "${mod}+Shift+space" = "focus mode_toggle"; + }; + }; + }; +} diff --git a/home-manager/i3status.nix b/home-manager/i3status.nix new file mode 100644 index 0000000..f540365 --- /dev/null +++ b/home-manager/i3status.nix @@ -0,0 +1,38 @@ +{ + programs.i3status-rust = { + enable = true; + + bars.top.blocks = [ + { + block = "sound"; + } + { + block = "speedtest"; + interval = 600; + # format = "$ping.eng(w:4)"; + format = " ^icon_ping $ping ^icon_net_down $speed_down ^icon_net_up $speed_up "; + } + + { + block = "disk_space"; + } + { + block = "battery"; + } + { + block = "temperature"; + } + { + block = "amd_gpu"; + } + { + block = "cpu"; + } + { + block = "time"; + interval = 1; + format = " $timestamp.datetime(f:'%Y.%m.%d %H:%M:%S') "; + } + ]; + }; +} diff --git a/home-manager/misc.nix b/home-manager/misc.nix new file mode 100644 index 0000000..fc47817 --- /dev/null +++ b/home-manager/misc.nix @@ -0,0 +1,46 @@ +{ pkgs, nur, ... }: + +let + jetbrains-override-neo2 = pkgs.callPackage ../pkgs/jetbrains-override-neo2.nix { }; +in +{ + home.packages = with pkgs; [ + htop + vim + wget + tree + git + rpi-imager + + element-desktop + protonmail-bridge + thunderbird + + mullvad-browser + + # open source (https://github.com/th-ch/youtube-music) + youtube-music + + #jetbrains.idea-ultimate + jetbrains-override-neo2.idea-ultimate + jetbrains-override-neo2.clion + + nur.repos.mic92.hello-nur + + joplin-desktop + signal-desktop + slack + + qbittorrent + vlc + + barrier # keyboard and mouse sharing + libreoffice + + speedtest-cli + + monero-gui + + kate + ]; +} diff --git a/home-manager/apps/neovim.nix b/home-manager/neovim.nix similarity index 100% rename from home-manager/apps/neovim.nix rename to home-manager/neovim.nix diff --git a/home-manager/modules/protonmail-bridge.nix b/home-manager/protonmail-bridge.nix similarity index 99% rename from home-manager/modules/protonmail-bridge.nix rename to home-manager/protonmail-bridge.nix index 8ea1ae1..40e7d6e 100644 --- a/home-manager/modules/protonmail-bridge.nix +++ b/home-manager/protonmail-bridge.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: with lib; + let cfg = config.services.protonmail-bridge; #Still need to integrate more closely with the email management capabilities of home-manager @@ -26,13 +27,11 @@ in default = "info"; description = "The log level"; }; - }; }; ##### implementation config = mkIf cfg.enable { - home.packages = [ pkgs.protonmail-bridge ]; systemd.user.services.protonmail-bridge = { diff --git a/nixos/audio.nix b/nixos/audio.nix new file mode 100644 index 0000000..316019d --- /dev/null +++ b/nixos/audio.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: + +{ + # 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; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; + + services.blueman.enable = true; + hardware.bluetooth.enable = true; + + environment.systemPackages = with pkgs; [ + pkgs.pavucontrol + ]; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index 04d540c..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,227 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, ... }: - - - -{ - - nix.settings.experimental-features = [ "nix-command flakes" ]; - imports = - [ - # Include the results of the hardware scan. - ./hardware-configuration-x13.nix - ./xfce.nix - ../home-manager/apps/firefox.nix - ./containers.nix - ]; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "nixos"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - services.fwupd.enable = true; - - - 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"; - }; - - # disable default gnome apps: - environment.gnome.excludePackages = (with pkgs; [ - gnome-photos - gnome-tour - ]) ++ (with pkgs.gnome; [ - cheese # webcam tool - gnome-music - # gnome-terminal - gedit # text editor - epiphany # web browser - geary # email reader - evince # document viewer - gnome-characters - totem # video player - tali # poker game - iagno # go game - hitori # sudoku game - atomix # puzzle game - ]); - - # Configure keymap in X11 - services.xserver = { - layout = "de"; - xkbVariant = "neo"; - }; - - # Configure console keymap - console.keyMap = "de"; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - security.sudo.extraConfig = '' - Defaults timestamp_timeout=30 - ''; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - - services.blueman.enable = true; - hardware.bluetooth.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.user = { - isNormalUser = true; - description = "user"; - extraGroups = [ "networkmanager" "wheel" "docker" "libvirtd" "jackaudio" ]; - packages = with pkgs; [ - kate - ]; - }; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - - environment.systemPackages = with pkgs; [ - virt-manager - pkgs.killall - pkgs.xbindkeys - pkgs.xdotool - pkgs.xorg.xmodmap - pkgs.xorg.xev - pkgs.libsForQt5.konsole - - pkgs.google-chrome - - pkgs.spice # copy-paste for vms - - # audio - pkgs.pavucontrol - - # dev - pkgs.rustc - pkgs.rustup - pkgs.cargo - pkgs.gcc - - - pkgs.python3 - pkgs.poetry - - pkgs.openssl - - - xorg.xhost - pkgs.tailscale - - - pkgs.tor-browser-bundle-bin - - # config.nur.repos.mic92.hello-nur - ]; - - - # 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; - # }; - - - # hotfix to enable update - nixpkgs.config.permittedInsecurePackages = [ - "electron-25.9.0" - ]; - - - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - services.openssh.enable = true; - - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ - 24800 # barrier keyboard / mouse sharing - ]; - networking.firewall.allowedUDPPorts = [ - 24800 # barrier keyboard / mouse sharing - - ]; - # Enable NAT - networking.firewall = { - # if packets are still dropped, they will show up in dmesg - logReversePathDrops = true; - # wireguard trips rpfilter up - extraCommands = '' - ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN - ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN - ''; - extraStopCommands = '' - ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true - ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true - ''; - }; - # Or disable the firewall altogether. - # 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? - - # enable docker - virtualisation.docker.enable = true; - - # kvm/libvirt etc - virtualisation.libvirtd.enable = true; - programs.dconf.enable = true; - - services.tailscale.enable = true; -} diff --git a/nixos/containers.nix b/nixos/containers.nix index adab87f..2a509aa 100644 --- a/nixos/containers.nix +++ b/nixos/containers.nix @@ -1,9 +1,14 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + virt-manager + spice # copy-paste for vms + ]; - # todo: - # protonvpn cli wrapped? - # intellij? as a app? - # ...? + # enable docker + virtualisation.docker.enable = true; + + # kvm/libvirt etc + virtualisation.libvirtd.enable = true; } diff --git a/nixos/default.nix b/nixos/default.nix new file mode 100644 index 0000000..efb148a --- /dev/null +++ b/nixos/default.nix @@ -0,0 +1,34 @@ +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration-x13.nix + + ./audio.nix + ./containers.nix + ./firefox.nix + ./locale.nix + ./misc.nix + ./networking.nix + ./users.nix + ./xfce.nix + ]; + + nix.settings.experimental-features = [ "nix-command flakes" ]; + + nixpkgs.config = { + allowUnfree = true; + + # hotfix to enable update + permittedInsecurePackages = [ + "electron-25.9.0" + ]; + }; + + # 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? +} diff --git a/nixos/firefox.nix b/nixos/firefox.nix new file mode 100644 index 0000000..941aadf --- /dev/null +++ b/nixos/firefox.nix @@ -0,0 +1,23 @@ +{ lib, ... }: + +let + mkAddOn = shortname: addonid: { + ${addonid} = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/${shortname}/latest.xpi"; + installation_mode = "force_installed"; + }; + }; +in +{ + programs.firefox = { + enable = true; + + policies = { + ExtensionSettings = lib.mkMerge [ + (mkAddOn "ublock-origin" "uBlock0@raymondhill.net") + (mkAddOn "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}") + (mkAddOn "i-dont-care-about-cookies" "jid1-KKzOGWgsW3Ao4Q@jetpack") + ]; + }; + }; +} diff --git a/nixos/locale.nix b/nixos/locale.nix new file mode 100644 index 0000000..33f705e --- /dev/null +++ b/nixos/locale.nix @@ -0,0 +1,28 @@ +{ + # Set your time zone. + 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"; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "de"; + xkbVariant = "neo"; + }; + + # Configure console keymap + console.keyMap = "de"; +} diff --git a/nixos/misc.nix b/nixos/misc.nix new file mode 100644 index 0000000..97ca8bb --- /dev/null +++ b/nixos/misc.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: + +{ + # Bootloader. + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + services.fwupd.enable = true; + + environment.systemPackages = with pkgs; [ + killall + xbindkeys + xdotool + xorg.xmodmap + xorg.xev + xorg.xhost + libsForQt5.konsole + + google-chrome + tor-browser-bundle-bin + + ## dev + + rustc + rustup + cargo + gcc + + python3 + poetry + + openssl + ]; + + programs.dconf.enable = true; +} diff --git a/nixos/networking.nix b/nixos/networking.nix new file mode 100644 index 0000000..0bba50f --- /dev/null +++ b/nixos/networking.nix @@ -0,0 +1,46 @@ +{ + networking = { + hostName = "nixos"; # Define your hostname. + #wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # proxy.default = "http://user:password@proxy:port/"; + # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networkmanager.enable = true; + + firewall = { + allowedTCPPorts = [ + 24800 # barrier keyboard / mouse sharing + ]; + allowedUDPPorts = [ + 24800 # barrier keyboard / mouse sharing + ]; + + # if packets are still dropped, they will show up in dmesg + logReversePathDrops = true; + + # wireguard trips rpfilter up + extraCommands = '' + ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN + ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN + ''; + extraStopCommands = '' + ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true + ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true + ''; + }; + }; + + services = { + # Enable CUPS to print documents. + printing.enable = true; + + # Enable the OpenSSH daemon. + openssh.enable = true; + + # VPN + tailscale.enable = true; + }; +} diff --git a/nixos/users.nix b/nixos/users.nix new file mode 100644 index 0000000..7f3c02b --- /dev/null +++ b/nixos/users.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: + +{ + security.sudo.extraConfig = '' + Defaults timestamp_timeout=30 + ''; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.user = { + isNormalUser = true; + description = "user"; + extraGroups = [ + "networkmanager" + "wheel" + "docker" + "libvirtd" + "jackaudio" + ]; + }; +} diff --git a/nixos/xfce.nix b/nixos/xfce.nix index e947dbc..dd501a7 100644 --- a/nixos/xfce.nix +++ b/nixos/xfce.nix @@ -1,10 +1,3 @@ -{ config, lib, pkgs, modulesPath, ... }: - -# reference: -# https://git.sr.ht/~wrmilling/nixos-configuration/tree/30f603e2954c07b743037cdb9f2b30bc073091cc/item/hosts/common/modules/i3wm.nix -let - mod = "Mod4"; -in { services.xserver = { enable = true; diff --git a/pkgs/jetbrains-override-neo2.nix b/pkgs/jetbrains-override-neo2.nix new file mode 100644 index 0000000..b2345b8 --- /dev/null +++ b/pkgs/jetbrains-override-neo2.nix @@ -0,0 +1,36 @@ +{ fetchurl, jetbrains }: + +let + neo2AwtHackJar = fetchurl { + url = "https://github.com/chenkelmann/neo2-awt-hack/blob/master/releases/neo2-awt-hack-0.5-java8oracle.jar?raw=true"; + sha256 = "sha256-/2OGd2Nl7tRqkB73LJjLXMlRwFHwOdX9cnXRk5BP3S8="; + name = "neo2-awt-hack-0.5.jar"; + }; + + overrideFn = pname: xname: oldAttrs: { + postInstall = oldAttrs.postInstall or "" + '' + cp ${neo2AwtHackJar} $out/${pname}/neo2-awt-hack-0.5.jar + + # 1. Extrahieren Sie die letzten zwei Zeilen in eine temporäre Datei. + tail -n 2 $out/${pname}/bin/.${xname}.sh-wrapped > temp_last_lines.txt + + # 2. Löschen Sie die letzten zwei Zeilen aus der ursprünglichen Datei. + sed -i 'N;$!P;$!D;$d' $out/${pname}/bin/.${xname}.sh-wrapped + + # 3. Fügen Sie den gewünschten String zur ursprünglichen Datei hinzu. + # echo "--patch-module=java.desktop=../neo2-awt-hack-0.5.jar \\" >> $out/${pname}/bin/.${xname}.sh-wrapped + echo "--patch-module=java.desktop=$out/${pname}/neo2-awt-hack-0.5.jar \\" >> $out/${pname}/bin/.${xname}.sh-wrapped + + # 4. Fügen Sie die ursprünglichen letzten zwei Zeilen wieder an die ursprüngliche Datei an. + cat temp_last_lines.txt >> $out/${pname}/bin/.${xname}.sh-wrapped + + # Aufräumen + rm temp_last_lines.txt + ''; + }; +in + +{ + idea-ultimate = jetbrains.idea-ultimate.overrideAttrs (overrideFn "idea-ultimate" "idea"); + clion = jetbrains.clion.overrideAttrs (overrideFn "clion" "clion"); +}