From 3d62eaafd7eb98e857335e474cd42de50ea3a47a Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 3 Oct 2023 11:23:30 -0500 Subject: [PATCH] I need help --- flake.lock | 151 ++++++++++++++++++++++++++++++++- flake.nix | 1 + home.nix | 45 +++++----- home/user.nix | 4 +- modules/desktop-usage.nix | 9 ++ nixos.nix | 20 ++--- nixos/common.nix | 11 ++- nixos/dragon.nix | 9 +- scripts/common/bin/script-opts | 3 - scripts/common/bin/simple-otp | 8 -- scripts/common/bin/unbackupify | 56 ------------ scripts/linux/bin/stopbar | 8 -- 12 files changed, 205 insertions(+), 120 deletions(-) delete mode 100755 scripts/common/bin/script-opts delete mode 100755 scripts/common/bin/simple-otp delete mode 100755 scripts/common/bin/unbackupify delete mode 100755 scripts/linux/bin/stopbar diff --git a/flake.lock b/flake.lock index 9eaf1f9..5e315c2 100644 --- a/flake.lock +++ b/flake.lock @@ -19,6 +19,36 @@ "url": "ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git" } }, + "crane": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": [ + "helix", + "flake-utils" + ], + "nixpkgs": [ + "helix", + "nixpkgs" + ], + "rust-overlay": [ + "helix", + "rust-overlay" + ] + }, + "locked": { + "lastModified": 1688772518, + "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=", + "owner": "ipetkov", + "repo": "crane", + "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": "nixpkgs_2" @@ -38,6 +68,22 @@ "type": "github" } }, + "flake-compat": { + "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" @@ -57,6 +103,24 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { "locked": { "lastModified": 1644229661, "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", @@ -71,6 +135,28 @@ "type": "github" } }, + "helix": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_3", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1696295907, + "narHash": "sha256-GFeo5NpbFQjVeu2lv/B/pfZY/+SIt0KRHjh26s0bXAY=", + "owner": "helix-editor", + "repo": "helix", + "rev": "75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b", + "type": "github" + }, + "original": { + "owner": "helix-editor", + "repo": "helix", + "rev": "75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -140,6 +226,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1690272529, + "narHash": "sha256-MakzcKXEdv/I4qJUtq/k/eG+rVmyOZLnYNC2w1mB59Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ef99fa5c5ed624460217c31ac4271cfb5cb2502c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1696275311, "narHash": "sha256-Z8aJvoUyMv/+0G7iqYIqecxRDFbz05RK2e3/irbWq9M=", @@ -154,7 +256,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1694760568, "narHash": "sha256-3G07BiXrp2YQKxdcdms22MUx6spc6A++MSePtatCYuI=", @@ -174,15 +276,41 @@ "inputs": { "api-lyte-dev": "api-lyte-dev", "disko": "disko", + "helix": "helix", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "sops-nix": "sops-nix", "utils": "utils" } }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "helix", + "flake-utils" + ], + "nixpkgs": [ + "helix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690424156, + "narHash": "sha256-Bpml+L280tHTQpwpC5/BJbU4HSvEzMvW8IZ4gAXimhE=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f335a0213504c7e6481c359dc1009be9cf34432c", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { @@ -214,9 +342,24 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "inputs": { - "flake-utils": "flake-utils_2" + "flake-utils": "flake-utils_3" }, "locked": { "lastModified": 1696272629, diff --git a/flake.nix b/flake.nix index aa21b93..acd0824 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,7 @@ disko.url = "github:nix-community/disko/master"; sops-nix.url = "github:Mic92/sops-nix"; + helix.url = "github:helix-editor/helix/75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b"; # TODO: hyprland.url = "github:hyprwm/Hyprland"; }; diff --git a/home.nix b/home.nix index 8867fb6..3a79293 100644 --- a/home.nix +++ b/home.nix @@ -1,28 +1,25 @@ inputs: +let + mkHome = system: modules: + let + overlay = final: prev: { + helix = prev.helix // inputs.helix.packages.${system}.helix; + }; + pkgs = import inputs.nixpkgs { inherit system; overlays = [ overlay ]; }; + in + inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ] ++ modules; + }; +in { - daniel = - let - system = "x86_64-linux"; - pkgs = import inputs.nixpkgs { inherit system; }; - in - inputs.home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - ./home/user.nix - ./home/linux.nix - ]; - }; + daniel = mkHome "x86_64-linux" [ + ./home/user.nix + ./home/linux.nix + ]; - daniel-work = - let - system = "aarch64-darwin"; - pkgs = import inputs.nixpkgs { inherit system; }; - in - inputs.home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - ./home/user.nix - ./home/work.nix - ]; - }; + daniel-work = mkHome "aarch64-darwin" [ + ./home/user.nix + ./home/work.nix + ]; } diff --git a/home/user.nix b/home/user.nix index 41b6009..8e5b06c 100644 --- a/home/user.nix +++ b/home/user.nix @@ -29,9 +29,6 @@ in # kubectl, aws pkgs.rtx - # text editor - pkgs.helix - # I need gawk for my fish prompt pkgs.gawk @@ -159,6 +156,7 @@ in helix = { enable = true; + package = pkgs.helix; languages = { language-server = { lexical = { diff --git a/modules/desktop-usage.nix b/modules/desktop-usage.nix index 5b8ca64..bc08840 100644 --- a/modules/desktop-usage.nix +++ b/modules/desktop-usage.nix @@ -137,5 +137,14 @@ driSupport = true; }; }; + + boot.binfmt.registrations.appimage = { + wrapInterpreterInShell = false; + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; + magicOrExtension = ''\x7fELF....AI\x02''; + }; } diff --git a/nixos.nix b/nixos.nix index dd5218f..64b4aab 100644 --- a/nixos.nix +++ b/nixos.nix @@ -25,18 +25,18 @@ in { # TODO: disko-fy rascal and beefcake? - # beefcake = nixosSystem "x86_64-linux" [ - # ./nixos/beefcake.nix - # inputs.api-lyte-dev.nixosModules.x86_64-linux.api-lyte-dev - # ]; + beefcake = nixosSystem "x86_64-linux" [ + ./nixos/beefcake.nix + inputs.api-lyte-dev.nixosModules.x86_64-linux.api-lyte-dev + ]; - # rascal = nixosSystem "x86_64-linux" [ ./nixos/rascal.nix ]; + rascal = nixosSystem "x86_64-linux" [ ./nixos/rascal.nix ]; - # musicbox = nixosSystem "x86_64-linux" (disko - # { - # scheme = "unencrypted"; - # disks = [ "/dev/sda" ]; - # } ++ [ ./nixos/musicbox.nix ]); + musicbox = nixosSystem "x86_64-linux" (disko + { + scheme = "unencrypted"; + disks = [ "/dev/sda" ]; + } ++ [ ./nixos/musicbox.nix ]); thinker = nixosSystem "x86_64-linux" (disko { diff --git a/nixos/common.nix b/nixos/common.nix index 70c4bbc..55bfbbc 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -16,6 +16,7 @@ in systemPackages = with pkgs; [ age bat + bc bind bottom btrfs-progs @@ -49,6 +50,7 @@ in sops smartmontools sqlite + sysstat unzip watchexec wget @@ -150,13 +152,16 @@ in trusted-users = [ "root" "daniel" ]; experimental-features = lib.mkDefault [ "nix-command" "flakes" ]; substituters = [ - "https://nix.h.lyte.dev" - "https://nix-community.cachix.org" "https://cache.nixos.org/" + "https://helix.cachix.org" + "https://nix-community.cachix.org" + "https://nix.h.lyte.dev" ]; trusted-public-keys = [ - "h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0=" + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0=" ]; }; }; diff --git a/nixos/dragon.nix b/nixos/dragon.nix index 195719f..5e081d8 100644 --- a/nixos/dragon.nix +++ b/nixos/dragon.nix @@ -1,4 +1,4 @@ -{ modulesPath, lib, ... }: { +{ modulesPath, lib, pkgs, ... }: { imports = [ ../modules/amd.nix @@ -22,6 +22,13 @@ powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; services.printing.enable = true; + environment = { + systemPackages = with pkgs; [ + radeontop + ]; + }; + + networking = { firewall = { enable = true; diff --git a/scripts/common/bin/script-opts b/scripts/common/bin/script-opts deleted file mode 100755 index 54cf829..0000000 --- a/scripts/common/bin/script-opts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -# TODO: helper for taking a data structure and building bash args? diff --git a/scripts/common/bin/simple-otp b/scripts/common/bin/simple-otp deleted file mode 100755 index 889fdc4..0000000 --- a/scripts/common/bin/simple-otp +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# TODO: check for oathtool - -key="$1"; shift -args=("$@") - -oathtool --totp=sha1 -b "$key" "${args[@]}" diff --git a/scripts/common/bin/unbackupify b/scripts/common/bin/unbackupify deleted file mode 100755 index bfd2c20..0000000 --- a/scripts/common/bin/unbackupify +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env fish - -# deps: fish, zstd, gpg, ssh - -set -q HOST || set HOST (head -n 1 /etc/hostname | tr -d '\n') - -# use the backup-host in the ~/.ssh/config as the default backup remote host -set -q BACKUP_REMOTE_HOST || set BACKUP_REMOTE_HOST backup-host - -# use a user-specific dir by default to backup to -set -q BACKUP_REMOTE_DIR || set BACKUP_REMOTE_DIR "/storage/"(whoami)"/backups/$HOST" - -set BACKUP_FILE_EXT .tar.zstd.gpg - -set target $argv[1] -if test $target = '--list-backup-files' - ssh $BACKUP_REMOTE_HOST "command ls -1 $BACKUP_REMOTE_DIR" - exit 0 -else if test (count $argv) -lt 1 - echo "No remote backup filename provided (use --list-backup-files to show)" - exit 1 -end - -ssh $BACKUP_REMOTE_HOST "echo 1" &>/dev/null || begin - echo "Cannot ssh to $BACKUP_REMOTE_HOST" - exit 6 -end - -ssh $BACKUP_REMOTE_HOST "test -d $BACKUP_REMOTE_DIR/$target" || begin - echo "Remote directory $BACKUP_REMOTE_DIR/$target does not exist on $BACKUP_REMOTE_HOST (use --list-backup-files to show)" - exit 5 -end - -# TODO: autocomplete? -# TODO: checksum? -# TODO: progress indicator? - -set local_dir (echo $target | awk -F. '{print $1}') -mkdir $local_dir || begin - echo "Local unbackup directory '$local_dir' exists" - exit 2 -end - -pushd $local_dir >/dev/null - - ssh $BACKUP_REMOTE_HOST "cat $BACKUP_REMOTE_DIR/$target" | - gpg --decrypt 2>/dev/null | - zstd --ultra -T2 -22 -dc | - tar -xf - || begin - echo "Failed to stream backup" - exit 4 - end - -popd >/dev/null - -echo "Restored to $local_dir" diff --git a/scripts/linux/bin/stopbar b/scripts/linux/bin/stopbar deleted file mode 100755 index af24e17..0000000 --- a/scripts/linux/bin/stopbar +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# TODO: get the proper monitor! -BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')" -bspc config -m "${BAR_MONITOR}" bottom_padding "0" -bspc config -m "${BAR_MONITOR}" top_padding "0" -killall -q polybar -while pgrep -x polybar >/dev/null; do sleep 1; done