diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 24044ad..36b4508 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,8 +4,7 @@ // Features to add to the dev container. More info: https://containers.dev/implementors/features. "features": { "ghcr.io/devcontainers/features/docker-from-docker:1": {}, - "ghcr.io/devcontainers/features/nix:1": {}, - "./dev_shell": {} + "ghcr.io/devcontainers/features/nix:1": {} }, // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], diff --git a/README.md b/README.md index 156d603..a4b2ef0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# +# Nix-Dev-Shell ## Nix Flake commands diff --git a/flake.nix b/flake.nix index dfa2fa0..6dde54a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,47 +5,51 @@ outputs = { self, nixpkgs }: let name = "nix-dev-shell"; - version = "0.0.1"; - supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + version = "1.0.0"; + #supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + supportedSystems = [ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + devTaskScripts = forAllSystems (system: { - autoTag = nixpkgsFor.system.writeScript "auto_tag.sh" '' - git tag --force vversion - git push origin vversion + autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" '' + git tag --force v${version} + git push origin v${version} ''; }); in rec { packages = forAllSystems (system: { - default = nixpkgsFor.system.stdenv.mkDerivation { + default = nixpkgsFor.${system}.stdenv.mkDerivation { name = name; src = self; 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: 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' build ''; in { - default = { type = "app"; program = "packages.${system.default}/bin/hello.sh"; }; + default = { type = "app"; program = "${packages.${system}.default}/install.sh"; }; devTasks = { - updateFlakeLock = { type = "app"; program = "updateLockScript/bin/update_flake_lock.sh"; }; - autoTag = { type = "app"; program = "devTaskScripts.${system.autoTag}"; }; + updateFlakeLock = { type = "app"; program = "${updateLockScript}/bin/update_flake_lock.sh"; }; + autoTag = { type = "app"; program = "${devTaskScripts.${system}.autoTag}"; }; }; }); - devShells = forAllSystems (system: { - default = nixpkgsFor.system.mkShell { + default = nixpkgsFor.${system}.mkShell { name = "dev-shell"; packages = [ ]; shellHook = '' @@ -53,7 +57,6 @@ ''; }; }); - hydraJobs = { tarball = nixpkgsFor.x86_64-linux.releaseTools.sourceTarball { name = name; @@ -62,11 +65,10 @@ officialRelease = true; bootstrapBuildInputs = [ ]; distPhase = '' - mkdir out/tarballs - tar -czvf out/tarballs/name-version.tar.gz * + mkdir $out/tarballs + tar -czvf $out/tarballs/devcontainer-feature-${name}.tgz * ''; }; - runCommandHook = { recurseForDerivations = { }; autoTag = devTaskScripts.x86_64-linux.autoTag; diff --git a/.devcontainer/dev_shell/devcontainer-feature.json b/src/devcontainer-feature.json similarity index 56% rename from .devcontainer/dev_shell/devcontainer-feature.json rename to src/devcontainer-feature.json index 62ddc72..778e08f 100644 --- a/.devcontainer/dev_shell/devcontainer-feature.json +++ b/src/devcontainer-feature.json @@ -1,6 +1,6 @@ { - "name": "DevShell", - "id": "dev_shell", + "name": "NixDevShell", + "id": "nix-dev-shell", "version": "1.0.0", "description": "A nix based dev shell" } \ No newline at end of file diff --git a/src/hello.sh b/src/hello.sh deleted file mode 100755 index 2202fe7..0000000 --- a/src/hello.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/env bash - -echo "hello world" \ No newline at end of file diff --git a/.devcontainer/dev_shell/install.sh b/src/install.sh similarity index 100% rename from .devcontainer/dev_shell/install.sh rename to src/install.sh