add flake.nix

This commit is contained in:
do butterflies cry? 2026-03-13 13:26:07 +10:00
parent 9aa022ee41
commit 87612df7b6
Signed by: cry
GPG key ID: F68745A836CA0412
2 changed files with 156 additions and 0 deletions

82
flake.lock generated Normal file
View file

@ -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
}

74
flake.nix Normal file
View file

@ -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)}";
};
}
);
};
}