generated from stubbfel/nix-project-template
Initial commit
This commit is contained in:
40
.devcontainer/devcontainer.json
Normal file
40
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,40 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
|
||||
{
|
||||
"name": "Alpine",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"image": "mcr.microsoft.com/devcontainers/base:alpine",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/nix:1": {}
|
||||
},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "nix-env -i nixpkgs-fmt",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"settings": {
|
||||
"terminal.integrated.defaultProfile.linux": "dev-shell"
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"jnoortheen.nix-ide",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"eamodio.gitlens",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"timonwong.shellcheck",
|
||||
"foxundermoon.shell-format"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
result
|
||||
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"dev-shell": {
|
||||
"path": "bash",
|
||||
"args": [ "-c", "nix --experimental-features \"nix-command flakes\" develop"],
|
||||
"overrideName": true
|
||||
}
|
||||
}
|
||||
}
|
||||
9
LICENSE
Normal file
9
LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 stubbfel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
26
README.md
Normal file
26
README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# mockextension
|
||||
|
||||
## Nix Flake commands
|
||||
|
||||
```sh
|
||||
# nix flake are experimental and required following options --experimental-features 'nix-command flakes'
|
||||
# create alias for nix --experimental-features 'nix-command flakes'
|
||||
|
||||
alias nixe && echo Alias for nixe exists || alias nixe="nix --experimental-features 'nix-command flakes'"
|
||||
|
||||
# build
|
||||
nixe build
|
||||
|
||||
# run
|
||||
nixe run
|
||||
|
||||
# open development shell
|
||||
nixe develop
|
||||
|
||||
# update flake.lock
|
||||
nixe run .#devTasks.updateFlakeLock
|
||||
|
||||
# tag project
|
||||
nixe run .#devTasks.autoTag
|
||||
|
||||
```
|
||||
26
flake.lock
generated
Normal file
26
flake.lock
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1668595291,
|
||||
"narHash": "sha256-j8cyfbtT5sAYPYwbERgTDzfD48ZernL0/V668eGpXAM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6474d93e007e4d165bcf48e7f87de2175c93d10b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.05-small",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
57
flake.nix
Normal file
57
flake.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
description = "";
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
name = "mockextension";
|
||||
version = "0.0.1";
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
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 v${version}
|
||||
git push origin v${version}
|
||||
'';
|
||||
});
|
||||
in
|
||||
rec {
|
||||
packages = forAllSystems (system:
|
||||
{
|
||||
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";
|
||||
};
|
||||
});
|
||||
|
||||
apps = forAllSystems (system:
|
||||
let
|
||||
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"; };
|
||||
devTasks = {
|
||||
updateFlakeLock = { type = "app"; program = "${updateLockScript}/bin/update_flake_lock.sh"; };
|
||||
autoTag = { type = "app"; program = "${devTaskScripts.${system}.autoTag}"; };
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system:
|
||||
{
|
||||
default = nixpkgsFor.${system}.mkShell {
|
||||
name = "dev-shell";
|
||||
packages = [ ];
|
||||
shellHook = ''
|
||||
alias nixe="nix --experimental-features 'nix-command flakes'"
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
3
src/hello.sh
Executable file
3
src/hello.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/env bash
|
||||
|
||||
echo "hello world"
|
||||
Reference in New Issue
Block a user