Skip to content

Commit

Permalink
nix: remove flake-utils dep & reorganize (#64)
Browse files Browse the repository at this point in the history
Thank you, LGTM
  • Loading branch information
toastal authored Sep 4, 2023
1 parent 48bcd09 commit 409afb0
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 70 deletions.
16 changes: 0 additions & 16 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 61 additions & 54 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,79 +1,86 @@
{
description = "Flake to manage projects + builds";
description = "steam-tui flake to manage projects + builds";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
outputs = { self, nixpkgs, ... }@inputs:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;

nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
config = {
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"steam"
"steamcmd"
"steam-original"
"steam-run"
];
};
in
rec {
devShells.default = with pkgs;
pkgs.mkShell {
packages = [
});
in
{
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
steam-tui = with pkgs;
rustPlatform.buildRustPackage rec {
name = "steam-tui-dev";
pname = "steam-tui";
src = ./.;
nativeBuildInputs = [
openssl
pkgconfig
];
buildInputs = [
steamcmd
];
# NOTE: Copied from pkgs.
preFixup = ''
mv $out/bin/steam-tui $out/bin/.steam-tui-unwrapped
cat > $out/bin/steam-tui <<EOF
#!${runtimeShell}
export PATH=${steamcmd}/bin:\$PATH
exec ${steam-run}/bin/steam-run $out/bin/.steam-tui-unwrapped '\$@'
EOF
chmod +x $out/bin/steam-tui
'';
checkFlags = [
"--skip=impure"
];
PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig";
cargoLock = {
lockFileContents = builtins.readFile ./Cargo.lock;
};
};

default = self.packages.${system}.steam-tui;
});

devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.packages.${system};
buildIpunts = with pkgs; [
# build
rustfmt
rustc
cargo
clippy
rustup

# deps
pkg-config
openssl

# steam
steam
steamcmd
steam-run

# misc
wine
proton-caller
python3
lutris
];
STEAM_RUN_WRAPPER = "${steam-run}/bin/steam-run";
};

steam-tui = with pkgs;
rustPlatform.buildRustPackage rec {
name = "steam-tui-dev";
pname = "steam-tui";
src = ./.;
nativeBuildInputs = [
openssl
pkgconfig
];
buildInputs = [
steamcmd
];
# NOTE: Copied from pkgs.
preFixup = ''
mv $out/bin/steam-tui $out/bin/.steam-tui-unwrapped
cat > $out/bin/steam-tui <<EOF
#!${runtimeShell}
export PATH=${steamcmd}/bin:\$PATH
exec ${steam-run}/bin/steam-run $out/bin/.steam-tui-unwrapped '\$@'
EOF
chmod +x $out/bin/steam-tui
'';
checkFlags = [
"--skip=impure"
];
PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig";
cargoLock = {
lockFileContents = builtins.readFile ./Cargo.lock;
};
STEAM_RUN_WRAPPER = "${pkgs.steam-run}/bin/steam-run";
};

packages.default = steam-tui;
});
});
};
}

0 comments on commit 409afb0

Please sign in to comment.