Adding more flakes samples
This commit is contained in:
parent
c56d09816f
commit
8fc071397a
@ -10,6 +10,10 @@
|
||||
* simple-shell: Some shells;
|
||||
* hello-versions: Choosing some package version;
|
||||
* samples: A directory with found exicting recipes!
|
||||
* flake-basic: A really basic flake
|
||||
* flake-basic-platform: A slighly more complex flake, with more targets
|
||||
* flake-mkDerivation: A flake with a ... mkDerivation
|
||||
* flake-rust-devshell: A flake with a rust overlay
|
||||
|
||||
|
||||
## Building, running, deleting
|
||||
@ -63,4 +67,4 @@ It will be needed to wipe the profile history and the `result` link to be able t
|
||||
* https://nix.dev/tutorials/nixos/building-and-running-docker-images.html
|
||||
* https://mitchellh.com/writing/nix-with-dockerfiles
|
||||
* https://jameswillia.ms/posts/go-nix-containers.html
|
||||
|
||||
|
||||
|
61
flake-mkDerivation/flake.lock
Normal file
61
flake-mkDerivation/flake.lock
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"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": 1710631334,
|
||||
"narHash": "sha256-rL5LSYd85kplL5othxK5lmAtjyMOBg390sGBTb3LRMM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c75037bbf9093a2acb617804ee46320d6d1fea5a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"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
|
||||
}
|
54
flake-mkDerivation/flake.nix
Normal file
54
flake-mkDerivation/flake.nix
Normal file
@ -0,0 +1,54 @@
|
||||
# Source: https://fasterthanli.me/series/building-a-rust-service-with-nix/part-10#a-flake-with-derivation
|
||||
# nix build .#packages.x86_64-linux.shaka-packager
|
||||
# nix build .#shaka-packager
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
name = "simple";
|
||||
src = ./.;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
packages.default = derivation {
|
||||
inherit system name src;
|
||||
builder = with pkgs; "${bash}/bin/bash";
|
||||
args = [ "-c" "echo foo > $out" ];
|
||||
};
|
||||
packages.shaka-packager =
|
||||
let
|
||||
version = "2.6.1";
|
||||
inherit (pkgs) stdenv lib;
|
||||
in
|
||||
stdenv.mkDerivation
|
||||
{
|
||||
name = "shaka-packager-${version}";
|
||||
|
||||
# https://nixos.wiki/wiki/Packaging/Binaries
|
||||
src = pkgs.fetchurl {
|
||||
url =
|
||||
"https://github.com/shaka-project/shaka-packager/releases/download/v${version}/packager-linux-x64";
|
||||
sha256 = "sha256-MoMX6PEtvPmloXJwRpnC2lHlT+tozsV4dmbCqweyyI0=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
install -m755 -D $src $out/bin/shaka-packager
|
||||
'';
|
||||
|
||||
meta = with nixpkgs.lib; {
|
||||
homepage = "https://shaka-project.github.io/shaka-packager/html/";
|
||||
description =
|
||||
"Media packaging framework for VOD and Live DASH and HLS applications";
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
# flake-multi-platform
|
||||
|
||||
## Targets
|
||||
|
||||
```
|
||||
> nix build
|
||||
...
|
||||
@ -17,3 +19,11 @@ git+file:///home/mycroft/dev/nix-samples?dir=flake-multi-platform
|
||||
└───x86_64-linux
|
||||
└───default: package 'simple'
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
```
|
||||
> nix build .
|
||||
> nix build .#default
|
||||
> nix build .#packages.x86_64-linux
|
||||
```
|
||||
|
85
flake-rust-devshell/flake.lock
Normal file
85
flake-rust-devshell/flake.lock
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"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": 1710631334,
|
||||
"narHash": "sha256-rL5LSYd85kplL5othxK5lmAtjyMOBg390sGBTb3LRMM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c75037bbf9093a2acb617804ee46320d6d1fea5a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710727870,
|
||||
"narHash": "sha256-Ulsx+t4SnRmjMJx4eF2Li+3rBGYhZp0XNShVjIheCfg=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a1b17cacfa7a6ed18f553a195a047f4e73e95da9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
32
flake-rust-devshell/flake.nix
Normal file
32
flake-rust-devshell/flake.nix
Normal file
@ -0,0 +1,32 @@
|
||||
# https://fasterthanli.me/series/building-a-rust-service-with-nix/part-10#a-flake-with-derivation
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
in
|
||||
with pkgs;
|
||||
{
|
||||
devShells.default = mkShell {
|
||||
# buildInputs = [ rust-bin.stable.latest.default ];
|
||||
buildInputs = [ rustToolchain ];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
5
flake-rust-devshell/rust-toolchain.toml
Normal file
5
flake-rust-devshell/rust-toolchain.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2020-07-10"
|
||||
components = [ "rustfmt", "rustc-dev" ]
|
||||
targets = [ "x86_64-unknown-linux-gnu" ]
|
||||
profile = "minimal"
|
Loading…
Reference in New Issue
Block a user