mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
add a flake.nix file for the development environment, add direnv-related files to .gitignore
This commit is contained in:
parent
ee0d178f8c
commit
3f53522241
3 changed files with 133 additions and 0 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -15,3 +15,6 @@ lib*.a
|
||||||
*.iml
|
*.iml
|
||||||
### macOS ###
|
### macOS ###
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
### direnv ###
|
||||||
|
/.direnv/
|
||||||
|
|
60
flake.lock
generated
Normal file
60
flake.lock
generated
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720633750,
|
||||||
|
"narHash": "sha256-N8apMO2pP/upWeH+JY5eM8VDp2qBAAzE+OY5LRW6qpw=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "54bc082f5a7219d122e74fe52c021cf59fed9d6f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
}
|
70
flake.nix
Normal file
70
flake.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
libselinuxPath = with pkgs;
|
||||||
|
lib.makeLibraryPath [
|
||||||
|
libselinux
|
||||||
|
];
|
||||||
|
libaclPath = with pkgs;
|
||||||
|
lib.makeLibraryPath [
|
||||||
|
acl
|
||||||
|
];
|
||||||
|
|
||||||
|
build_deps = with pkgs; [
|
||||||
|
clang
|
||||||
|
llvmPackages.bintools
|
||||||
|
rustup
|
||||||
|
|
||||||
|
pre-commit
|
||||||
|
|
||||||
|
# debugging
|
||||||
|
gdb
|
||||||
|
];
|
||||||
|
gnu_testing_deps = with pkgs; [
|
||||||
|
autoconf
|
||||||
|
automake
|
||||||
|
bison
|
||||||
|
gnum4
|
||||||
|
gperf
|
||||||
|
gettext
|
||||||
|
texinfo
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
buildInputs = build_deps ++ gnu_testing_deps;
|
||||||
|
|
||||||
|
RUSTC_VERSION = "1.75";
|
||||||
|
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_latest.libclang.lib];
|
||||||
|
shellHook = ''
|
||||||
|
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
|
||||||
|
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
|
||||||
|
'';
|
||||||
|
|
||||||
|
SELINUX_INCLUDE_DIR = ''${pkgs.libselinux.dev}/include'';
|
||||||
|
SELINUX_LIB_DIR = libselinuxPath;
|
||||||
|
SELINUX_STATIC = "0";
|
||||||
|
|
||||||
|
# Necessary to build GNU.
|
||||||
|
LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}'';
|
||||||
|
|
||||||
|
# Add precompiled library to rustc search path
|
||||||
|
RUSTFLAGS =
|
||||||
|
(builtins.map (a: ''-L ${a}/lib'') [
|
||||||
|
])
|
||||||
|
++ [
|
||||||
|
''-L ${libselinuxPath}''
|
||||||
|
''-L ${libaclPath}''
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue