initial commit
This commit is contained in:
commit
4e0acca4cc
11 changed files with 392 additions and 0 deletions
4
.envrc
Normal file
4
.envrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
use flake
|
||||
|
||||
watch_file flake.*
|
||||
watch_file **/*.nix
|
14
.gitea/actions/setup-nix/action.yaml
Normal file
14
.gitea/actions/setup-nix/action.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
name: Install Nix
|
||||
description: Install Nix package manager using the Determinante Systems installer
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: https://github.com/DeterminateSystems/nix-installer-action@v4
|
||||
with:
|
||||
init: none
|
||||
planner: linux
|
||||
github-token: ${{ secrets.GH_TOKEN }}
|
||||
extra-conf: |
|
||||
accept-flake-config = true
|
||||
experimental-features = nix-command flakes recursive-nix
|
30
.gitea/workflows/build.yaml
Normal file
30
.gitea/workflows/build.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
name: build
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
check:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Nix
|
||||
uses: ./.gitea/actions/setup-nix
|
||||
|
||||
- name: Nix check
|
||||
run: nix flake check
|
||||
|
||||
build:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Nix
|
||||
uses: ./.gitea/actions/setup-nix
|
||||
|
||||
- name: Nix build
|
||||
run: nix build .#
|
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
# General
|
||||
*~
|
||||
*.dll
|
||||
*.log
|
||||
*.so
|
||||
*.swp
|
||||
*.000
|
||||
*.bak
|
||||
*.bck
|
||||
*.tmp
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Nix
|
||||
.direnv
|
||||
.pre-commit-config.yaml
|
||||
result
|
16
.reuse/dep5
Normal file
16
.reuse/dep5
Normal file
|
@ -0,0 +1,16 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: nix-microscopy
|
||||
Upstream-Contact: Sebastian Wendel <nix-microscopy@srx.dev>
|
||||
Source: https://code.srx.dev/srx/nix-microscopy
|
||||
|
||||
Files: .gitignore
|
||||
.editorconfig
|
||||
.envrc
|
||||
.gitea
|
||||
packages/*
|
||||
shells/*
|
||||
*.lock
|
||||
*.nix
|
||||
*.md
|
||||
Copyright: 2023 Sebastian Wendel <nix-microscopy@srx.dev>
|
||||
License: MIT
|
9
LICENSES/MIT.txt
Normal file
9
LICENSES/MIT.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Sebastian Wendel
|
||||
|
||||
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.
|
9
README.md
Normal file
9
README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Nix Microscopy
|
||||
|
||||
## Packages
|
||||
|
||||
- [ToupLite](http://touptek.com/download/showdownload.php?lang=en&id=28) from [ToupTek](http://touptek.com/)
|
||||
|
||||
## License
|
||||
|
||||
This project follows the [REUSE Specification](https://reuse.software/spec/) and is licensed under the [MIT License - see the LICENSE file](./LICENSES/MIT.txt) for details.
|
14
default.nix
Normal file
14
default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
(import
|
||||
(
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{
|
||||
src = ./.;
|
||||
})
|
||||
.defaultNix
|
158
flake.lock
generated
Normal file
158
flake.lock
generated
Normal file
|
@ -0,0 +1,158 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1696193975,
|
||||
"narHash": "sha256-mnQjUcYgp9Guu3RNVAB2Srr1TqKcPpRXmJf4LJk6KRY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fdd898f8f79e8d2f99ed2ab6b3751811ef683242",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1696510682,
|
||||
"narHash": "sha256-Nki3ersvzmy9iQBkUI0yIRBHg6cQEHCT0oCd5BQMibg=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "b039621ad7536841c8da7b12f59af588360f7725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
74
flake.nix
Normal file
74
flake.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
description = "Nix Microscopy";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
pre-commit-hooks,
|
||||
...
|
||||
} @ inputs:
|
||||
flake-utils.lib.eachSystem ["x86_64-linux"] (system: rec {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {allowUnfree = true;};
|
||||
};
|
||||
|
||||
devShells.default = self.pkgs.${system}.mkShell {
|
||||
name = "nix-microscopy";
|
||||
buildInputs = with self.pkgs.${system}; [
|
||||
alejandra
|
||||
deadnix
|
||||
git
|
||||
nil
|
||||
nixUnstable
|
||||
pre-commit
|
||||
reuse
|
||||
statix
|
||||
];
|
||||
shellHook = ''
|
||||
${self.checks.${system}.pre-commit-check.shellHook}
|
||||
'';
|
||||
};
|
||||
|
||||
checks = {
|
||||
pre-commit-check =
|
||||
pre-commit-hooks.lib.${system}.run
|
||||
{
|
||||
src = self.pkgs.${system}.lib.cleanSource ./.;
|
||||
hooks = {
|
||||
editorconfig-checker.enable = true;
|
||||
statix.enable = true;
|
||||
deadnix.enable = true;
|
||||
alejandra.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
packages = {
|
||||
amlite = self.pkgs.${system}.callPackage ./pkgs/amlite inputs;
|
||||
default = self.packages.${system}.amlite;
|
||||
};
|
||||
|
||||
apps = {
|
||||
amlite = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.amlite}/bin/AmLite";
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
46
pkgs/amlite/default.nix
Normal file
46
pkgs/amlite/default.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
fetchurl,
|
||||
lib,
|
||||
stdenv,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "amlite";
|
||||
version = "20232603";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://storage.googleapis.com/software-download-d79bb.appspot.com/software/AmLite/Linux/${version}/AmScopeAmLite.x64.tar.bz2";
|
||||
sha256 = "sha256-GyA3ogtpsNA/pTIa21ha9P1YtNE0reRDTAI7VOcdxnY=";
|
||||
};
|
||||
|
||||
# FIX: "unpacker appears to have produced no directories"
|
||||
sourceRoot = ".";
|
||||
|
||||
postUnpack = ''
|
||||
sed -n -e '1,/^exit 0$/!p' $sourceRoot/AmScopeAmLite.x64.sh > $sourceRoot/AmLite.tgz
|
||||
cd $sourceRoot/
|
||||
tar -xzf AmLite.tgz
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{lib,bin,share} \
|
||||
$out/lib/udev/rules.d
|
||||
|
||||
cp AmLite $out/bin
|
||||
cp *.so $out/lib
|
||||
cp 99-amcam.rules $out/lib/udev/rules.d
|
||||
|
||||
cp -r i18n $out/share/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "AmScope AmLite";
|
||||
homepage = "https://amscope.com/";
|
||||
license = licenses.unfree;
|
||||
platforms = ["x86_64-linux"];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue