generated from stubbfel/nix-project-template
add src
This commit is contained in:
@@ -4,8 +4,7 @@
|
|||||||
// Features to add to the dev container. More info: https://containers.dev/implementors/features.
|
// Features to add to the dev container. More info: https://containers.dev/implementors/features.
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/docker-from-docker:1": {},
|
"ghcr.io/devcontainers/features/docker-from-docker:1": {},
|
||||||
"ghcr.io/devcontainers/features/nix:1": {},
|
"ghcr.io/devcontainers/features/nix:1": {}
|
||||||
"./dev_shell": {}
|
|
||||||
},
|
},
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# <project-name>
|
# Nix-Dev-Shell
|
||||||
|
|
||||||
## Nix Flake commands
|
## Nix Flake commands
|
||||||
|
|
||||||
|
|||||||
38
flake.nix
38
flake.nix
@@ -5,47 +5,51 @@
|
|||||||
outputs = { self, nixpkgs }:
|
outputs = { self, nixpkgs }:
|
||||||
let
|
let
|
||||||
name = "nix-dev-shell";
|
name = "nix-dev-shell";
|
||||||
version = "0.0.1";
|
version = "1.0.0";
|
||||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
#supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||||
|
supportedSystems = [ "x86_64-linux" ];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
|
|
||||||
devTaskScripts = forAllSystems (system:
|
devTaskScripts = forAllSystems (system:
|
||||||
{
|
{
|
||||||
autoTag = nixpkgsFor.system.writeScript "auto_tag.sh" ''
|
autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" ''
|
||||||
git tag --force vversion
|
git tag --force v${version}
|
||||||
git push origin vversion
|
git push origin v${version}
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
packages = forAllSystems (system:
|
packages = forAllSystems (system:
|
||||||
{
|
{
|
||||||
default = nixpkgsFor.system.stdenv.mkDerivation {
|
default = nixpkgsFor.${system}.stdenv.mkDerivation {
|
||||||
name = name;
|
name = name;
|
||||||
src = self;
|
src = self;
|
||||||
buildPhase = "echo nothing todo";
|
buildPhase = "echo nothing todo";
|
||||||
installPhase = "mkdir -p out/bin; install -t out/bin src/hello.sh";
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
install -t $out src/devcontainer-feature.json
|
||||||
|
install -t $out src/install.sh
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
apps = forAllSystems (system:
|
apps = forAllSystems (system:
|
||||||
let
|
let
|
||||||
updateLockScript = nixpkgsFor.system.writeShellScriptBin "update_flake_lock.sh" ''
|
updateLockScript = nixpkgsFor.${system}.writeShellScriptBin "update_flake_lock.sh" ''
|
||||||
nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs
|
nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs
|
||||||
nix --experimental-features 'nix-command flakes' build
|
nix --experimental-features 'nix-command flakes' build
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = { type = "app"; program = "packages.${system.default}/bin/hello.sh"; };
|
default = { type = "app"; program = "${packages.${system}.default}/install.sh"; };
|
||||||
devTasks = {
|
devTasks = {
|
||||||
updateFlakeLock = { type = "app"; program = "updateLockScript/bin/update_flake_lock.sh"; };
|
updateFlakeLock = { type = "app"; program = "${updateLockScript}/bin/update_flake_lock.sh"; };
|
||||||
autoTag = { type = "app"; program = "devTaskScripts.${system.autoTag}"; };
|
autoTag = { type = "app"; program = "${devTaskScripts.${system}.autoTag}"; };
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = forAllSystems (system:
|
devShells = forAllSystems (system:
|
||||||
{
|
{
|
||||||
default = nixpkgsFor.system.mkShell {
|
default = nixpkgsFor.${system}.mkShell {
|
||||||
name = "dev-shell";
|
name = "dev-shell";
|
||||||
packages = [ ];
|
packages = [ ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
@@ -53,7 +57,6 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
hydraJobs = {
|
hydraJobs = {
|
||||||
tarball = nixpkgsFor.x86_64-linux.releaseTools.sourceTarball {
|
tarball = nixpkgsFor.x86_64-linux.releaseTools.sourceTarball {
|
||||||
name = name;
|
name = name;
|
||||||
@@ -62,11 +65,10 @@
|
|||||||
officialRelease = true;
|
officialRelease = true;
|
||||||
bootstrapBuildInputs = [ ];
|
bootstrapBuildInputs = [ ];
|
||||||
distPhase = ''
|
distPhase = ''
|
||||||
mkdir out/tarballs
|
mkdir $out/tarballs
|
||||||
tar -czvf out/tarballs/name-version.tar.gz *
|
tar -czvf $out/tarballs/devcontainer-feature-${name}.tgz *
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
runCommandHook = {
|
runCommandHook = {
|
||||||
recurseForDerivations = { };
|
recurseForDerivations = { };
|
||||||
autoTag = devTaskScripts.x86_64-linux.autoTag;
|
autoTag = devTaskScripts.x86_64-linux.autoTag;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "DevShell",
|
"name": "NixDevShell",
|
||||||
"id": "dev_shell",
|
"id": "nix-dev-shell",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "A nix based dev shell"
|
"description": "A nix based dev shell"
|
||||||
}
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/env bash
|
|
||||||
|
|
||||||
echo "hello world"
|
|
||||||
Reference in New Issue
Block a user