Compare commits

...

4 commits
v1 ... main

Author SHA1 Message Date
Dmitry Voronin b6be777855 Readme : Update URL. 2024-02-08 02:06:12 +03:00
Dmitry Voronin a39257e8fd Readme : Add info on how to build and integrate. 2024-02-08 01:43:55 +03:00
Dmitry Voronin b2dbb6ff9e Use src = self. 2024-02-08 01:25:47 +03:00
Dmitry Voronin 894a69222c upd 2024-02-08 01:16:00 +03:00
3 changed files with 63 additions and 9 deletions

25
Readme.md Normal file
View file

@ -0,0 +1,25 @@
# NixOS Sample package.
## How to build.
```text
nix build
```
## How to integrate into the system (flakes).
```nix
{
inputs = {
sampleapp.url = "git+https://git.voronind.com/voronind/template_nixos_package.git";
};
}
```
```nix
{
environment.systemPackages = with pkgs; [
inputs.sampleapp.packages.${pkgs.system}.default
];
}
```

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1707092692,
"narHash": "sha256-ZbHsm+mGk/izkWtT4xwwqz38fdlwu7nUUKXTOmm4SyE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "faf912b086576fd1a15fca610166c98d47bc667e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -5,23 +5,25 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, stdenv } @inputs:
outputs = { self, nixpkgs } @inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
lib = nixpkgs.lib;
in {
packages.${system}.default = {
packages.${system}.default = pkgs.stdenv.mkDerivation rec {
pname = "Sample Package";
version = "1.0";
# Fetch sources.
src = fetchGit {
url = "https://git.voronind.com/voronind/nixos_sample_package.git";
};
src = inputs.self;
# src = pkgs.fetchurl {
# url = "https://git.voronind.com/voronind/nixos_sample_package/archive/v1.tar.gz";
# hash = "sha256-zAXcCiRqOgMBChqabFjCmAaux1Yb9N+Y5jcE22zT3OI=";
# };
# Bins go here.
nativeBuildInputs = [
nativeBuildInputs = with pkgs; [
cargo
rustc
];
@ -36,8 +38,8 @@
'';
installPhase = ''
mkdir -p ${out}/bin
cp target/release/nixos_sample_package ${out}/bin
mkdir -p $out/bin
cp target/release/nixos_sample_package $out/bin
'';
};
};