feat: improve EonTimer package

This commit is contained in:
Leon Schwarzäugl 2025-01-02 13:43:51 +01:00
parent 52c6bce5a1
commit 07a99987a7
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
13 changed files with 214 additions and 90 deletions

View file

@ -845,6 +845,7 @@ My work machine. Built for more security, this is the gold standard of my config
profilesPath = "${self}/profiles"; profilesPath = "${self}/profiles";
sharedOptions = { sharedOptions = {
isBtrfs = true; isBtrfs = true;
isLinux = true;
}; };
in in
{ {
@ -919,7 +920,6 @@ My work machine. Built for more security, this is the gold standard of my config
isImpermanence = false; isImpermanence = false;
isSecureBoot = true; isSecureBoot = true;
isCrypted = true; isCrypted = true;
isLinux = true;
} }
sharedOptions; sharedOptions;
@ -1553,6 +1553,7 @@ This is a slim setup for developing base configuration. I do not track the hardw
profilesPath = "${self}/profiles"; profilesPath = "${self}/profiles";
sharedOptions = { sharedOptions = {
isBtrfs = true; isBtrfs = true;
isLinux = true;
}; };
in in
{ {
@ -1621,7 +1622,6 @@ This is a slim setup for developing base configuration. I do not track the hardw
isCrypted = true; isCrypted = true;
isSecureBoot = false; isSecureBoot = false;
isSwap = true; isSwap = true;
isLinux = true;
swapSize = "8G"; swapSize = "8G";
# rootDisk = "/dev/nvme0n1"; # rootDisk = "/dev/nvme0n1";
rootDisk = "/dev/vda"; rootDisk = "/dev/vda";
@ -2095,6 +2095,7 @@ Note: The structure of generating the packages was changed in commit =2cf03a3 re
"vershell" "vershell"
"eontimer" "eontimer"
"project" "project"
"fhs"
]; ];
in in
lib.swarselsystems.mkPackages packageNames pkgs lib.swarselsystems.mkPackages packageNames pkgs
@ -3504,25 +3505,37 @@ This script allows for quick git branch switching.
This script allows for quick git branch switching. This script allows for quick git branch switching.
#+begin_src nix :tangle pkgs/eontimer/default.nix #+begin_src nix :tangle pkgs/eontimer/default.nix
{ pkgs, python3Packages, ... }: { lib
, python3
python3Packages.buildPythonApplication rec { , fetchFromGitHub
, makeDesktopItem
, writeShellScript
, ...
}:
let
wrapper = writeShellScript "eontimer-wrapper" ''
export QT_QPA_PLATFORM=xcb
exec @out@/bin/EonTimer
'';
in
python3.pkgs.buildPythonApplication rec {
pname = "eontimer"; pname = "eontimer";
version = "3.0.0"; version = "3.0.0-rc.6";
pyproject = true; pyproject = true;
src = pkgs.fetchFromGitHub { src = fetchFromGitHub {
owner = "DasAmpharos"; owner = "DasAmpharos";
repo = "EonTimer"; repo = "EonTimer";
rev = "9449e6158f0aa6eaa24b3b1d0a427aa198b5c0e4"; rev = version;
hash = "sha256-+XN/VGGlEg2gVncRZrWDOZ2bfxt8xyIu22F2wHlG6YI="; hash = "sha256-+XN/VGGlEg2gVncRZrWDOZ2bfxt8xyIu22F2wHlG6YI=";
}; };
build-system = with python3Packages; [ build-system = [
setuptools python3.pkgs.setuptools
python3.pkgs.wheel
]; ];
dependencies = with python3Packages; [ dependencies = with python3.pkgs; [
altgraph altgraph
certifi certifi
charset-normalizer charset-normalizer
@ -3542,16 +3555,50 @@ This script allows for quick git branch switching.
urllib3 urllib3
]; ];
nativeBuildInputs = [
python3.pkgs.pyinstaller
];
buildPhase = '' buildPhase = ''
${pkgs.python3Packages.pyinstaller}/bin/pyinstaller EonTimer.spec runHook preBuild
pyinstaller --clean --noconfirm EonTimer.spec
runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
mkdir -p $out/share/applications
cp dist/EonTimer $out/bin/ cp dist/EonTimer $out/bin/
install -Dm755 -T ${wrapper} $out/bin/eontimer
substituteInPlace $out/bin/eontimer --subst-var out
runHook postInstall
'';
postInstall = ''
install -Dm755 -t $out/share/applications ${
makeDesktopItem {
name = "eontimer";
desktopName = "EonTimer";
comment = "Start EonTimer";
exec = "eontimer";
}
}/share/applications/eontimer.desktop
''; '';
meta = {
description = "Pokémon RNG Timer";
homepage = "https://github.com/DasAmpharos/EonTimer";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ ];
mainProgram = "eon-timer";
};
} }
#+end_src #+end_src
@ -3576,6 +3623,23 @@ This script allows for quick git branch switching.
} }
#+end_src #+end_src
**** fhs
#+begin_src nix :tangle pkgs/fhs/default.nix
{ name, pkgs, ... }:
let
base = pkgs.appimageTools.defaultFhsEnvArgs;
in
pkgs.buildFHSEnv (base // {
name = "fhs";
targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [ pkgs.pkg-config ];
profile = "export FHS=1";
runScript = "zsh";
extraOutputsToInstall = [ "dev" ];
})
#+end_src
*** Overlays (additions, overrides, nixpkgs-stable) *** Overlays (additions, overrides, nixpkgs-stable)
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:5e3e21e0-57af-4dad-b32f-6400af9b7aab :CUSTOM_ID: h:5e3e21e0-57af-4dad-b32f-6400af9b7aab
@ -3837,7 +3901,7 @@ This holds modules that are to be used on most hosts. These are also the most im
"monitors" "monitors"
"input" "input"
"nixos" "nixos"
"darwin" "setup"
"waybar" "waybar"
"startup" "startup"
"wallpaper" "wallpaper"
@ -4078,17 +4142,18 @@ These are some extra options that will be used if the machine also runs NixOS. F
} }
#+end_src #+end_src
***** darwin ***** setup
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:79f7150f-b162-4f57-abdf-07f40dffd932 :CUSTOM_ID: h:79f7150f-b162-4f57-abdf-07f40dffd932
:END: :END:
Provides settings related to nix-darwin systems. At the moment, I am only making use of a =isDarwin= flag. Provides settings related to nix-darwin systems. At the moment, I am only making use of a =isDarwin= flag.
#+begin_src nix :noweb yes :tangle modules/home/darwin.nix #+begin_src nix :noweb yes :tangle modules/home/setup.nix
{ lib, ... }: { lib, ... }:
{ {
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host"; options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
options.swarselsystems.isLinux = lib.mkEnableOption "whether this is a linux machine";
} }
#+end_src #+end_src
@ -8334,36 +8399,30 @@ This section sets up all the imports that are used in the home-manager section.
Again, we adapt =nix= to our needs, enable the home-manager command for non-NixOS machines (NixOS machines are using it as a module) and setting user information that I always keep the same. Again, we adapt =nix= to our needs, enable the home-manager command for non-NixOS machines (NixOS machines are using it as a module) and setting user information that I always keep the same.
#+begin_src nix :tangle profiles/home/common/settings.nix #+begin_src nix :tangle profiles/home/common/settings.nix
{ lib, inputs, config, ... }: { lib, config, ... }:
{ {
nix = nix = lib.mkIf (!config.swarselsystems.isNixos) {
let settings = {
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; experimental-features = [
in "nix-command"
lib.mkIf (!config.swarselsystems.isNixos) { "flakes"
settings = { "ca-derivations"
experimental-features = [ "cgroups"
"nix-command" "pipe-operators"
"flakes" ];
"ca-derivations" trusted-users = [ "@wheel" "swarsel" ];
"cgroups" connect-timeout = 5;
"pipe-operators" bash-prompt-prefix = "$SHLVL:\\w ";
]; bash-prompt = "$(if [[ $? -gt 0 ]]; then printf \"\"; else printf \"\"; fi)\[\e[1m\]λ\[\e[0m\] ";
trusted-users = [ "@wheel" "swarsel" ]; fallback = true;
connect-timeout = 5; min-free = 128000000;
bash-prompt-prefix = "$SHLVL:\\w "; max-free = 1000000000;
bash-prompt = "$(if [[ $? -gt 0 ]]; then printf \"\"; else printf \"\"; fi)\[\e[1m\]λ\[\e[0m\] "; auto-optimise-store = true;
fallback = true; warn-dirty = false;
min-free = 128000000; max-jobs = 1;
max-free = 1000000000; use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
flake-registry = "";
auto-optimise-store = true;
warn-dirty = false;
max-jobs = 1;
use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
};
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
}; };
};
programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true; programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
@ -8442,6 +8501,9 @@ This holds packages that I can use as provided, or with small modifications (as
deadnix deadnix
statix statix
nix-tree nix-tree
nix-diff
nix-visualize
nix-init
manix manix
comma comma
@ -8600,7 +8662,7 @@ This is just a separate container for derivations defined in [[#h:64a5cc16-6b16-
vershell vershell
eontimer eontimer
project project
fhs
swarsel-bootstrap swarsel-bootstrap
]; ];
} }
@ -9262,7 +9324,10 @@ Here we set some aliases (some of them should be shellApplications instead) as w
cd-orig = "cd"; cd-orig = "cd";
cat-orig = "cat"; cat-orig = "cat";
cdr = "cd \"$( (find $DOCUMENT_DIR_WORK $DOCUMENT_DIR_PRIV -maxdepth 1 && echo $FLAKE) | fzf )\""; cdr = "cd \"$( (find $DOCUMENT_DIR_WORK $DOCUMENT_DIR_PRIV -maxdepth 1 && echo $FLAKE) | fzf )\"";
nix-ldd-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd";
nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd"; nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd";
nix-ldd-locate = "nix-locate --minimal --top-level -w ";
nix-store-search = "ls /nix/store | grep";
fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff"; fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff";
lt = "eza -las modified --total-size"; lt = "eza -las modified --total-size";
boot-diff = "nix store diff-closures /run/*-system"; boot-diff = "nix store diff-closures /run/*-system";

View file

@ -3,6 +3,7 @@ let
profilesPath = "${self}/profiles"; profilesPath = "${self}/profiles";
sharedOptions = { sharedOptions = {
isBtrfs = true; isBtrfs = true;
isLinux = true;
}; };
in in
{ {
@ -77,7 +78,6 @@ in
isImpermanence = false; isImpermanence = false;
isSecureBoot = true; isSecureBoot = true;
isCrypted = true; isCrypted = true;
isLinux = true;
} }
sharedOptions; sharedOptions;

View file

@ -3,6 +3,7 @@ let
profilesPath = "${self}/profiles"; profilesPath = "${self}/profiles";
sharedOptions = { sharedOptions = {
isBtrfs = true; isBtrfs = true;
isLinux = true;
}; };
in in
{ {
@ -71,7 +72,6 @@ in
isCrypted = true; isCrypted = true;
isSecureBoot = false; isSecureBoot = false;
isSwap = true; isSwap = true;
isLinux = true;
swapSize = "8G"; swapSize = "8G";
# rootDisk = "/dev/nvme0n1"; # rootDisk = "/dev/nvme0n1";
rootDisk = "/dev/vda"; rootDisk = "/dev/vda";

View file

@ -1,4 +0,0 @@
{ lib, ... }:
{
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
}

View file

@ -6,7 +6,7 @@ let
"monitors" "monitors"
"input" "input"
"nixos" "nixos"
"darwin" "setup"
"waybar" "waybar"
"startup" "startup"
"wallpaper" "wallpaper"

5
modules/home/setup.nix Normal file
View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
options.swarselsystems.isLinux = lib.mkEnableOption "whether this is a linux machine";
}

View file

@ -25,6 +25,7 @@ let
"vershell" "vershell"
"eontimer" "eontimer"
"project" "project"
"fhs"
]; ];
in in
lib.swarselsystems.mkPackages packageNames pkgs lib.swarselsystems.mkPackages packageNames pkgs

