From 8ab482fe86044becc08166fff88d8591d5bea6f2 Mon Sep 17 00:00:00 2001 From: rasmus-kirk Date: Tue, 8 Oct 2024 08:47:14 +0200 Subject: [PATCH] laptop changes --- configurations/home-manager/work/home.nix | 37 +++++++++++++++++++++++ flake.lock | 30 +++++++++--------- modules/home-manager/git/default.nix | 1 + modules/home-manager/helix/default.nix | 2 +- modules/home-manager/scripts/default.nix | 15 ++++++++- modules/home-manager/zsh/default.nix | 3 ++ 6 files changed, 71 insertions(+), 17 deletions(-) diff --git a/configurations/home-manager/work/home.nix b/configurations/home-manager/work/home.nix index 66184f6..a6f4517 100644 --- a/configurations/home-manager/work/home.nix +++ b/configurations/home-manager/work/home.nix @@ -148,6 +148,31 @@ in { }; }; + xdg.desktopEntries = with pkgs.lib; { + zathura = { + name = "Zathura"; + exec = "${getExe pkgs.zathura} %U"; + #mimeType = [ "application/pdf" ]; + }; + yazi = { + name = "Yazi"; + exec = "${getExe pkgs.foot} ${getExe pkgs.yazi} %u"; + mimeType = [ "inode/directory" ]; + }; + }; + + xdg.mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = [ "zathura.desktop" ]; + "inode/directory" = [ "yazi.desktop" ]; + "x-scheme-handler/about" = [ "librewolf.desktop" ]; + "x-scheme-handler/http" = [ "librewolf.desktop" ]; + "x-scheme-handler/https" = [ "librewolf.desktop" ]; + "x-scheme-handler/unknown" = [ "librewolf.desktop" ]; + }; + }; + programs.zsh.profileExtra = '' export PATH=$PATH:~/.cargo/bin:~/.local/bin @@ -198,5 +223,17 @@ in { # Misc Terminal Tools wl-clipboard yt-dlp + + (pkgs.writeShellApplication { + name = "concordium-test-smart-contracts"; + text = '' + CONCORDIUM_STD_PATH="$HOME/desktop/concordium/concordium-rust-smart-contracts/concordium-std" + CARGO_CONCORDIUM_PATH="$HOME/desktop/concordium/concordium-smart-contract-tools/cargo-concordium/Cargo.toml" + + pushd "$CONCORDIUM_STD_PATH" + cargo run --manifest-path "$CARGO_CONCORDIUM_PATH" -- concordium test --only-unit-tests -- --features internal-wasm-test + popd + ''; + }) ]; } diff --git a/flake.lock b/flake.lock index f1301a7..31b9a19 100644 --- a/flake.lock +++ b/flake.lock @@ -207,11 +207,11 @@ ] }, "locked": { - "lastModified": 1726308872, - "narHash": "sha256-d4vwO5N4RsLnCY7k5tY9xbdYDWQsY3RDMeUoIa4ms2A=", + "lastModified": 1727383923, + "narHash": "sha256-4/vacp3CwdGoPf8U4e/N8OsGYtO09WTcQK5FqYfJbKs=", "owner": "nix-community", "repo": "home-manager", - "rev": "6c1a461a444e6ccb3f3e42bb627b510c3a722a57", + "rev": "ffe2d07e771580a005e675108212597e5b367d2d", "type": "github" }, "original": { @@ -249,11 +249,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1725885300, - "narHash": "sha256-5RLEnou1/GJQl+Wd+Bxaj7QY7FFQ9wjnFq1VNEaxTmc=", + "lastModified": 1727540359, + "narHash": "sha256-U+225h1kJZpWb23+RaX1sBkqC4fA7aa7eBbgiQ5HcO4=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "166dee4f88a7e3ba1b7a243edb1aca822f00680e", + "rev": "fb08bde00c20252b892a3e57fb094eb62b65ba61", "type": "github" }, "original": { @@ -265,11 +265,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726062873, - "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=", + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", "type": "github" }, "original": { @@ -281,11 +281,11 @@ }, "nixpkgs-2405": { "locked": { - "lastModified": 1726447378, - "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "lastModified": 1727397532, + "narHash": "sha256-pojbL/qteElw/nIXlN8kmHn/w6PQbEHr7Iz+WOXs0EM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "rev": "f65141456289e81ea0d5a05af8898333cab5c53d", "type": "github" }, "original": { @@ -396,11 +396,11 @@ ] }, "locked": { - "lastModified": 1726734507, - "narHash": "sha256-VUH5O5AcOSxb0uL/m34dDkxFKP6WLQ6y4I1B4+N3L2w=", + "lastModified": 1727431250, + "narHash": "sha256-uGRlRT47ecicF9iLD1G3g43jn2e+b5KaMptb59LHnvM=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "ee41a466c2255a3abe6bc50fc6be927cdee57a9f", + "rev": "879b29ae9a0378904fbbefe0dadaed43c8905754", "type": "github" }, "original": { diff --git a/modules/home-manager/git/default.nix b/modules/home-manager/git/default.nix index 056cf4e..79c757d 100644 --- a/modules/home-manager/git/default.nix +++ b/modules/home-manager/git/default.nix @@ -62,6 +62,7 @@ in { su = "status -uno"; }; extraConfig = { + init.defaultBranch = "main"; push = { autoSetupRemote = true; }; diff --git a/modules/home-manager/helix/default.nix b/modules/home-manager/helix/default.nix index 7d50ae4..2fd85bf 100644 --- a/modules/home-manager/helix/default.nix +++ b/modules/home-manager/helix/default.nix @@ -29,7 +29,7 @@ with lib; let # Nix nil # Rust - rust-analyzer-unwrapped + #rust-analyzer-unwrapped # Scala metals # Makdown diff --git a/modules/home-manager/scripts/default.nix b/modules/home-manager/scripts/default.nix index 78064c4..3dce625 100644 --- a/modules/home-manager/scripts/default.nix +++ b/modules/home-manager/scripts/default.nix @@ -74,6 +74,13 @@ with lib; let name = "updap"; runtimeInputs = with pkgs; [rsync]; text = '' + set +e + + if [ "$EUID" -ne 0 ]; then + echo "Please run as root" + exit + fi + if [[ $# -ne 1 ]]; then echo "Error: Script takes one argument, the path to the audio directory" exit 0 @@ -128,6 +135,11 @@ with lib; let text = '' set +e + if [ "$EUID" -ne 0 ]; then + echo "Please run as root" + exit + fi + if [[ $# -ne 1 ]]; then echo "Error: Script takes one argument, the path to the book directory" exit 0 @@ -169,7 +181,8 @@ with lib; let driveSize=$(lsblk --output LABEL,SIZE | grep "$driveLabel" | grep -Po "[^ \t]*$") && echo "$driveUsedSize/$driveSize" && - echo "" + echo "" || + echo "Error: Something went wrong!" else echo "Error: Kobo not detected!" fi diff --git a/modules/home-manager/zsh/default.nix b/modules/home-manager/zsh/default.nix index e9bb3d1..2f27c0b 100644 --- a/modules/home-manager/zsh/default.nix +++ b/modules/home-manager/zsh/default.nix @@ -32,6 +32,9 @@ in { alias rustfmt="cargo +nightly-2023-04-01-x86_64-unknown-linux-gnu fmt" alias todo="$EDITOR ~/.local/share/todo.md" alias g="git" + # Fuck ghostscript! + alias gs="git status" + # TODO: this is bad, generalize... alias t="foot /dev/null zsh &"