separate out container, add shell
This commit is contained in:
parent
7bb0fe54e4
commit
1be0e51b91
1
VERSION.txt
Normal file
1
VERSION.txt
Normal file
|
@ -0,0 +1 @@
|
|||
0.1.0
|
13
container.nix
Normal file
13
container.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, package }:
|
||||
|
||||
pkgs.dockerTools.buildImage {
|
||||
name = package.pname;
|
||||
tag = [ "latest" "0.1.0" ]; #package.version
|
||||
created = "now";
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ package ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
config.Cmd = [ "${package}/bin/hello" ];
|
||||
}
|
30
flake.nix
30
flake.nix
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
description = "An over-engineered Hello World in C";
|
||||
description = "A Nix Flake example for ANSI C using GNU Autoconf";
|
||||
|
||||
nixConfig = {
|
||||
bash-prompt = "\\[\\e[34;1m\\]flake.nix ~ \\[\\e[0m\\]";
|
||||
};
|
||||
|
||||
# Nixpkgs / NixOS version to use.
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
@ -11,8 +14,8 @@
|
|||
let
|
||||
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
|
||||
|
||||
# Generate a user-friendly version number for our target.
|
||||
version = builtins.substring 0 8 lastModifiedDate;
|
||||
# Generate a user-friendly version number (e.g. "1.2.3-20231027-DIRTY").
|
||||
version = "${builtins.readFile ./VERSION.txt}.${builtins.substring 0 8 (self.lastModifiedDate or "19700101")}.${self.shortRev or "DIRTY"}";
|
||||
|
||||
# System types to support.
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
|
@ -40,25 +43,14 @@
|
|||
})
|
||||
];
|
||||
};
|
||||
in rec {
|
||||
|
||||
in rec {
|
||||
packages = { inherit (pkgs) hello; };
|
||||
packages.default = self.packages.${system}.hello;
|
||||
packages.container = pkgs.dockerTools.buildImage {
|
||||
name = "hello";
|
||||
tag = "0.1.0";
|
||||
created = "now";
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ packages.default ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
config.Cmd = [ "${packages.default}/bin/hello" ];
|
||||
};
|
||||
|
||||
apps.hello = flake-utils.lib.mkApp { drv = packages.hello; };
|
||||
packages.container = pkgs.callPackage ./container.nix { package = packages.default; };
|
||||
apps.hello = flake-utils.lib.mkApp { drv = packages.default; };
|
||||
defaultApp = apps.hello;
|
||||
# devShells.default = import ./shell.nix { inherit pkgs; };
|
||||
# devShells.default = import ./shell.nix { inherit pkgs; };
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue