diff --git a/configuration.nix b/configuration.nix index dab15d9..c65d8bc 100644 --- a/configuration.nix +++ b/configuration.nix @@ -89,18 +89,6 @@ extraOptions = "!include ${config.age.secrets."github/token.ro.age".path}"; }; - boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = false; - }; - kernelPackages = pkgs.linuxPackages_latest; - extraModulePackages = with config.boot.kernelPackages; [ - v4l2loopback - # amneziawg - ]; - }; - networking = { hostName = "testenv"; nameservers = [ "10.20.0.1" ]; @@ -204,16 +192,13 @@ xdotool tree hyperfine - unrar - unzip - xarchiver nmap ]; }; programs = { gnome-terminal.enable = true; - thunar.enable = true; # TODO: replace + # thunar.enable = true; # TODO: replace winbox = { enable = true; package = pkgs.winbox4; diff --git a/custom/modules/default.nix b/custom/modules/default.nix new file mode 100644 index 0000000..1c2f431 --- /dev/null +++ b/custom/modules/default.nix @@ -0,0 +1,13 @@ +{ + pkgs, + lib, + kernel-src, + ... +}: + +let + linuxMainline = import ./kernel.nix { inherit pkgs lib kernel-src; }; +in +{ + boot.kernelPackages = pkgs.linuxPackagesFor linuxMainline; +} diff --git a/custom/modules/kernel.nix b/custom/modules/kernel.nix new file mode 100644 index 0000000..18fc764 --- /dev/null +++ b/custom/modules/kernel.nix @@ -0,0 +1,88 @@ +{ + pkgs, + lib, + kernel-src, + structuredExtraConfig ? { }, + kernelPatches ? [ ], + extraConfig ? "", +}: + +let + makefile = builtins.readFile "${kernel-src}/Makefile"; + lines = lib.splitString "\n" makefile; + + get = + name: + let + line = lib.findFirst ( + l: lib.hasPrefix "${name} =" (lib.strings.trim l) + ) (throw "Makefile missing ${name}") lines; + in + lib.strings.trim (lib.removePrefix "${name} =" (lib.strings.trim line)); + + V = get "VERSION"; + P = get "PATCHLEVEL"; + S = get "SUBLEVEL"; + E = get "EXTRAVERSION"; + + kver = "${V}.${P}.${S}${E}"; +in +pkgs.callPackage ( + { buildLinux, ... }@args: + let + llvm = pkgs.llvmPackages_latest; + clang = "${llvm.clang}/bin/clang"; + clangpp = "${llvm.clang}/bin/clang++"; + lld = "${llvm.lld}/bin/ld.lld"; + llvmbin = "${llvm.llvm}/bin"; + + structuredExtraConfig' = + (with lib.kernel; { + # LTO_CLANG_THIN = yes; # i should find the correct one + # LTO_CLANG_FULL = no; + # LTO_NONE = no; + }) + // structuredExtraConfig; + in + buildLinux ( + args + // { + inherit kernelPatches extraConfig; + + version = kver; + modDirVersion = kver; + src = kernel-src; + + nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ + llvm.clang + llvm.lld + llvm.llvm + ]; + + makeFlags = (args.makeFlags or [ ]) ++ [ + "LLVM=1" + "LLVM_IAS=1" + + # needed due to build script retardation + "CC=${clang}" + "HOSTCC=${clang}" + "HOSTCXX=${clangpp}" + "LD=${lld}" + "HOSTLD=${lld}" + + "AR=${llvmbin}/llvm-ar" + "NM=${llvmbin}/llvm-nm" + "STRIP=${llvmbin}/llvm-strip" + "OBJCOPY=${llvmbin}/llvm-objcopy" + "OBJDUMP=${llvmbin}/llvm-objdump" + "READELF=${llvmbin}/llvm-readelf" + ]; + + structuredExtraConfig = structuredExtraConfig'; + + ignoreConfigErrors = true; + + extraMeta.branch = "${V}.${P}"; + } + ) +) { } diff --git a/custom/override.nix b/custom/override.nix index 49fbd95..d86ab82 100644 --- a/custom/override.nix +++ b/custom/override.nix @@ -1,11 +1,11 @@ final: prev: { llama-cpp = prev.llama-cpp.overrideAttrs (old: rec { - version = "8018"; + version = "8124"; src = prev.fetchFromGitHub { owner = "ggml-org"; repo = "llama.cpp"; tag = "b${version}"; - hash = "sha256-V60fAIZHVse3mD4Q7LodL2UxspdZorDDsSqlB/lMyGE="; + hash = old.src.hash; }; # nativeBuildInputs = old.nativeBuildInputs ++ [ prev.pkgs.curl ]; }); diff --git a/devenv.nix b/devenv.nix index 561165f..957a409 100644 --- a/devenv.nix +++ b/devenv.nix @@ -17,7 +17,7 @@ nix flake check ''; build.exec = '' - nixos-rebuild switch --sudo --flake '.#' + nixos-rebuild switch --sudo --flake '.#' $@ ''; }; diff --git a/flake.lock b/flake.lock index c10dab8..e156fea 100644 --- a/flake.lock +++ b/flake.lock @@ -395,11 +395,11 @@ ] }, "locked": { - "lastModified": 1772218752, - "narHash": "sha256-G8nArvOTZXU8DRvrzAdz3Elcj6kA/vMtvY9mrGLATtA=", + "lastModified": 1772569491, + "narHash": "sha256-bdr6ueeXO1Xg91sFkuvaysYF0mVdwHBpdyhTjBEWv+s=", "owner": "nix-community", "repo": "home-manager", - "rev": "f3a30376bb9eb2f6f61816be7d6ed954b6d2a3b9", + "rev": "924e61f5c2aeab38504028078d7091077744ab17", "type": "github" }, "original": { @@ -481,6 +481,24 @@ "type": "github" } }, + "kernel-src": { + "flake": false, + "locked": { + "lastModified": 1772558248, + "narHash": "sha256-xv9+ldZjWEMJZVPTi5w7O4SDOI0lz5NcWvjgQGE1HCg=", + "ref": "drm-tip", + "rev": "cfc20c776480fda8c1b0517b187bb71ec0781cd4", + "shallow": true, + "type": "git", + "url": "https://gitlab.freedesktop.org/drm/tip.git" + }, + "original": { + "ref": "drm-tip", + "shallow": true, + "type": "git", + "url": "https://gitlab.freedesktop.org/drm/tip.git" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -537,11 +555,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1772211154, - "narHash": "sha256-BdXKcWd1LE+APzyaJ/xszDXcA5KKPenjNyC5VOd3x4E=", + "lastModified": 1772572827, + "narHash": "sha256-d91kXM4t1G0KQ/MB0LTP514IslsDu6ZBt4HQE7hVvzs=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "599b3f8d4215470dd50066119c81007b2670b6e1", + "rev": "7592181859ad2ab12913bbede47b45481b2b2938", "type": "github" }, "original": { @@ -583,6 +601,22 @@ "type": "github" } }, + "nix-flatpak": { + "locked": { + "lastModified": 1767983141, + "narHash": "sha256-7ZCulYUD9RmJIDULTRkGLSW1faMpDlPKcbWJLYHoXcs=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "440818969ac2cbd77bfe025e884d0aa528991374", + "type": "github" + }, + "original": { + "owner": "gmodena", + "ref": "latest", + "repo": "nix-flatpak", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -590,11 +624,11 @@ ] }, "locked": { - "lastModified": 1771734689, - "narHash": "sha256-/phvMgr1yutyAMjKnZlxkVplzxHiz60i4rc+gKzpwhg=", + "lastModified": 1772341813, + "narHash": "sha256-/PQ0ubBCMj/MVCWEI/XMStn55a8dIKsvztj4ZVLvUrQ=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "8f590b832326ab9699444f3a48240595954a4b10", + "rev": "a2051ff239ce2e8a0148fa7a152903d9a78e854f", "type": "github" }, "original": { @@ -636,11 +670,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1772047000, - "narHash": "sha256-7DaQVv4R97cii/Qdfy4tmDZMB2xxtyIvNGSwXBBhSmo=", + "lastModified": 1772465433, + "narHash": "sha256-ywy9troNEfpgh0Ee+zaV1UTgU8kYBVKtvPSxh6clYGU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1267bb4920d0fc06ea916734c11b0bf004bbe17e", + "rev": "c581273b8d5bdf1c6ce7e0a54da9841e6a763913", "type": "github" }, "original": { @@ -681,11 +715,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1771848320, - "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", + "lastModified": 1772542754, + "narHash": "sha256-WGV2hy+VIeQsYXpsLjdr4GvHv5eECMISX1zKLTedhdg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2fc6539b481e1d2569f25f8799236694180c0993", + "rev": "8c809a146a140c5c8806f13399592dbcb1bb5dc4", "type": "github" }, "original": { @@ -809,8 +843,10 @@ "dw-proton": "dw-proton", "home-manager": "home-manager", "intel-hw": "intel-hw", + "kernel-src": "kernel-src", "mypkgs": "mypkgs", "niri-flake": "niri-flake", + "nix-flatpak": "nix-flatpak", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_4", "ragenix": "ragenix" @@ -1128,11 +1164,11 @@ "xwayland-satellite-unstable": { "flake": false, "locked": { - "lastModified": 1771787042, - "narHash": "sha256-7bM6Y4KldhKnfopSALF8XALxcX7ehkomXH9sPl4MXp0=", + "lastModified": 1772429643, + "narHash": "sha256-M+bAeCCcjBnVk6w/4dIVvXvpJwOKnXjwi/lDbaN6Yws=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "33c344fee50504089a447a8fef5878cf4f6215fc", + "rev": "10f985b84cdbcc3bbf35b3e7e43d1b2a84fa9ce2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 30309d9..1f79ae5 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,12 @@ }; dw-proton.url = "github:imaviso/dwproton-flake"; intel-hw.url = "github:MordragT/nixos"; - # + nix-flatpak.url = "github:gmodena/nix-flatpak/latest"; + kernel-src = { + # url = "git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git?ref=master"; + url = "git+https://gitlab.freedesktop.org/drm/tip.git?shallow=1&ref=drm-tip"; + flake = false; + }; }; outputs = inputs@{ @@ -31,6 +36,8 @@ nix-index-database, niri-flake, intel-hw, + nix-flatpak, + kernel-src, ... }: let @@ -40,15 +47,21 @@ { nixosConfigurations.testenv = nixpkgs.lib.nixosSystem { inherit system; - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + kernel-src = inputs.kernel-src; + }; modules = [ + ./custom/modules ragenix.nixosModules.default niri-flake.nixosModules.niri nix-index-database.nixosModules.default + nix-flatpak.nixosModules.nix-flatpak ( { pkgs, pkgdefault, + config, ... }: { @@ -61,13 +74,6 @@ (import ./custom/override.nix) niri-flake.overlays.niri ]; - # boot.kernelPatches = [ - # { - # name = "name"; - # patch = null; - # extraConfig = ""; - # } - # ]; hardware = { graphics = { @@ -98,6 +104,27 @@ ]; download-buffer-size = 160000000; }; + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = false; + }; + # kernelPackages = pkgs.linuxPackages_testing; + extraModulePackages = with config.boot.kernelPackages; [ + v4l2loopback + # amneziawg + ]; + # kernelPatches = [ + # { + # name = "7.0-rc fixup"; + # extraConfig = '' + # ''; + # } + # ]; + }; + # nixpkgs.config.permittedInsecurePackages = [ + # "olm-3.2.16" + # ]; age = { secrets = { # "wg/syscon0.key".file = ./secrets/wg/syscon0.key.age; @@ -207,6 +234,7 @@ enable = true; defaultSession = "niri"; }; + flatpak.enable = true; locate.enable = true; pipewire = { enable = true; diff --git a/home.nix b/home.nix index 6a516e8..f6f6d2f 100644 --- a/home.nix +++ b/home.nix @@ -8,6 +8,7 @@ { imports = [ ./custom/hm + inputs.nix-flatpak.homeManagerModules.nix-flatpak ]; gtk = { @@ -52,11 +53,16 @@ arch-install-scripts kdocker # tray the untrayable xwayland-satellite - xdg-desktop-portal-gtk - xdg-desktop-portal-wlr winboat xfce4-taskmanager + ### file management + cosmic-files + lxqt.lxqt-archiver + unrar + unzip + p7zip + ### development # idea-community-bin @@ -70,7 +76,6 @@ lmstudio - ### social # fluffychat @@ -149,7 +154,18 @@ "image/png" = "swayimg.desktop"; "image/webp" = "swayimg.desktop"; - "application/zip" = "xarchiver.desktop"; + "application/zip" = "lxqt-archiver.desktop"; + }; + }; + portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + xdg-desktop-portal-wlr + xdg-desktop-portal-gnome + ]; + config = { + common.default = "*"; }; }; configFile."obsidian/.keep".text = ""; @@ -187,6 +203,11 @@ }; }; services = { + flatpak = { + packages = [ + "org.vinegarhq.Sober" + ]; + }; mako.enable = true; ollama = { # enable = true; @@ -199,6 +220,7 @@ OLLAMA_KV_CACHE_TYPE = "q8_0"; # OLLAMA_CONTEXT_LENGTH = "16000"; OLLAMA_MODELS = "/home/thek0tyara/Downloads/llm/ollama"; + XDG_DATA_DIRS = "empty"; }; }; podman = { @@ -550,7 +572,11 @@ "--always-new-process" ]; "Mod+R".action.spawn = "fuzzel"; - "Mod+Shift+L".action.spawn = "swaylock --color 030303"; + "Mod+Shift+L".action.spawn = [ + "swaylock" + "--color" + "030303" + ]; "Scroll_Lock" = { # toggle microphone @@ -804,7 +830,7 @@ # ''; }; zed-editor = { - enable = true; + # enable = true; themes = { "name" = "Ayu Dark"; };