View file

@ -1,22 +1,34 @@
{ pkgs, python3Packages, ... }: { lib
, python3
python3Packages.buildPythonApplication rec { , fetchFromGitHub
, makeDesktopItem
, writeShellScript
, ...
}:
let
wrapper = writeShellScript "eontimer-wrapper" ''
export QT_QPA_PLATFORM=xcb
exec @out@/bin/EonTimer
'';
in
python3.pkgs.buildPythonApplication rec {
pname = "eontimer"; pname = "eontimer";
version = "3.0.0"; version = "3.0.0-rc.6";
pyproject = true; pyproject = true;
src = pkgs.fetchFromGitHub { src = fetchFromGitHub {
owner = "DasAmpharos"; owner = "DasAmpharos";
repo = "EonTimer"; repo = "EonTimer";
rev = "9449e6158f0aa6eaa24b3b1d0a427aa198b5c0e4"; rev = version;
hash = "sha256-+XN/VGGlEg2gVncRZrWDOZ2bfxt8xyIu22F2wHlG6YI="; hash = "sha256-+XN/VGGlEg2gVncRZrWDOZ2bfxt8xyIu22F2wHlG6YI=";
}; };
build-system = with python3Packages; [ build-system = [
setuptools python3.pkgs.setuptools
python3.pkgs.wheel
]; ];
dependencies = with python3Packages; [ dependencies = with python3.pkgs; [
altgraph altgraph
certifi certifi
charset-normalizer charset-normalizer
@ -36,14 +48,48 @@ python3Packages.buildPythonApplication rec {
urllib3 urllib3
]; ];
nativeBuildInputs = [
python3.pkgs.pyinstaller
];
buildPhase = '' buildPhase = ''
${pkgs.python3Packages.pyinstaller}/bin/pyinstaller EonTimer.spec runHook preBuild
pyinstaller --clean --noconfirm EonTimer.spec
runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
mkdir -p $out/share/applications
cp dist/EonTimer $out/bin/ cp dist/EonTimer $out/bin/
install -Dm755 -T ${wrapper} $out/bin/eontimer
substituteInPlace $out/bin/eontimer --subst-var out
runHook postInstall
'';
postInstall = ''
install -Dm755 -t $out/share/applications ${
makeDesktopItem {
name = "eontimer";
desktopName = "EonTimer";
comment = "Start EonTimer";
exec = "eontimer";
}
}/share/applications/eontimer.desktop
''; '';
meta = {
description = "Pokémon RNG Timer";
homepage = "https://github.com/DasAmpharos/EonTimer";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ ];
mainProgram = "eon-timer";
};
} }

