better flake?

This commit is contained in:
Aaron Honeycutt 2025-04-17 12:49:52 -06:00
parent f134004ddb
commit fb3e99f8e4
3 changed files with 128 additions and 49 deletions

6
.gitignore vendored
View file

@ -1,8 +1,14 @@
# Rust/Carge
/target /target
# Nix
result
# Main nix files # Main nix files
flake.nix flake.nix
configuration.nix configuration.nix
home.nix home.nix
# Extra nix files # Extra nix files
garrus.nix garrus.nix
gnome.nix gnome.nix

96
flake.lock generated Normal file
View file

@ -0,0 +1,96 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1743800763,
"narHash": "sha256-YFKV+fxEpMgP5VsUcM6Il28lI0NlpM7+oB1XxbBAYCw=",
"owner": "nix-community",
"repo": "naersk",
"rev": "ed0232117731a4c19d3ee93aa0c382a8fe754b01",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": "nixpkgs_2"
}
},
"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
}

View file

@ -1,58 +1,35 @@
{ {
description = "Nyxi Installer flake"; description = "Flake to build and develop Nyxi";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11"; flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
}; };
outputs = { nixpkgs, ... } @ inputs: outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) {
inherit system;
};
let naersk' = pkgs.callPackage naersk {};
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
in
{
checks.x86_64-linux.unitTests = (with pkgs; stdenv.mkDerivation {
pname = "nyxi-installer";
version = "2.0.0";
src = builtins.fetchGit {
url = "https://gitlab.com/ahoneybun/nyxi-installer.git";
ref = "rust-rewrite";
rev = "a0c8dafe6186de0c6eebc68d413d08bccd4e2405";
};
buildInputs = with pkgs; [ cargo rustc ]; in rec {
# For `nix build` & `nix run`:
defaultPackage = naersk'.buildPackage {
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
CLANG_PATH = "${pkgs.llvmPackages.clang}/bin/clang";
buildInputs = with pkgs; [ pkg-config openssl ];
nativeBuildInputs = with pkgs; [ util-linux.dev ];
src = ./.;
};
buildPhase = '' # For `nix develop` (optional, can be skipped):
cargo test devShell = pkgs.mkShell {
''; nativeBuildInputs = with pkgs; [ rustc cargo ];
};
}); }
);
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = with pkgs; [
cargo
rustc
gnumake
clang
llvmPackages.libclang
llvmPackages.clang
# System
btrfs-progs
e2fsprogs
openssl
pkg-config
util-linux
];
shellHook = ''
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"
export CLANG_PATH="${pkgs.llvmPackages.clang}/bin/clang"
export RUST_BACKTRACE=1
echo "Ready to make some Rust!"
'';
};
};
} }