From 9809b69de58e22b5cc42f2ae9894b0bbd36783b9 Mon Sep 17 00:00:00 2001 From: joy Date: Sun, 22 Sep 2024 13:42:52 +0200 Subject: [PATCH] nix on droid --- flake.lock | 179 ++++++++++++++++++++++++++++- flake.nix | 29 +++-- hosts/phone/default.nix | 69 +++++++++++ hosts/phone/home.nix | 9 ++ hosts/phone/home/default.nix | 11 ++ hosts/phone/home/git/default.nix | 7 ++ hosts/phone/home/helix/default.nix | 15 +++ hosts/phone/home/zsh/default.nix | 30 +++++ hosts/phone/home/zsh/push.sh | 25 ++++ 9 files changed, 360 insertions(+), 14 deletions(-) create mode 100644 hosts/phone/default.nix create mode 100644 hosts/phone/home.nix create mode 100644 hosts/phone/home/default.nix create mode 100644 hosts/phone/home/git/default.nix create mode 100644 hosts/phone/home/helix/default.nix create mode 100644 hosts/phone/home/zsh/default.nix create mode 100755 hosts/phone/home/zsh/push.sh diff --git a/flake.lock b/flake.lock index 89c5953..6af447a 100644 --- a/flake.lock +++ b/flake.lock @@ -262,6 +262,27 @@ } }, "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nix-on-droid", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709445365, + "narHash": "sha256-DVv6nd9FQBbMWbOmhq0KVqmlc3y3FMSYl49UXmMcO+0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "4de84265d7ec7634a69ba75028696d74de9a44a7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_3": { "inputs": { "nixpkgs": [ "stylix", @@ -282,6 +303,55 @@ "type": "github" } }, + "nix-formatter-pack": { + "inputs": { + "nixpkgs": [ + "nix-on-droid", + "nixpkgs" + ], + "nmd": "nmd", + "nmt": "nmt" + }, + "locked": { + "lastModified": 1705252799, + "narHash": "sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c=", + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "rev": "2de39dedd79aab14c01b9e2934842051a160ffa5", + "type": "github" + }, + "original": { + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "type": "github" + } + }, + "nix-on-droid": { + "inputs": { + "home-manager": "home-manager_2", + "nix-formatter-pack": "nix-formatter-pack", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-docs": "nixpkgs-docs", + "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap", + "nmd": "nmd_2" + }, + "locked": { + "lastModified": 1720396533, + "narHash": "sha256-UFzk/hZWO1VkciIO5UPaSpJN8s765wsngUSvtJM6d5Q=", + "owner": "nix-community", + "repo": "nix-on-droid", + "rev": "f3d3b8294039f2f9a8fb7ea82c320f29c6b0fe25", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "nix-on-droid", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1725634671, @@ -298,17 +368,49 @@ "type": "github" } }, + "nixpkgs-docs": { + "locked": { + "lastModified": 1705957679, + "narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9a333eaa80901efe01df07eade2c16d183761fa3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-for-bootstrap": { + "locked": { + "lastModified": 1720244366, + "narHash": "sha256-WrDV0FPMVd2Sq9hkR5LNHudS3OSMmUrs90JUTN+MXpA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "49ee0e94463abada1de470c9c07bfc12b36dcf40", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "49ee0e94463abada1de470c9c07bfc12b36dcf40", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1726755586, "narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=", - "owner": "nixos", + "owner": "NixOS", "repo": "nixpkgs", "rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -330,15 +432,86 @@ "type": "github" } }, + "nmd": { + "flake": false, + "locked": { + "lastModified": 1666190571, + "narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=", + "owner": "rycee", + "repo": "nmd", + "rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmd", + "type": "gitlab" + } + }, + "nmd_2": { + "inputs": { + "nixpkgs": [ + "nix-on-droid", + "nixpkgs-docs" + ], + "scss-reset": "scss-reset" + }, + "locked": { + "lastModified": 1705050560, + "narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=", + "owner": "~rycee", + "repo": "nmd", + "rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3", + "type": "sourcehut" + }, + "original": { + "owner": "~rycee", + "repo": "nmd", + "type": "sourcehut" + } + }, + "nmt": { + "flake": false, + "locked": { + "lastModified": 1648075362, + "narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=", + "owner": "rycee", + "repo": "nmt", + "rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmt", + "type": "gitlab" + } + }, "root": { "inputs": { "ags": "ags", "firefox-addons": "firefox-addons", "home-manager": "home-manager", + "nix-on-droid": "nix-on-droid", "nixpkgs": "nixpkgs_2", "stylix": "stylix" } }, + "scss-reset": { + "flake": false, + "locked": { + "lastModified": 1631450058, + "narHash": "sha256-muDlZJPtXDIGevSEWkicPP0HQ6VtucbkMNygpGlBEUM=", + "owner": "andreymatin", + "repo": "scss-reset", + "rev": "0cf50e27a4e95e9bb5b1715eedf9c54dee1a5a91", + "type": "github" + }, + "original": { + "owner": "andreymatin", + "repo": "scss-reset", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -351,7 +524,7 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils_2", "gnome-shell": "gnome-shell", - "home-manager": "home-manager_2", + "home-manager": "home-manager_3", "nixpkgs": "nixpkgs_3", "systems": "systems_2" }, diff --git a/flake.nix b/flake.nix index fdcb2ad..d3a92be 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,12 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + nix-on-droid = { + url = "github:nix-community/nix-on-droid/release-24.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + ags.url = "github:Aylur/ags"; stylix.url = "github:danth/stylix"; @@ -8,30 +14,31 @@ url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; }; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { - nixpkgs, - stylix, - home-manager, - ... - } @ inputs: let - systemConfig = {modules}: + outputs = { self, nixpkgs, nix-on-droid, ags, stylix, home-manager, ... } @ inputs: let + systemConfig = { modules }: nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; + specialArgs = { inherit inputs; }; modules = modules ++ [stylix.nixosModules.stylix home-manager.nixosModules.default]; }; in { + nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration { + pkgs = import nixpkgs { system = "aarch64-linux"; }; + modules = [ .hosts/phone]; + }; + nixosConfigurations = { desktop = systemConfig { - modules = [./hosts/desktop]; + modules = [ ./hosts/desktop ]; }; laptop = systemConfig { - modules = [./hosts/laptop]; + modules = [ ./hosts/laptop ]; }; }; }; diff --git a/hosts/phone/default.nix b/hosts/phone/default.nix new file mode 100644 index 0000000..2419250 --- /dev/null +++ b/hosts/phone/default.nix @@ -0,0 +1,69 @@ +{ config, lib, pkgs, ... }: + +{ + # Simply install just the packages + environment.packages = with pkgs; [ + # User-facing stuff that you really really want to have + vim # or some other editor, e.g. nano or neovim + zsh + fish + font-awesome + fastfetch + ipfetch + ffmpeg + yt-dlp + lazygit + # toybox + unixtools.ping + cowsay + # Some common stuff that people expect to have + procps + # killall + openssh_hpn + git + diffutils + findutils + utillinux + tzdata + # hostname + man + gnugrep + gnupg + gnused + gnutar + bzip2 + gzip + xz + zip + unzip + ]; + + # Backup etc files instead of failing to activate generation if a file already exists in /etc + environment.etcBackupExtension = ".bak"; + + # Read the changelog before changing this value + system.stateVersion = "24.05"; + + # Set up nix for flakes + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + # Set your time zone + time.timeZone = "Europe/Berlin"; + + + home-manager = { + config = ./home.nix; + }; + + user.shell = "${pkgs.zsh}/bin/zsh"; + + terminal = { + colors = { + background = "#282828"; + foreground = "#fbf1c7"; + }; + }; +} + diff --git a/hosts/phone/home.nix b/hosts/phone/home.nix new file mode 100644 index 0000000..55574cc --- /dev/null +++ b/hosts/phone/home.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + home.stateVersion = "24.05"; + + imports = [ + ./home + ]; + + } diff --git a/hosts/phone/home/default.nix b/hosts/phone/home/default.nix new file mode 100644 index 0000000..90545b6 --- /dev/null +++ b/hosts/phone/home/default.nix @@ -0,0 +1,11 @@ +{ inputs, ... }: + +{ + + imports = [ + ./zsh + ./git + ./helix + ]; + +} diff --git a/hosts/phone/home/git/default.nix b/hosts/phone/home/git/default.nix new file mode 100644 index 0000000..a19923b --- /dev/null +++ b/hosts/phone/home/git/default.nix @@ -0,0 +1,7 @@ +{ ...}: { + programs.git = { + enable = true; + userEmail = "mail@joygnu.org"; + userName = "joygnu"; + }; +} diff --git a/hosts/phone/home/helix/default.nix b/hosts/phone/home/helix/default.nix new file mode 100644 index 0000000..079ddbd --- /dev/null +++ b/hosts/phone/home/helix/default.nix @@ -0,0 +1,15 @@ +{ ... }: +{ + programs.helix = { + enable = true; + defaultEditor = true; + settings = { + theme = "gruvbox"; + keys.normal = { + space.space = "file_picker"; + Z.Z = ":wq"; + Z.Q = ":q!"; + }; + }; + }; +} diff --git a/hosts/phone/home/zsh/default.nix b/hosts/phone/home/zsh/default.nix new file mode 100644 index 0000000..89bfc9f --- /dev/null +++ b/hosts/phone/home/zsh/default.nix @@ -0,0 +1,30 @@ +{ pkgs, ... } : + +{ + programs.zsh = { + enable = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + historySubstringSearch.enable = true; + dotDir = ".config/zsh"; + initExtra = "PROMPT='%F{green}%~%f '"; + + shellAliases = { + v = "hx"; + ser = "ssh root@joygnu.org"; + rb = "nix-on-droid switch --flake ~/.config/nix-on-droid"; + ep = "hx ~/.config/nix-on-droid/nix-on-droid.nix"; + }; + + history.size = 1000000; + history.path = ".config/zsh/history"; + + oh-my-zsh = { + enable = true; + plugins = [ +# "history-substring-search" + ]; + }; + + }; +} diff --git a/hosts/phone/home/zsh/push.sh b/hosts/phone/home/zsh/push.sh new file mode 100755 index 0000000..49d581c --- /dev/null +++ b/hosts/phone/home/zsh/push.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Function to push to all remotes +push_to_all_remotes() { + # Get a list of all remotes + remotes=$(git remote) + + # Check if there are no remotes + if [ -z "$remotes" ]; then + echo "No remotes found." + exit 1 + fi + + # Loop through each remote and push + for remote in $remotes; do + echo "Pushing to remote '$remote'..." + git push "$remote" --all + git push "$remote" --tags + echo "Push to remote '$remote' completed." + done +} + +# Execute the function +push_to_all_remotes +