diff options
| author | andromeda <andromeda@lenovo> | 2026-05-06 19:37:56 +0200 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-05-06 19:37:56 +0200 |
| commit | e5aaed7169e7a9b1ae537763ee94ea01aa401852 (patch) | |
| tree | a386a051a9e18e31ae125ec9418410cbe5b64e4d /laptop | |
| parent | 6a6630647c79e80d7995eac21bc188b5a516d142 (diff) | |
neo layout
Diffstat (limited to 'laptop')
| -rw-r--r-- | laptop/configuration.nix | 247 | ||||
| -rw-r--r-- | laptop/home.nix | 145 | ||||
| -rw-r--r-- | laptop/home/sway_config | 79 | ||||
| -rw-r--r-- | laptop/patches/change-default-search-engine.patch | 22 |
4 files changed, 493 insertions, 0 deletions
diff --git a/laptop/configuration.nix b/laptop/configuration.nix new file mode 100644 index 0000000..6efd55a --- /dev/null +++ b/laptop/configuration.nix @@ -0,0 +1,247 @@ +{config, ...}: let + sources = import ../npins; + pkgs = import sources.nixpkgs {}; +in { + boot = { + initrd = { + availableKernelModules = ["xhci_pci" "nvme" "sdhci_pci"]; + systemd = { + services.impermanent-btrfs = { + description = "saves old root and makes new one"; + unitConfig.DefaultDependencies = false; + serviceConfig = { + Type = "oneshot"; + StandardOutput = "journal+console"; + StandardError = "journal+console"; + }; + requiredBy = [ + "initrd.target" + ]; + before = [ + "sysroot.mount" + ]; + requires = [ + "initrd-root-device.target" + ]; + after = [ + "initrd-root-device.target" + "local-fs-pre.target" + ]; + script = '' + mkdir /btrfs_tmp + mount ${config.fileSystems."/".device} /btrfs_tmp + if [[ -e /btrfs_tmp/root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:$M:%S") + mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" + fi + + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } + + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done + + btrfs subvolume create /btrfs_tmp/root + mkdir /btrfs_tmp/root/persist + mkdir /btrfs_tmp/root/etc + mount ${config.fileSystems."/persist".device} /btrfs_tmp/root/persist -o subvol=persist + cp /btrfs_tmp/root/persist/etc/ssh /btrfs_tmp/root/etc/ssh -r + umount /btrfs_tmp/root/persist + rm -r /btrfs_tmp/root/persist + umount /btrfs_tmp + ''; + }; + extraBin = { + "mkdir" = "${pkgs.coreutils}/bin/mkdir"; + "date" = "${pkgs.coreutils}/bin/date"; + "stat" = "${pkgs.coreutils}/bin/stat"; + "mv" = "${pkgs.coreutils}/bin/mv"; + "cp" = "${pkgs.coreutils}/bin/cp"; + "rm" = "${pkgs.coreutils}/bin/rm"; + "btrfs" = "${pkgs.btrfs-progs}/bin/btrfs"; + }; + }; + }; + kernelPackages = pkgs.linuxPackages_latest; + kernelModules = ["kvm-intel"]; + loader = { + efi.canTouchEfiVariables = true; + grub = { + device = "nodev"; + efiSupport = true; + enable = true; + extraEntries = '' + menuentry "Guix" { + search --set=drive1 --fs-uuid F425-55BA + chainloader ($drive1)//EFI/Guix/grubx64.efi + } + ''; + }; + }; + tmp.cleanOnBoot = true; + }; + documentation = { + dev.enable = true; + nixos.includeAllModules = true; + }; + environment.persistence."/persist" = { + directories = [ + "/etc/ly/custom-sessions" + "/etc/NetworkManager/system-connections" + "/etc/ssh" + "/gnu" + "/var/guix" + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + ]; + enable = true; + files = [ + "/etc/ly/save.txt" + "/etc/machine-id" + ]; + hideMounts = true; + users.andromeda = { + directories = [ + ".backups" + ".cache/guix" + ".config/guix" + ".gnupg" + #".local/share/AAAAXY" + ".local/share/Anki2" + #".local/share/chat.fluffy.fluffychat" + ".local/share/cinny" + ".local/share/in.cinny.app" + #".local/share/Mindustry" + ".local/share/zoxide" + ".ssh" + "conf" + "Downloads" + "pp" + ]; + files = [".bash_history"]; + }; + }; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/5455cfb4-0efd-4f55-b496-d2cab3f419b7"; + fsType = "btrfs"; + options = ["subvol=root"]; + }; + "/boot" = { + device = "/dev/disk/by-uuid/F425-55BA"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + "/nix" = { + device = "/dev/disk/by-uuid/0e586651-36f4-42b0-99b3-3f0704a894d6"; + fsType = "btrfs"; + }; + "/persist" = { + device = "/dev/disk/by-uuid/5455cfb4-0efd-4f55-b496-d2cab3f419b7"; + fsType = "btrfs"; + neededForBoot = true; + options = ["subvol=persist"]; + }; + }; + hardware = { + bluetooth = { + enable = true; + powerOnBoot = false; + }; + cpu.intel.updateMicrocode = true; + enableRedistributableFirmware = true; + }; + home-manager = { + backupFileExtension = "bak"; + useGlobalPkgs = true; + users.andromeda = import ./home.nix; + }; + i18n.defaultLocale = "de_DE.UTF-8"; + imports = [ + "${sources.Phoenix {inherit pkgs;}}/nix/module.nix" + "${sources.agenix {inherit pkgs;}}/modules/age.nix" + "${sources.impermanence {inherit pkgs;}}/nixos.nix" + "${sources.home-manager {inherit pkgs;}}/nixos" + ../secrets.nix + ]; + networking = { + domain = "nixos"; + hostName = "nixos"; + firewall.enable = true; + networkmanager.enable = true; + }; + nixpkgs = { + config.allowUnfree = false; + flake.source = sources.nixpkgs; + hostPlatform = "x86_64-linux"; + overlays = [ + ( + final: prev: { + phoenix = (final.callPackage "${sources.Phoenix {inherit pkgs;}}/nix/package.nix" {}).overrideAttrs { + patches = [./patches/change-default-search-engine.patch]; # default search to ddg html + }; + + withPhoenix = firefoxPackage: + firefoxPackage.override { + extraPoliciesFiles = ["${final.phoenix}/policies.json"]; + extraPrefsFiles = ["${final.phoenix}/phoenix.cfg"]; + }; + } + ) + ]; + }; + nix = { + settings = { + experimental-features = ["nix-command" "flakes"]; + substituters = ["https://cache.dataaturservice.se/spectrum/"]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "spectrum-os.org-2:foQk3r7t2VpRx92CaXb5ROyy/NBdRJQG2uX2XJMYZfU=" + ]; + trusted-users = ["@wheel"]; + }; + channel.enable = false; + }; + programs.sway.enable = true; + services = { + blueman.enable = true; + displayManager = { + enable = true; + ly.enable = true; + }; + guix.enable = true; + libinput.enable = true; + openssh.enable = true; + printing.enable = true; + xserver.xkb.layout = "de(neo)"; + }; + system.stateVersion = "26.05"; + time.timeZone = "Europe/Berlin"; + users = { + mutableUsers = false; + users.andromeda = { + isNormalUser = true; + hashedPasswordFile = builtins.toString config.age.secrets.andromeda-pw.path; + extraGroups = [ + "networkmanager" + "wheel" + "dialout" + ]; + }; + }; + zramSwap = { + enable = true; + priority = 100; + algorithm = "zstd"; + memoryPercent = 35; + }; +} diff --git a/laptop/home.nix b/laptop/home.nix new file mode 100644 index 0000000..0f98005 --- /dev/null +++ b/laptop/home.nix @@ -0,0 +1,145 @@ +{ + config, + pkgs, + ... +}: let + sources = import ../npins; +in { + home = { + file.".profile".enable = false; + homeDirectory = "/home/${config.home.username}"; + packages = [ + (pkgs.callPackage "${sources.agenix}/pkgs/agenix.nix" {}) + pkgs.anki + pkgs.mindustry-wayland + pkgs.nix-output-monitor + pkgs.npins + ]; + stateVersion = "26.05"; + username = "andromeda"; + }; + imports = [(import sources.nvf).homeManagerModules.nvf]; + programs = { + firefox = { + enable = true; + package = pkgs.firefox.override { + cfg.enableTridactylNative = true; + }; + profiles.default = { + extensions = { + force = true; + packages = [(import sources.NUR {inherit pkgs;}).repos.rycee.firefox-addons.tridactyl]; + }; + settings = { + "extensions.autoDisableScopes" = 0; + "intl.accepted_languages" = "de_DE"; + }; + }; + }; + gpg.enable = true; + home-manager.enable = true; + nvf = { + enable = true; + settings.vim = { + startPlugins = [pkgs.vimPlugins.parinfer-rust]; + autocomplete.nvim-cmp.enable = false; + formatter.conform-nvim = { + enable = true; + setupOpts.format_on_save = { + lsp_format = "fallback"; + timeout_ms = 5000; + }; + }; + lsp.otter-nvim.enable = true; + git.enable = true; + keymaps = [ + { + key = "<Down>"; + mode = ["i" "n" "v" "c"]; + action = "<NOP>"; + } + { + key = "<Up>"; + mode = ["i" "n" "v" "c"]; + action = "<NOP>"; + } + { + key = "<Left>"; + mode = ["i" "n" "v" "c"]; + action = "<NOP>"; + } + { + key = "<Right>"; + mode = ["i" "n" "v" "c"]; + action = "<NOP>"; + } + { + key = "jj"; + mode = ["i"]; + action = "<Esc>"; + } + { + key = "kk"; + mode = ["i"]; + action = "<Esc>"; + } + { + key = "jk"; + mode = ["i"]; + action = "<Esc>"; + } + { + key = "kj"; + mode = ["i"]; + action = "<Esc>"; + } + { + key = "<Esc>"; + mode = ["i"]; + action = "<Nop>"; + } + ]; + languages = { + nix = { + enable = true; + format.enable = true; + lsp.enable = true; + }; + haskell = { + enable = true; + lsp.enable = true; + }; + rust = { + enable = true; + format.enable = true; + lsp.enable = true; + treesitter.enable = true; + }; + }; + lineNumberMode = "relative"; + options = { + tabstop = 2; + shiftwidth = 2; + expandtab = true; + smarttab = true; + foldmethod = "indent"; + number = true; + colorcolumn = "80"; + }; + statusline.lualine.enable = true; + syntaxHighlighting = true; + }; + }; + ssh.enable = true; + }; + services.gpg-agent = { + enable = true; + pinentry.package = pkgs.pinentry-curses; + }; + xdg = { + portal = { + enable = true; + extraPortals = [pkgs.xdg-desktop-portal-shana]; + }; + }; +} diff --git a/laptop/home/sway_config b/laptop/home/sway_config new file mode 100644 index 0000000..af46e4e --- /dev/null +++ b/laptop/home/sway_config @@ -0,0 +1,79 @@ +set $mod Mod4 +set $left h +set $down j +set $up k +set $right l +set $term alacritty +set $menu wmenu-run +set $screenshot grim -g "$(slurp)" +floating_modifier $mod normal + +workspace_layout stacking +output * bg @backgroundImagePath@ fill + +bindsym $mod+Shift+Return exec $term +bindsym $mod+Shift+d exec $menu +bindsym $mod+Shift+a exec anki +bindsym $mod+Shift+q exec firefox +bindsym $mod+Shift+s exec $screenshot + +bindsym $mod+Shift+c kill + +bindsym $mod+Shift+r reload + +bindsym $mod+Shift+Alt+q exit + +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right + +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right move right + +bindsym $mod+1 workspace number 1 +bindsym $mod+2 workspace number 2 +bindsym $mod+3 workspace number 3 +bindsym $mod+4 workspace number 4 +bindsym $mod+5 workspace number 5 +bindsym $mod+6 workspace number 6 +bindsym $mod+7 workspace number 7 +bindsym $mod+8 workspace number 8 +bindsym $mod+9 workspace number 9 +bindsym $mod+0 workspace number 0 + +bindsym $mod+Shift+1 move container to workspace number 1 +bindsym $mod+Shift+2 move container to workspace number 2 +bindsym $mod+Shift+3 move container to workspace number 3 +bindsym $mod+Shift+4 move container to workspace number 4 +bindsym $mod+Shift+5 move container to workspace number 5 +bindsym $mod+Shift+6 move container to workspace number 6 +bindsym $mod+Shift+7 move container to workspace number 7 +bindsym $mod+Shift+8 move container to workspace number 8 +bindsym $mod+Shift+9 move container to workspace number 9 +bindsym $mod+Shift+0 move container to workspace number 0 + +seat * hide_cursor 100 +input type:touchpad events disabled + +bindsym $mod+r exec 'swaymsg "seat * hide_cursor 100"; swaymsg "input type:touchpad events disabled"' +bindsym $mod+t exec 'swaymsg "seat * hide_cursor 0"; swaymsg "input type:touchpad events enabled"' + +bindsym $mod+f fullscreen +bindsym $mod+Shift+space floating toggle +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle +bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5% +bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5% +bindsym --locked XF86AudioMicMute exec pact set-source-mute \@DEFAULT_SOURCE@ toggle +bindsym --locked XF86MonBrightnessDown exec brightnessctl set 2%- +bindsym --locked XF86MonbrightnessUp exec brightnessctl set 2%+ + +default_border none +font pango:monospace 0.001 +titlebar_border_thickness 0 +titlebar_padding 0 diff --git a/laptop/patches/change-default-search-engine.patch b/laptop/patches/change-default-search-engine.patch new file mode 100644 index 0000000..eea0845 --- /dev/null +++ b/laptop/patches/change-default-search-engine.patch @@ -0,0 +1,22 @@ +diff --git a/build-resources/policies/phoenix-desktop.json b/build-resources/policies/phoenix-desktop.json +index 48efbe39..b5d2fe95 100644 +--- a/build-resources/policies/phoenix-desktop.json ++++ b/build-resources/policies/phoenix-desktop.json +@@ -102,8 +102,8 @@ + "URLTemplate": "https://eu.startpage.com/sp/search" + } + ], +- "Default": "DuckDuckGo", +- "DefaultPrivate": "DuckDuckGo", ++ "Default": "DuckDuckGo (HTML)", ++ "DefaultPrivate": "DuckDuckGo (HTML)", + "PreventInstalls": false, + "Remove": [ + "1&1 Suche", +@@ -170,4 +170,4 @@ + ] + } + } +-} +\ No newline at end of file ++} |
