Skip to content

Commit

Permalink
- Updated flake inputs
Browse files Browse the repository at this point in the history
- changed overrides to refer to final instead of prev
- changed writeShellScript to writeShellApplication
  • Loading branch information
aftix committed May 17, 2024
1 parent 9a4c247 commit 1cece6e
Show file tree
Hide file tree
Showing 13 changed files with 340 additions and 314 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,3 @@ jobs:
- name: Deploy fermi
run: >
nix run 'github:serokell/deploy-rs' '.#fermi'
iso:
name: Create nixos isos
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64]
variant:
- minimal
- graphical
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Generate ISO file
run:
nix run 'nixpkgs#just' iso "${{ matrix.variant }}" "${{ matrix.arch }}"
- uses: actions/upload-artifact@v4
with:
name: nixos-aftix-${{ matrix.variant }}-${{ matrix.arch }}-linux.iso
path: result/iso/*.iso
37 changes: 19 additions & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

hyprland.url = "github:hyprwm/Hyprland/v0.40.0?submodules=1";
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
url = "github:hyprwm/hyprland-plugins/dcbdc9a08d1df753d6799bab823486f1fff5b8e6";
inputs.hyprland.follows = "hyprland";
};

Expand All @@ -60,18 +60,20 @@
} @ inputs: let
system = "x86_64-linux";

overlay = _: prev: {
overlay = final: prev: {
coreutils-full = prev.uutils-coreutils-noprefix;

stty = prev.writeScriptBin "stty" (let
pkg =
stty = prev.writeShellApplication {
name = "stty";
runtimeInputs =
if prev.lib.strings.hasSuffix "-linux" prev.system
then prev.busybox
else prev.coreutils;
in ''
#!${prev.stdenv.shell}
${pkg}/bin/stty $@
'');
then [final.busybox]
else [prev.coreutils];

text = ''
stty "$@"
'';
};
};

pkgsCfg = {
Expand Down
2 changes: 1 addition & 1 deletion hardware/hamilton.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"];
kernelModules = [];
};
kernelModules = ["kvm-amd"];
kernelModules = ["kvm_amd"];
extraModulePackages = [];
};

Expand Down
19 changes: 11 additions & 8 deletions home/aftix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ in {
];

nixpkgs.overlays = [
(_: prev: let
(final: _: let
hostTemplate = escapeShellArg (builtins.toJSON {
"github.com" = {
users.aftix.oauth_token = "PLACEHOLDER";
Expand All @@ -50,13 +50,16 @@ in {

cfg = escapeShellArg configHome;
in {
link-gh-hosts = prev.writeScriptBin "link-gh-hosts" ''
#!${prev.stdenv.shell}
[[ -f ${secretPath} ]] || exit 1
TOKEN="$(cat ${secretPath})"
echo ${hostTemplate} > ${cfg}/gh/hosts.yml
${pkgs.gnused}/bin/sed -i"" -e "s/PLACEHOLDER/$TOKEN/g" ${cfg}/gh/hosts.yml
'';
link-gh-hosts = final.writeShellApplication {
name = "link-gh-hosts";
runtimeInputs = with final; [gnused];
text = ''
[[ -f ${secretPath} ]] || exit 1
TOKEN="$(cat ${secretPath})"
echo ${hostTemplate} > ${cfg}/gh/hosts.yml
sed -i"" -e "s/PLACEHOLDER/$TOKEN/g" ${cfg}/gh/hosts.yml
'';
};
})
];

Expand Down
39 changes: 21 additions & 18 deletions home/common/gnupg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@
inherit (config.xdg) dataHome;
in {
nixpkgs.overlays = [
(_: prev: {
pinentry-custom = prev.writeScriptBin "pinentry-custom" ''
#!${prev.stdenv.shell}
if [ -z "$PINENTRY_USER_DATA" ] ; then
exec pinentry-curses "$@"
exit 0
fi
(final: _: {
pinentry-custom = final.writeShellApplication {
name = "pinentry-custom";
runtimeInputs = with final; [pinentry-qt];
text = ''
if [ -z "$PINENTRY_USER_DATA" ] ; then
exec pinentry-curses "$@"
exit 0
fi
case $PINENTRY_USER_DATA in
qt)
exec ${prev.pinentry-qt}/bin/pinentry-qt "$@"
;;
none)
exit 1
;;
*)
exec ${prev.pinentry-qt}/bin/pinentry-curses "$@"
esac
'';
case $PINENTRY_USER_DATA in
qt)
exec pinentry-qt "$@"
;;
none)
exit 1
;;
*)
exec pinentry-curses "$@"
esac
'';
};
})
];

Expand Down
26 changes: 15 additions & 11 deletions home/opt/aria2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
...
}: {
nixpkgs.overlays = [
(_: prev: {
aria2d = prev.writeScriptBin "aria2d" (let
rpcDir = "${config.xdg.configHome}/aria2";
rpcFile = "${rpcDir}/aria2d.env";
in ''
#!${prev.stdenv.shell}
mkdir -p "${rpcDir}"
dd if=/dev/urandom of=/dev/stdout bs=64 count=1 2>/dev/null | base64 | tr -d '\n=*' | xargs printf "ARIA2_RPC_TOKEN=%s" > "${rpcFile}"
source "${rpcFile}"
${prev.aria2}/bin/aria2c --conf-path="${rpcDir}/aria2d.conf" --rpc-secret="$ARIA2_RPC_TOKEN"
'');
(final: _: {
aria2d = final.writeShellApplication {
name = "aria2d";
runtimeInputs = with final; [aria2];
text = let
rpcDir = "${config.xdg.configHome}/aria2";
rpcFile = "${rpcDir}/aria2d.env";
in ''
mkdir -p "${rpcDir}"
dd if=/dev/urandom of=/dev/stdout bs=64 count=1 2>/dev/null | base64 | tr -d '\n=*' | xargs printf "ARIA2_RPC_TOKEN=%s" > "${rpcFile}"
# shellcheck source=/dev/null
source "${rpcFile}"
aria2c --conf-path="${rpcDir}/aria2d.conf" --rpc-secret="$ARIA2_RPC_TOKEN"
'';
};
})
];
home.packages = with pkgs; [aria2 aria2d python312Packages.aria2p];
Expand Down
34 changes: 18 additions & 16 deletions home/opt/email.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@
inherit (lib.strings) concatMapStringsSep;
in {
nixpkgs.overlays = [
(_: prev: {
mutt-purgecache = prev.writeScriptBin "mutt-purgecache" ''
#!${prev.stdenv.shell}
CACHE_LIMIT=512000 #KiB
cd "$1" 2>/dev/null
[ $? -ne 0 ] && exit
[ $(du -s . | cut -f1 -d$'\t') -lt $CACHE_LIMIT ] && exit
while IFS= read -r i; do
rm "$i"
[ $(du -s . | cut -f1 -d$'\t') -lt $CACHE_LIMIT ] && exit
done <<EOF
$(find . -type f -exec ls -rt1 {} +)
EOF
'';
(final: _: {
mutt-purgecache = final.writeShellApplication {
name = "mutt-purgecache";
runtimeInputs = with final; [findutils];
text = ''
CACHE_LIMIT=512000 #KiB
cd "$1" 2>/dev/null || exit
[ "$(du -s . | cut -f1 -d$'\t')" -lt $CACHE_LIMIT ] && exit
while IFS= read -r i; do
rm "$i"
[ "$(du -s . | cut -f1 -d$'\t')" -lt $CACHE_LIMIT ] && exit
done <<EOF
$(find . -type f -exec ls -rt1 {} +)
EOF
'';
};
})
];

Expand Down
37 changes: 21 additions & 16 deletions home/opt/hypr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,28 @@ in {

config = {
nixpkgs.overlays = [
(_: prev: {
screenshot = prev.writeScriptBin "screenshot" ''
#!${prev.bash}/bin/bash
export PATH="${prev.wl-clipboard}/bin:${prev.grim}/bin:${prev.slurp}/bin:$PATH"
export PATH="${prev.libnotify}/bin:${prev.tofi}/bin:${prev.systemd}/bin:${prev.satty}/bin:$PATH"
shopt -s globstar nullglob
source <(systemctl --user show-environment | grep -v PATH=)
grim -g "$(slurp -o -r -c '#ff0000ff')" - | \
satty --filename - --fullscreen --output-filename ~/media/screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png \
--early-exit --initial-tool crop --copy-command wl-copy
'';
(final: _: {
screenshot = final.writeShellApplication {
name = "screenshot";
runtimeInputs = with final; [wl-clipboard grim slurp libnotify tofi systemd satty];
text = ''
shopt -s globstar nullglob
# shellcheck source=/dev/null
source <(systemctl --user show-environment | grep -v PATH=)
grim -g "$(slurp -o -r -c '#ff0000ff')" - | \
satty --filename - --fullscreen --output-filename ~/media/screenshots/satty-"$(date '+%Y%m%d-%H:%M:%S')".png \
--early-exit --initial-tool crop --copy-command wl-copy
'';
};

zenith-popup = prev.writeScriptBin "zenith-popup" ''
#!${prev.stdenv.shell}
[ -n "$1" ] && "$1" -e ${escapeShellArg prev.zenith}/bin/zenith
'';
zenith-popup = final.writeShellApplication {
name = "zenith-popup";
runtimeInputs = with final; [zenith];
text = ''
[ -n "$1" ] && "$1" -e ${escapeShellArg final.zenith}/bin/zenith
'';
};
})
];

Expand Down
Loading

0 comments on commit 1cece6e

Please sign in to comment.