Started adding a nix flake
This commit is contained in:
parent
afc8c2d784
commit
ff5dbd84eb
|
@ -1,2 +1,4 @@
|
||||||
virtenv
|
virtenv
|
||||||
waterfall.png
|
waterfall.png
|
||||||
|
__pycache__
|
||||||
|
scripts
|
|
@ -0,0 +1,21 @@
|
||||||
|
{ lib, python3Packages }:
|
||||||
|
with python3Packages;
|
||||||
|
buildPythonApplication {
|
||||||
|
pname = "satnogs-demo-display";
|
||||||
|
version = "1.0";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
pillow
|
||||||
|
requests
|
||||||
|
pytz
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Satnogs Demo Display";
|
||||||
|
homepage = "https://forgejo.zenerdio.de/sebastian/satnogs-demo-display";
|
||||||
|
license = licenses.gpl2Plus;
|
||||||
|
platforms = platforms.unix;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701282334,
|
||||||
|
"narHash": "sha256-MxCVrXY6v4QmfTwIysjjaX0XUhqBbxTWWB4HXtDYsdk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "057f9aecfb71c4437d2b27d3323df7f93c010b7e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "23.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
description = "A flake for the piWatcher software.";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/23.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
outputs = inputs@{ self, nixpkgs, ... }:
|
||||||
|
let
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
|
allSystems = [ "x86_64-linux" "aarch64-linux" "armv6l-linux" ];
|
||||||
|
|
||||||
|
crossPkgs-aarch64-linux = import nixpkgs { localSystem = "x86_64-linux"; crossSystem = "aarch64-linux"; };
|
||||||
|
crossPkgs-armv6l-linux = import nixpkgs {
|
||||||
|
localSystem = "x86_64-linux";
|
||||||
|
crossSystem = {
|
||||||
|
system = "armv6l-linux";
|
||||||
|
gcc = {
|
||||||
|
arch = "armv6k";
|
||||||
|
fpu = "vfp";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
|
||||||
|
|
||||||
|
packages = {
|
||||||
|
x86_64-linux = {
|
||||||
|
default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix { };
|
||||||
|
cross-aarch64-linux = crossPkgs-aarch64-linux.callPackage ./default.nix { };
|
||||||
|
cross-armv6l-linux = crossPkgs-armv6l-linux.callPackage ./default.nix { };
|
||||||
|
};
|
||||||
|
aarch64-linux.default = nixpkgs.legacyPackages.aarch64-linux.callPackage ./default.nix { };
|
||||||
|
armv6l-linux.default = nixpkgs.legacyPackages.armv6l-linux.callPackage ./default.nix { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nixosModules.default = { config, pkgs, ... }: {
|
||||||
|
imports = [ ./module.nix ];
|
||||||
|
_module.args.piwatcherPkgs = self.packages;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
{ lib, config, pkgs, satnogsDemoDisplayPkgs, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
# Shorter name to access final settings a
|
||||||
|
# user of hello.nix module HAS ACTUALLY SET.
|
||||||
|
# cfg is a typical convention.
|
||||||
|
cfg = config.services.satnogsDemoDisplay;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
options.services.satnogsDemoDisplay = {
|
||||||
|
enable = mkEnableOption "satnogs-demo-display service";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
default = satnogsDemoDisplayPkgs.x86_64-linux.cross-armv6l-linux;
|
||||||
|
type = types.package;
|
||||||
|
description = "satnogsDemoDisplay packages to use. Needed to fix crosscompilation issues.";
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "satnogs-demo";
|
||||||
|
description = mdDoc "User to run the desktop environment and display script.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "satnogs-demo";
|
||||||
|
description = mdDoc "Group for the user.";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
stateDir = mkOption {
|
||||||
|
default = "/var/lib/satnogs-demo-display";
|
||||||
|
type = types.str;
|
||||||
|
description = mdDoc "Demo display data directory.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [
|
||||||
|
cfg.package
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users = mkIf (cfg.user == "satnogs-demo") {
|
||||||
|
satnogs-demo = {
|
||||||
|
home = cfg.stateDir;
|
||||||
|
useDefaultShell = true;
|
||||||
|
group = cfg.group;
|
||||||
|
isSystemUser = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.satnogsDemoDisplay = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
description = "satnogsDemoDisplay service";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "exec";
|
||||||
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "1s";
|
||||||
|
StartLimitIntervalSec = "0";
|
||||||
|
WorkingDirectory = cfg.stateDir;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
ln -s ${cfg.package}/satnogs-logo.png ./
|
||||||
|
ln -s ${cfg.package}/Montserrat-Regular.otf ./
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
${cfg.package}/bin/update.py
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/fxzpj6qdbgr6mcxs12004v71h2hzzqld-satnogs-demo-display-1.0
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
if not os.path.exists('scripts'):
|
||||||
|
os.makedirs('scripts')
|
||||||
|
shutil.copyfile('update.py', 'scripts/satnogs-demo-display')
|
||||||
|
|
||||||
|
setup(name='satnogs-demo-display',
|
||||||
|
version='1.0',
|
||||||
|
# Modules to import from other scripts:
|
||||||
|
packages=find_packages(),
|
||||||
|
data_files = [('', ['satnogs-logo.png', 'Montserrat-Regular.otf'])],
|
||||||
|
# Executables
|
||||||
|
scripts=["scripts/satnogs-demo-display"],
|
||||||
|
)
|
Loading…
Reference in New Issue