From 87612df7b69dd40a35687f94206a851e13589812 Mon Sep 17 00:00:00 2001 From: _cry64 Date: Fri, 13 Mar 2026 13:26:07 +1000 Subject: [PATCH] add flake.nix --- flake.lock | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..de5e452 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1773299640, + "narHash": "sha256-kTsZ5xGZqaeJ8jWsfZNACo/VsW3riVuIQEPWVGiqWKM=", + "owner": "nix-community", + "repo": "fenix", + "rev": "8ac78ff968869cd05d9cb42fbf63bdbc6851ec19", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1773222311, + "narHash": "sha256-BHoB/XpbqoZkVYZCfXJXfkR+GXFqwb/4zbWnOr2cRcU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0590cd39f728e129122770c029970378a79d076a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1773194001, + "narHash": "sha256-50PPXBtH2xfKuNfQfUNOyuIFgZPEz5QVertQWS2MQJE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "8ed3cca4d30610fd0d3c1179c85418de2dc0a7c1", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..69f8747 --- /dev/null +++ b/flake.nix @@ -0,0 +1,74 @@ +{ + description = "Wire on your TTYs just feels better!"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + systems.url = "github:nix-systems/default"; + + fenix.url = "github:nix-community/fenix"; + fenix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { + self, + nixpkgs, + ... + } @ inputs: let + systems = import inputs.systems; + + mkPkgs = system: repo: + import repo { + inherit system; + allowUnfree = false; + allowBroken = false; + overlays = builtins.attrValues self.overlays or {}; + }; + + forAllSystems = f: + nixpkgs.lib.genAttrs systems (system: + f rec { + inherit system; + inherit (pkgs) lib; + pkgs = mkPkgs system nixpkgs; + }); + in { + overlays.default = self: super: { + libclang = super.llvmPackages_21.libclang; + }; + + devShells = forAllSystems ( + { + system, + pkgs, + lib, + ... + }: { + default = pkgs.mkShell rec { + shell = "${pkgs.bash}/bin/bash"; + strictDeps = true; + + packages = with pkgs; [ + cargo + rustc + inputs.fenix.packages.${system}.complete.rustfmt + ]; + + # packages we should be able to link against + buildInputs = with pkgs; [ + # pipewire.dev + # libxkbcommon + # wayland + ]; + + # packages we run at build time / shellHook + nativeBuildInputs = with pkgs; [ + pkg-config + rustPlatform.bindgenHook + ]; + + LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${builtins.toString (lib.makeLibraryPath buildInputs)}"; + }; + } + ); + }; +}