Skip to content

Commit

Permalink
Add default.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
krtab committed Oct 29, 2024
1 parent 23590e3 commit d844933
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ pkgs ? import <nixpkgs> {}, lib ? pkgs.lib }:

let
rustPlatform = pkgs.rustPlatform;

agnos = rustPlatform.buildRustPackage {
pname = "agnos";
version = "0.1.0";

src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [
./Cargo.lock
./Cargo.toml
./LICENSE.txt
./README.md
./resources/Banner-optimized.png
./resources/red-iron.png
./src
./systemd
]; };

cargoLock = {
lockFile = ./Cargo.lock;
};

nativeBuildInputs = [
pkgs.pkg-config
];

buildInputs = [
pkgs.openssl
];

buildPhase = ''
cargo build --release
'';

installPhase = ''
mkdir -p $out/bin
cp target/release/agnos $out/bin/
# Install systemd unit and timer
mkdir -p $out/lib/systemd/system
cp ${./systemd/agnos.service} $out/lib/systemd/system/
cp ${./systemd/agnos.timer} $out/lib/systemd/system/
'';

meta = with lib; {
description = "A Rust project with systemd unit and timer files";
license = licenses.mit;
maintainers = [ maintainers.krtab ];
};
};
in
agnos

0 comments on commit d844933

Please sign in to comment.