11
pkgs/fhs/default.nix Normal file
View file

@ -0,0 +1,11 @@
{ name, pkgs, ... }:
let
base = pkgs.appimageTools.defaultFhsEnvArgs;
in
pkgs.buildFHSEnv (base // {
name = "fhs";
targetPkgs = pkgs: (base.targetPkgs pkgs) ++ [ pkgs.pkg-config ];
profile = "export FHS=1";
runScript = "zsh";
extraOutputsToInstall = [ "dev" ];
})

View file

@ -22,7 +22,7 @@
vershell vershell
eontimer eontimer
project project
fhs
swarsel-bootstrap swarsel-bootstrap
]; ];
} }

View file

@ -41,6 +41,9 @@
deadnix deadnix
statix statix
nix-tree nix-tree
nix-diff
nix-visualize
nix-init
manix manix
comma comma

View file

@ -1,33 +1,27 @@
{ lib, inputs, config, ... }: { lib, config, ... }:
{ {
nix = nix = lib.mkIf (!config.swarselsystems.isNixos) {
let settings = {
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; experimental-features = [
in "nix-command"
lib.mkIf (!config.swarselsystems.isNixos) { "flakes"
settings = { "ca-derivations"
experimental-features = [ "cgroups"
"nix-command" "pipe-operators"
"flakes" ];
"ca-derivations" trusted-users = [ "@wheel" "swarsel" ];
"cgroups" connect-timeout = 5;
"pipe-operators" bash-prompt-prefix = "$SHLVL:\\w ";
]; bash-prompt = "$(if [[ $? -gt 0 ]]; then printf \"\"; else printf \"\"; fi)\[\e[1m\]λ\[\e[0m\] ";
trusted-users = [ "@wheel" "swarsel" ]; fallback = true;
connect-timeout = 5; min-free = 128000000;
bash-prompt-prefix = "$SHLVL:\\w "; max-free = 1000000000;
bash-prompt = "$(if [[ $? -gt 0 ]]; then printf \"\"; else printf \"\"; fi)\[\e[1m\]λ\[\e[0m\] "; auto-optimise-store = true;
fallback = true; warn-dirty = false;
min-free = 128000000; max-jobs = 1;
max-free = 1000000000; use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
flake-registry = "";
auto-optimise-store = true;
warn-dirty = false;
max-jobs = 1;
use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
};
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
}; };
};
programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true; programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;

View file

@ -19,7 +19,10 @@
cd-orig = "cd"; cd-orig = "cd";
cat-orig = "cat"; cat-orig = "cat";
cdr = "cd \"$( (find $DOCUMENT_DIR_WORK $DOCUMENT_DIR_PRIV -maxdepth 1 && echo $FLAKE) | fzf )\""; cdr = "cd \"$( (find $DOCUMENT_DIR_WORK $DOCUMENT_DIR_PRIV -maxdepth 1 && echo $FLAKE) | fzf )\"";
nix-ldd-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd";
nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd"; nix-ldd = "LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH ldd";
nix-ldd-locate = "nix-locate --minimal --top-level -w ";
nix-store-search = "ls /nix/store | grep";
fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff"; fs-diff = "sudo mount -o subvol=/ /dev/mapper/cryptroot /mnt ; fs-diff";
lt = "eza -las modified --total-size"; lt = "eza -las modified --total-size";
boot-diff = "nix store diff-closures /run/*-system"; boot-diff = "nix store diff-closures /run/*-system";