From 17ff4d452aeba16e31d971e62bab38d64c325efe Mon Sep 17 00:00:00 2001 From: cnst Date: Sat, 13 Jul 2024 06:45:01 +0200 Subject: [PATCH] far out test --- flake.lock | 75 +++++++++++---- flake.nix | 7 ++ home/core/tui/shell/cnst.nix | 1 + home/extra/neovim/default.nix | 9 +- nixos/core/shell/_minimal.nix | 12 +++ nixos/core/shell/dev.nix | 167 ++++++++++++++++++++++++++++++++++ nixos/hosts/cnix/imports.nix | 19 +++- nixos/hosts/cnix/system.nix | 2 +- nixos/services/locate.nix | 3 +- 9 files changed, 263 insertions(+), 32 deletions(-) create mode 100644 nixos/core/shell/_minimal.nix create mode 100644 nixos/core/shell/dev.nix diff --git a/flake.lock b/flake.lock index eccbf15c..1cb375fc 100644 --- a/flake.lock +++ b/flake.lock @@ -37,6 +37,27 @@ "type": "github" } }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1720765732, + "narHash": "sha256-I1tpD/7KqcKaVVHSXQcLx6oxvdQEVHjCrcEqunsmBeg=", + "owner": "nix-community", + "repo": "fenix", + "rev": "e7aefd2e730c4d43adca53602a0446c29653fef8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "firefox-nightly": { "inputs": { "cachix": "cachix", @@ -48,11 +69,11 @@ ] }, "locked": { - "lastModified": 1720700945, - "narHash": "sha256-5X162qEyixlrXji9cUFjxxJAkIMunq2xTBQ5a1eR2gk=", + "lastModified": 1720790404, + "narHash": "sha256-9qe2eVsUAIZIf9aDa7PVui77cr1RW4CpZbWTwOdtXrI=", "owner": "nix-community", "repo": "flake-firefox-nightly", - "rev": "fc711e0d70732be3c98bc27e88250ec818eb45db", + "rev": "20773f6a9a6bb52444f5fe7495932740f840fe6d", "type": "github" }, "original": { @@ -316,11 +337,11 @@ }, "hardware": { "locked": { - "lastModified": 1720515935, - "narHash": "sha256-8b+fzR4W2hI5axwB+4nBwoA15awPKkck4ghhCt8v39M=", + "lastModified": 1720737798, + "narHash": "sha256-G/OtEAts7ZUvW5lrGMXSb8HqRp2Jr9I7reBuvCOL54w=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "a111ce6b537df12a39874aa9672caa87f8677eda", + "rev": "c5013aa7ce2c7ec90acee5d965d950c8348db751", "type": "github" }, "original": { @@ -358,11 +379,11 @@ ] }, "locked": { - "lastModified": 1720646128, - "narHash": "sha256-BivO5yIQukDlJL+1875Sqf3GuOPxZDdA48dYDi3PkL8=", + "lastModified": 1720734513, + "narHash": "sha256-neWQ8eNtLTd+YMesb7WjKl1SVCbDyCm46LUgP/g/hdo=", "owner": "nix-community", "repo": "home-manager", - "rev": "c085b984ff2808bf322f375b10fea5a415a9c43d", + "rev": "90ae324e2c56af10f20549ab72014804a3064c7f", "type": "github" }, "original": { @@ -443,11 +464,11 @@ ] }, "locked": { - "lastModified": 1720697493, - "narHash": "sha256-vFIYB95F9m4JJiYNzboO/6lHAgma7W9MWZt22Gf5F2M=", + "lastModified": 1720796317, + "narHash": "sha256-2B4PFl75fFjQkquRCPB5PYeY0bFqF/xvsLy014c+7W4=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "06c3c793a59f17571b2d8b630fadee5bffd6ce25", + "rev": "a07ca86e6922bc2a68ec4c801ab7e05e12397af0", "type": "github" }, "original": { @@ -459,11 +480,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1720651300, - "narHash": "sha256-Zn9VHit79RpdRGPfpGZgx0m3HDSAjmhnsAak7+875KM=", + "lastModified": 1720739431, + "narHash": "sha256-lEgZwuKL1eLsiFqoSiOZgq30jQCFTEYlreL79Txbxu4=", "owner": "neovim", "repo": "neovim", - "rev": "afbe7736a4966f22146d857f246eac01cd080773", + "rev": "a5de650f0eb93a848831f1ba631485437a82d57b", "type": "github" }, "original": { @@ -521,11 +542,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1720553833, - "narHash": "sha256-IXMiHQMtdShDXcBW95ctA+m5Oq2kLxnBt7WlMxvDQXA=", + "lastModified": 1720691131, + "narHash": "sha256-CWT+KN8aTPyMIx8P303gsVxUnkinIz0a/Cmasz1jyIM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "249fbde2a178a2ea2638b65b9ecebd531b338cf9", + "rev": "a046c1202e11b62cbede5385ba64908feb7bfac4", "type": "github" }, "original": { @@ -580,6 +601,7 @@ }, "root": { "inputs": { + "fenix": "fenix", "firefox-nightly": "firefox-nightly", "flake-utils": "flake-utils_2", "hardware": "hardware", @@ -591,6 +613,23 @@ "systems": "systems_3" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1720717809, + "narHash": "sha256-6I+fm+nTLF/iaj7ffiFGlSY7POmubwUaPA/Wq0Bm53M=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "ffbc5ad993d5cd2f3b8bcf9a511165470944ab91", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "rust-overlay": { "inputs": { "flake-utils": [ diff --git a/flake.nix b/flake.nix index 044781ec..0f2cc6d1 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,10 @@ url = "github:nix-community/flake-firefox-nightly"; inputs.nixpkgs.follows = "nixpkgs"; }; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, @@ -38,6 +42,7 @@ home-manager, systems, lanzaboote, + fenix, ... } @ inputs: let inherit (self) outputs; @@ -52,6 +57,8 @@ ); in { inherit lib; + packages.x86_64-linux.default = fenix.packages.x86_64-linux.minimal.toolchain; + devShells = forEachSystem (pkgs: import ./core/shell/dev.nix {inherit pkgs;}); formatter = forEachSystem (pkgs: pkgs.alejandra); nixosConfigurations = { diff --git a/home/core/tui/shell/cnst.nix b/home/core/tui/shell/cnst.nix index fd446422..303a9210 100644 --- a/home/core/tui/shell/cnst.nix +++ b/home/core/tui/shell/cnst.nix @@ -7,6 +7,7 @@ syntaxHighlighting.enable = true; shellAliases = { + nixdev = "nix develop ~/.nix-config -c $SHELL"; nixconfig = "cd /home/cnst/.nix-config/"; ll = "ls -l"; nixupdate = "nh os switch -v -H cnix"; diff --git a/home/extra/neovim/default.nix b/home/extra/neovim/default.nix index 93f2613b..d36b9847 100644 --- a/home/extra/neovim/default.nix +++ b/home/extra/neovim/default.nix @@ -9,15 +9,9 @@ with pkgs; let fzf git sqlite - tree-sitter ]; c = [ - clang - clang-tools - cmake - gcc - gnumake ]; gamedev = [ @@ -69,9 +63,9 @@ with pkgs; let ]; rust = [ - cargo rustfmt rust-analyzer + clippy ]; shell = [ @@ -95,7 +89,6 @@ with pkgs; let tools ++ c ++ gamedev ++ golang ++ lua ++ markup ++ nix ++ python ++ rust ++ shell ++ web; in { # for quick development - home.packages = rust; programs.neovim = { enable = true; diff --git a/nixos/core/shell/_minimal.nix b/nixos/core/shell/_minimal.nix new file mode 100644 index 00000000..9e2d7655 --- /dev/null +++ b/nixos/core/shell/_minimal.nix @@ -0,0 +1,12 @@ +{pkgs}: let + stdenvMinimal = pkgs.stdenvNoCC.override { + cc = null; + preHook = ""; + allowedRequisites = null; + initialPath = + pkgs.lib.filter (a: pkgs.lib.hasPrefix "coreutils" a.name) + pkgs.stdenvNoCC.initialPath; + extraNativeBuildInputs = []; + }; +in + pkgs.mkShell.override {stdenv = stdenvMinimal;} diff --git a/nixos/core/shell/dev.nix b/nixos/core/shell/dev.nix new file mode 100644 index 00000000..5c72a88a --- /dev/null +++ b/nixos/core/shell/dev.nix @@ -0,0 +1,167 @@ +{ + pkgs, + inputs, + ... +}: let + minimalMkShell = import ./_minimal.nix {inherit pkgs;}; + + # 16 is broken: https://github.com/NixOS/nixpkgs/issues/244609 + # llvmPackages = pkgs.llvmPackages_16; + llvmPackages = pkgs.llvmPackages_15; + + gstreamerPath = + "" + + ":" + + "${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0" + + ":" + + "${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0" + + ":" + + "${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0" + + ":" + + "${pkgs.gst_all_1.gst-plugins-ugly}/lib/gstreamer-1.0"; + + _rustBuildFenix = ( + inputs.fenix.packages.${pkgs.stdenv.hostPlatform.system}.latest.withComponents [ + "cargo" + "clippy" + "rust-src" + "rustc" + "rustfmt" + "rust-analyzer" + ] + ); + + _rustBuildOxalica = inputs.rust-overlay.packages.${pkgs.stdenv.hostPlatform.system}.rust.override { + extensions = [ + "rust-src" + "rust-analyzer" + "clippy" + ]; + }; + + # so far I can't tell a big difference... + _rustBuild = _rustBuildFenix; +in + # _rustBuild = _rustBuildFenix; + minimalMkShell { + name = "cnst-nixcfg-dev"; + hardeningDisable = ["fortify"]; + + shellHook = '' + exec nu + ''; + + LD_LIBRARY_PATH = "${pkgs.libglvnd}/lib"; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + RUST_BACKTRACE = 1; + GST_PLUGIN_SYSTEM_PATH = gstreamerPath; + + nativeBuildInputs = with pkgs; [ + _rustBuild + llvmPackages.lldb + + # inputs.nix-eval-jobs.outputs.packages.${pkgs.stdenv.hostPlatform.system}.default + + nix + + ## nix lsp + # rnix-lsp # pulls in old nix (CVE) + nil + nixd + + ## nix space usage / visualizers + nix-du + nix-tree + + # nix formatters + nixpkgs-fmt + alejandra + + ## nodejs + nodejs + yarn + + ## golang + go + go-outline + gotools + godef + gopls + + # generic build essentials + pkg-config + cmake + gnumake + nasm + perl + + # json tools + gron + + gst_all_1.gstreamer + + protobuf + + # not a good sign + dos2unix + ]; + + buildInputs = with pkgs; [ + llvmPackages.libclang + llvmPackages.libclang.lib + pipewire + freetype + ncurses + pcsclite + openssl + clang + libusb1 + gpgme + libgpg-error + libgit2 + git # passrs + dbus # passrs libsecret + nettle # pass-rust (sequoia->nettle-sys) + gst_all_1.gstreamer + libnice + pango + cairo + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-good + gst_all_1.gst-plugins-bad + gst_all_1.gst-plugins-ugly + gst_all_1.gst-libav + + crate2nix + + glslang + gtk3 + gtk4 + + atk # sirula + gdk-pixbuf # sirula + udev + mesa + libinput # Anodium + seatd # Anodium + xorg.libXcursor + xorg.libXrandr + xorg.libXi # Anodium + libxkbcommon + wayland + wayland-protocols # wezterm + fontconfig + libglvnd + opencv + ffmpeg + egl-wayland # wezterm + xorg.libX11 + xorg.libxcb + xorg.xcbutil # wezterm + xorg.xcbproto + xorg.xcbutil + xorg.xcbutilwm # wezterm + xorg.xcbutilkeysyms + xorg.xcbutilimage # wezterm + ]; + } diff --git a/nixos/hosts/cnix/imports.nix b/nixos/hosts/cnix/imports.nix index 700eea25..81ffe213 100644 --- a/nixos/hosts/cnix/imports.nix +++ b/nixos/hosts/cnix/imports.nix @@ -46,14 +46,10 @@ curl fzf gnome-disk-utility - hyprlang killall lazygit ntfs3g p7zip - python3 - python312Packages.httplib2 - python312Packages.oauth2 ripgrep stow tmux @@ -66,6 +62,21 @@ wlroots xdg-user-dirs xdg-utils + + # Dev + binutils + clang + clang-tools + cargo-edit + cargo-insta + cargo-nextest + gcc + gnumake + cmake + hyprlang + python3 + python312Packages.httplib2 + python312Packages.oauth2 ]; }; } diff --git a/nixos/hosts/cnix/system.nix b/nixos/hosts/cnix/system.nix index 249e24ff..2bf9ea68 100644 --- a/nixos/hosts/cnix/system.nix +++ b/nixos/hosts/cnix/system.nix @@ -24,7 +24,7 @@ }; }; nixpkgs = { - overlays = [ + overlays = with inputs; [ (_: prev: { python312 = prev.python312.override {packageOverrides = _: pysuper: {nose = pysuper.pynose;};}; }) diff --git a/nixos/services/locate.nix b/nixos/services/locate.nix index 143657db..494136ef 100644 --- a/nixos/services/locate.nix +++ b/nixos/services/locate.nix @@ -1,6 +1,7 @@ {pkgs, ...}: { services.locate = { enable = true; - locate = pkgs.plocate; + package = pkgs.plocate; + localuser = null; }; }