commit 8dc73bf5fc8590cce44e32a576fd5d26cdd7e2d2 Author: deva Date: Fri Jun 28 23:40:00 2024 -0400 chore: push to github diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..9a00eda --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.direnv +.vscode +todo.md \ No newline at end of file diff --git a/disko.nix b/disko.nix new file mode 100644 index 0000000..4f0c913 --- /dev/null +++ b/disko.nix @@ -0,0 +1,93 @@ +# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko.nix +# nixos-generate-config --no-filesystems --root /mnt +# mv /tmp/disko.nix /mnt/etc/nixos +# REMOVE: https://www.youtube.com/watch?v=nLwbNhSxLd4 (Full NixOS Guide) +# REMOVE: https://www.youtube.com/watch?v=YPKwkWtK7l0 +# IMPORTANT: this disk configuration is setup for *impermanance* systems. +# to get rid of impermanance support, simply remove the "/persist" btrfs subvolume. +# to import, add this to the imports list: +# (import ./disko.nix { device = "/dev/?" }) +{device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: { + disko.devices = { + disk = { + main = { + inherit device; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + ESP = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + passwordFile = "/tmp/secret.key"; + settings = { + allowDiscards = true; + }; + content = { + type = "lvm_pv"; + vg = "root_vg"; + }; + }; + }; + swap = { + size = "35G"; + content = { + type = "swap"; + resumeDevice = true; + }; + }; + }; + }; + }; + }; + lvm_vg = { + root_vg = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%FREE"; + content = { + type = "btrfs"; + extraArgs = ["-f"]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = ["compress=zstd" "noatime"]; + }; + "/home" = { + mountpoint = "/home"; + mountOptions = ["compress=zstd" "noatime"]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = ["compress=zstd" "noatime"]; + }; + "/persist" = { + mountpoint = "/persist"; + mountOptions = ["compress=zstd" "noatime"]; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9f0d129 --- /dev/null +++ b/flake.lock @@ -0,0 +1,573 @@ +{ + "nodes": { + "base16": { + "inputs": { + "fromYaml": "fromYaml" + }, + "locked": { + "lastModified": 1708890466, + "narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "665b3c6748534eb766c777298721cece9453fdae", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "base16-fish": { + "flake": false, + "locked": { + "lastModified": 1622559957, + "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", + "owner": "tomyun", + "repo": "base16-fish", + "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", + "type": "github" + }, + "original": { + "owner": "tomyun", + "repo": "base16-fish", + "type": "github" + } + }, + "base16-foot": { + "flake": false, + "locked": { + "lastModified": 1696725948, + "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "owner": "tinted-theming", + "repo": "base16-foot", + "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-foot", + "type": "github" + } + }, + "base16-helix": { + "flake": false, + "locked": { + "lastModified": 1696727917, + "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", + "owner": "tinted-theming", + "repo": "base16-helix", + "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-helix", + "type": "github" + } + }, + "base16-kitty": { + "flake": false, + "locked": { + "lastModified": 1665001328, + "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", + "owner": "kdrag0n", + "repo": "base16-kitty", + "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", + "type": "github" + }, + "original": { + "owner": "kdrag0n", + "repo": "base16-kitty", + "type": "github" + } + }, + "base16-tmux": { + "flake": false, + "locked": { + "lastModified": 1696725902, + "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", + "owner": "tinted-theming", + "repo": "base16-tmux", + "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-tmux", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1716150083, + "narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=", + "owner": "tinted-theming", + "repo": "base16-vim", + "rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-vim", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719582740, + "narHash": "sha256-s4WsLu2L8EzF5Hg2TkelFLVhKGL108AySnlw8voPe5U=", + "owner": "nix-community", + "repo": "disko", + "rev": "115311bc395f24c1b553338fec4b3aa28cbf5ae2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "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" + } + }, + "fromYaml": { + "flake": false, + "locked": { + "lastModified": 1689549921, + "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", + "owner": "SenchoPens", + "repo": "fromYaml", + "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "fromYaml", + "type": "github" + } + }, + "gnome-shell": { + "flake": false, + "locked": { + "lastModified": 1713702291, + "narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=", + "owner": "GNOME", + "repo": "gnome-shell", + "rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934", + "type": "github" + }, + "original": { + "owner": "GNOME", + "ref": "46.1", + "repo": "gnome-shell", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719588253, + "narHash": "sha256-A03i8xiVgP14DCmV5P7VUv37eodCjY4e1iai0b2EuuM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7e68e55d2e16d3a1e92a679430728c35a30fd24e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1718450675, + "narHash": "sha256-jpsns6buS4bK+1sF8sL8AaixAiCRjA+nldTKvcwmvUs=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "66d5b46ff94efbfa6fa3d1d1b66735f1779c34a6", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs", + "systems": "systems", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1719613382, + "narHash": "sha256-DAWdnk0cCFbOZrdo9Ku0kbrlpv7pjnF+DQBnLiyuSSQ=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "9c5dd59d4b1927b7d88e8e3c2e260eb01d95794b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "xdph", + "nixpkgs" + ], + "systems": [ + "hyprland", + "xdph", + "systems" + ] + }, + "locked": { + "lastModified": 1714869498, + "narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "e06482e0e611130cd1929f75e8c1cf679e57d161", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717881852, + "narHash": "sha256-XeeVoKHQgfKuXoP6q90sUqKyl7EYy3ol2dVZGM+Jj94=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "ec6938c66253429192274d612912649a0cfe4d28", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1719316102, + "narHash": "sha256-dmRz128j/lJmMuTYeCYPfSBRHHQO3VeH4PbmoyAhHzw=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "1f6bbec5954f623ff8d68e567bddcce97cd2f085", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1719067853, + "narHash": "sha256-mAnZG/eQy72Fp1ImGtqCgUrDumnR1rMZv2E/zgP4U74=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "914f083741e694092ee60a39d31f693d0a6dc734", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, + "impermanence": { + "locked": { + "lastModified": 1719091691, + "narHash": "sha256-AxaLX5cBEcGtE02PeGsfscSb/fWMnyS7zMWBXQWDKbE=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "23c1f06316b67cb5dabdfe2973da3785cfe9c34a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "nh": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718355099, + "narHash": "sha256-o4K6QHBjXrmcYkX9MIw9gZ+DHM3OaEVswswHRX9h8Is=", + "owner": "viperML", + "repo": "nh", + "rev": "6fb30a4d490a98d08628ed93a90a9d23820ef9c8", + "type": "github" + }, + "original": { + "owner": "viperML", + "repo": "nh", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1719075281, + "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1719254875, + "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1719426051, + "narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1714912032, + "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "home-manager": "home-manager", + "hyprland": "hyprland", + "impermanence": "impermanence", + "nh": "nh", + "nixpkgs": "nixpkgs_2", + "nixpkgs-unstable": "nixpkgs-unstable", + "stylix": "stylix" + } + }, + "stylix": { + "inputs": { + "base16": "base16", + "base16-fish": "base16-fish", + "base16-foot": "base16-foot", + "base16-helix": "base16-helix", + "base16-kitty": "base16-kitty", + "base16-tmux": "base16-tmux", + "base16-vim": "base16-vim", + "flake-compat": "flake-compat", + "gnome-shell": "gnome-shell", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1719525570, + "narHash": "sha256-xSO/H67GAHEW0siD2PHoO/e97MbROL3r3s5SpF6A6Dc=", + "owner": "danth", + "repo": "stylix", + "rev": "1ff9d37d27377bfe8994c24a8d6c6c1734ffa116", + "type": "github" + }, + "original": { + "owner": "danth", + "repo": "stylix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1718619174, + "narHash": "sha256-FWW68AVYmB91ZDQnhLMBNCUUTCjb1ZpO2k2KIytHtkA=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "c7894aa54f9a7dbd16df5cd24d420c8af22d5623", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d5a6a09 --- /dev/null +++ b/flake.nix @@ -0,0 +1,106 @@ +{ + description = "nixos system configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + impermanence = { + url = "github:nix-community/impermanence"; + }; + + hyprland.url = "github:hyprwm/Hyprland"; + + nh = { + url = "github:viperML/nh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + stylix.url = "github:danth/stylix"; + }; + + outputs = { + self, + nixpkgs, + nixpkgs-unstable, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in { + # Your custom packages + # Accessible through 'nix build', 'nix shell', etc + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + + apps = forAllSystems (system: { + "clone" = { + type = "app"; + program = self.outputs.packages.${system}.clone; + }; + "disko" = { + type = "app"; + program = self.outputs.packages.${system}.disko; + }; + }); + + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + # nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + # homeManagerModules = import ./modules/home-manager; + + nixosConfigurations.waves = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + }; + modules = [ + inputs.disko.nixosModules.default + (import ./disko.nix {device = "/dev/nvme1n1";}) + {networking.hostName = "waves";} + ./os + ./waves-hardware.nix + ./user/users.nix + inputs.impermanence.nixosModules.impermanence + inputs.stylix.nixosModules.stylix + ./os/styling.nix + ]; + }; + + homeConfigurations.deva = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + ./home.nix + ./user/desktop + ./user/dev + ./user/shell/zsh.nix + ./user/services.nix + ./user/apps + ]; + }; + }; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..722fb48 --- /dev/null +++ b/home.nix @@ -0,0 +1,47 @@ +{ + config, + pkgs, + inputs, + outputs, + ... +}: { + home = { + username = "deva"; + homeDirectory = "/home/deva"; + extraOutputsToInstall = ["doc" "devdoc"]; + packages = [ + inputs.nh.packages.x86_64-linux.default + ]; + sessionVariables = { + NIX_AUTO_RUN = "1"; + FLAKE = "${config.home.homeDirectory}/nix"; + }; + }; + + nix.package = pkgs.nixVersions.latest; + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + ]; + config = { + allowUnfree = true; + }; + }; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + manual = { + html.enable = true; + json.enable = false; + manpages.enable = false; + }; + + programs.home-manager.enable = true; + programs.git.enable = true; + systemd.user.startServices = "sd-switch"; + + home.stateVersion = "24.05"; +} diff --git a/license b/license new file mode 100755 index 0000000..c9bbb7a --- /dev/null +++ b/license @@ -0,0 +1,20 @@ +zlib License + +(C) 2024 devawaves + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + diff --git a/os/btrfs-impermanence b/os/btrfs-impermanence new file mode 100644 index 0000000..f49dd5d --- /dev/null +++ b/os/btrfs-impermanence @@ -0,0 +1,22 @@ +mkdir /btrfs_tmp +mount /dev/root_vg/root /btrfs_tmp +if [[ -e /btrfs_tmp/root ]]; then +mkdir -p /btrfs_tmp/old_roots +timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") +mv /btrfs_tmp/root /btrfs_tmp/old_roots/$timestamp +fi + +delete_subvolume_recursively() { +IFS=$'\n' +for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do +delete_subvolume_recursively "/btrfs_tmp/$i" +done +btrfs subvolume delete "$1" +} + +for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do +delete_subvolume_recursively "$i" +done + +btrfs subvolume create /btrfs_tmp/root +umount /btrfs_tmp \ No newline at end of file diff --git a/os/default.nix b/os/default.nix new file mode 100644 index 0000000..14f966c --- /dev/null +++ b/os/default.nix @@ -0,0 +1,154 @@ +{ + config, + lib, + pkgs, + outputs, + inputs, + ... +}: { + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + ]; + + environment.systemPackages = with pkgs; [ + neovim + firefox + ]; + + nix = let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in { + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Opinionated: disable global registry + flake-registry = ""; + # Workaround for https://github.com/NixOS/nix/issues/9574 + nix-path = config.nix.nixPath; + }; + # Opinionated: disable channels + channel.enable = false; + + # Opinionated: make flake registry and nix path match flake inputs + registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; + }; + + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + }; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.initrd.postDeviceCommands = lib.mkAfter (builtins.readFile ./btrfs-impermanence); + + fileSystems."/persist".neededForBoot = true; + environment.persistence."/persist/system" = { + hideMounts = true; + directories = [ + "/etc/nixos" + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/etc/NetworkManager/system-connections" + { + directory = "/var/lib/colord"; + user = "colord"; + group = "colord"; + mode = "u=rwx,g=rx,o="; + } + ]; + files = [ + "/etc/machine-id" + ]; + }; + + networking.networkmanager.enable = true; + time.timeZone = "America/Indiana/Indianapolis"; + + i18n.defaultLocale = "en_US.UTF-8"; + console = { + earlySetup = true; + font = "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz"; + keyMap = lib.mkForce "us"; + useXkbConfig = true; # use xkb.options in tty. + }; + + environment.pathsToLink = ["/share/zsh"]; + + programs = { + less.enable = true; + + # default zsh config + zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + promptInit = '' + PS1='%B%1~%b %(#.#.$): ' + ''; + }; + }; + + boot.supportedFilesystems = ["ntfs"]; + + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + pulse.enable = true; + }; + + services.libinput.enable = true; + services.printing.enable = true; + + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.enable = true; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "24.05"; + + fonts = { + enableDefaultPackages = false; + fontconfig = { + enable = true; + antialias = true; + defaultFonts = { + emoji = ["Noto Color Emoji"]; + monospace = ["Cascadia Code" "Symbols Nerd Font" "Noto Color Emoji"]; + serif = ["Noto Serif" "Noto Color Emoji"]; + sansSerif = ["Overpass" "Nunito" "Noto Color Emoji"]; + }; + hinting = { + enable = true; + autohint = false; + style = "full"; + }; + subpixel = { + lcdfilter = "default"; + rgba = "rgb"; + }; + }; + fontDir = { + enable = true; + decompressFonts = true; + }; + packages = [ + pkgs.noto-fonts + pkgs.noto-fonts-emoji + + pkgs.material-design-icons + (pkgs.google-fonts.override {fonts = ["Overpass" "Nunito"];}) + (pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) + ]; + }; +} diff --git a/os/styling.nix b/os/styling.nix new file mode 100644 index 0000000..fa2e13f --- /dev/null +++ b/os/styling.nix @@ -0,0 +1,26 @@ +{pkgs, ...}: { + stylix.base16Scheme = { + # oxocarbon dark + base00 = "161616"; + base01 = "262626"; + base02 = "393939"; + base03 = "525252"; + base04 = "dde1e6"; + base05 = "f2f4f8"; + base06 = "ffffff"; + base07 = "08bdba"; + base08 = "3ddbd9"; + base09 = "78a9ff"; + base0A = "ee5396"; + base0B = "33b1ff"; + base0C = "ff7eb6"; + base0D = "42be65"; + base0E = "be95ff"; + base0F = "82cfff"; + }; + + stylix.image = ./nix-wallpaper.png; + + stylix.cursor.package = pkgs.graphite-cursors; + stylix.cursor.name = "graphite-dark"; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..b707fc9 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,28 @@ +{inputs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs final.pkgs; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + tmuxPlugins = prev.tmuxPlugins.extend (final': prev': { + tokyo-night-tmux = prev.callPackage ../pkgs/tmux-tokyo-night.nix { + prev = prev; + lib = prev.lib; + }; + }); + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/pkgs/clone.nix b/pkgs/clone.nix new file mode 100644 index 0000000..5c4db54 --- /dev/null +++ b/pkgs/clone.nix @@ -0,0 +1,5 @@ +{pkgs}: +pkgs.writeShellScriptBin "clone" '' + CLONE_LOCATION=''${1=$HOME/nix} + ${pkgs.git}/bin/git clone https://github.com/devawaves/nixos $CLONE_LOCATION +'' diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..52e7493 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,4 @@ +pkgs: { + clone = pkgs.callPackage ./clone.nix {}; + disko = pkgs.callPackage ./disko.nix {}; +} diff --git a/pkgs/disko.nix b/pkgs/disko.nix new file mode 100644 index 0000000..62da93e --- /dev/null +++ b/pkgs/disko.nix @@ -0,0 +1,4 @@ +{pkgs}: +pkgs.writeShellScriptBin "disko" '' + ${pkgs.curl}/bin/curl "https://raw.githubusercontent.com/devawaves/nixos/main/disko.nix" -o disko.nix +'' diff --git a/pkgs/tmux-tokyo-night.nix b/pkgs/tmux-tokyo-night.nix new file mode 100644 index 0000000..b1f1981 --- /dev/null +++ b/pkgs/tmux-tokyo-night.nix @@ -0,0 +1,22 @@ +# USED IN OVERLAY +{ + prev, + lib, +}: +prev.tmuxPlugins.mkTmuxPlugin { + pluginName = "tokyo-night-tmux"; + version = "c3bc283cceeefaa7e5896878fe20711f466ab591"; + src = fetchFromGithub { + owner = "janoamaral"; + repo = "tokyo-night-tmux"; + rev = "c3bc283cceeefaa7e5896878fe20711f466ab591"; + hash = "sha256-3rMYYzzSS2jaAMLjcQoKreE0oo4VWF9dZgDtABCUOtY="; + }; + rtpFilePath = "tokyo-night.tmux"; + meta = { + homepage = "https://github.com/janoamaral/tokyo-night-tmux"; + description = "tokyo night tmux theme"; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + }; +} diff --git a/readme.md b/readme.md new file mode 100755 index 0000000..7ee133f --- /dev/null +++ b/readme.md @@ -0,0 +1,29 @@ +[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org) + +

deva's nixos flake

+ +
+ +

+ License Badge +

+ +
+ +**my configuration. it changes over time like an adapting parasite.** + +to explore the flake output and it's functionalities, run: + +```sh +nix flake show github:devawaves/flake +``` + +to clone to an existing nixos system, run: +```sh +nix run github:devawaves/nixos#clone +``` + +to get the disko, run: +```sh +nix run github:devawaves/nixos#disko +``` \ No newline at end of file diff --git a/user/apps/default.nix b/user/apps/default.nix new file mode 100644 index 0000000..2783cec --- /dev/null +++ b/user/apps/default.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + nom + pinta + vesktop + signal-desktop + vesktop + blockbench + blender + prismlauncher + ]; +} diff --git a/user/apps/obs.nix b/user/apps/obs.nix new file mode 100644 index 0000000..c9e1333 --- /dev/null +++ b/user/apps/obs.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + programs.obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [ + wlrobs + ]; + }; +} diff --git a/user/desktop/default.nix b/user/desktop/default.nix new file mode 100644 index 0000000..c1c17b0 --- /dev/null +++ b/user/desktop/default.nix @@ -0,0 +1,30 @@ +{ + pkgs, + config, + ... +}: { + imports = [ + ./gnome.nix + ]; + + home.packages = [ + pkgs.noto-fonts + pkgs.noto-fonts-emoji + + pkgs.material-design-icons + (pkgs.google-fonts.override {fonts = ["Overpass" "Nunito"];}) + (pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) + ]; + + home.pointerCursor = { + package = pkgs.graphite-cursors; + name = "graphite-dark"; + size = 24; + gtk.enable = true; + x11.enable = true; + }; + home.sessionVariables = { + XCURSOR_SIZE = config.home.pointerCursor.size; + XCURSOR_THEME = config.home.pointerCursor.name; + }; +} diff --git a/user/desktop/gnome.nix b/user/desktop/gnome.nix new file mode 100644 index 0000000..07cae1c --- /dev/null +++ b/user/desktop/gnome.nix @@ -0,0 +1,124 @@ +{ + pkgs, + config, + ... +}: { + dconf = { + enable = true; + + settings = { + "org/gnome/shell" = { + disable-user-extensions = false; + + enabled-extensions = [ + "user-theme@gnome-shell-extensions.gcampax.github.com" + "unite@hardpixel.eu" + ]; + }; + + "org/gnome/shell/extensions/user-theme" = { + name = "Materia-dark"; + }; + + "org/gnome/shell/extensions/unite" = { + desktop-name-text = "Desktop"; + greyscale-tray-icons = true; + hide-activities-button = "always"; + hide-window-titlebars = "always"; + show-window-buttons = "always"; + show-window-title = "tiled"; + window-buttons-placement = "first"; + window-buttons-theme = "arc"; + }; + + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + + "org/gnome/desktop/wm/preferences" = { + resize-with-right-button = true; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + binding = "Return"; + command = "kitty"; + name = "Open Terminal"; + }; + + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + ]; + }; + + "org/gnome/desktop/background" = { + picture-uri = "file:///${./wallpaper.jpg}"; + picture-uri-dark = "file:///${./nix-wallpaper.png}"; + }; + }; + }; + + home.packages = with pkgs; [ + # Gnome extensions + gnomeExtensions.unite + gnomeExtensions.user-themes + + # Theme + materia-theme + ]; + gtk = { + enable = true; + + font = { + name = "Iosevka"; + size = 12; + }; + + iconTheme = { + name = "Zafiro-icons-Dark"; + package = pkgs.zafiro-icons; + }; + + theme = { + name = "Materia-dark"; + package = pkgs.materia-theme; + }; + + gtk2 = { + configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + extraConfig = '' + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle="hintfull" + gtk-xft-rgba="rgb" + ''; + }; + + gtk3 = { + bookmarks = [ + "file://${config.home.homeDirectory}/Documents" + "file://${config.home.homeDirectory}/Downloads" + "file://${config.home.homeDirectory}/Music" + "file://${config.home.homeDirectory}/Pictures" + "file://${config.home.homeDirectory}/Videos" + ]; + + extraConfig = { + gtk-application-prefer-dark-theme = 1; + + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintfull"; + gtk-xft-rgba = "rgb"; + }; + }; + + gtk4.extraConfig.gtk-application-prefer-dark-theme = 1; + }; + + home = { + sessionVariables = { + GTK_THEME = config.gtk.theme.name; + }; + }; +} diff --git a/user/desktop/nix-wallpaper.png b/user/desktop/nix-wallpaper.png new file mode 100755 index 0000000..abab9fd Binary files /dev/null and b/user/desktop/nix-wallpaper.png differ diff --git a/user/desktop/wallpaper.jpg b/user/desktop/wallpaper.jpg new file mode 100755 index 0000000..0e7b234 Binary files /dev/null and b/user/desktop/wallpaper.jpg differ diff --git a/user/dev/default.nix b/user/dev/default.nix new file mode 100644 index 0000000..4541574 --- /dev/null +++ b/user/dev/default.nix @@ -0,0 +1,257 @@ +{ + config, + pkgs, + ... +}: { + home.packages = with pkgs.unstable; [ + bruno + just + nil + alejandra + zoxide + neovide + nodejs + corepack + + jetbrains.idea-community + vscode + cascadia-code + ]; + + programs = { + wezterm = { + enable = true; + extraConfig = builtins.readFile ./wezterm.lua; + colorSchemes = { + oxocarbon-dark = builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub { + owner = "nyoom-engineering"; + repo = "oxocarbon-wezterm"; + rev = "b435c308403816db6fec6b87370223e8e8fbb6f4"; + hash = "sha256-KsAoWQVWBHbmimw3Z9kj9j1wnFdLquzi64WP5mEjRzo="; + } + + "/oxocarbon-dark.toml")); + }; + }; + lf = { + enable = true; + commands = { + dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"''; + editor-open = ''$$EDITOR $f''; + mkdir = '' + ''${{ + printf "Directory Name: " + read DIR + mkdir $DIR + }} + ''; + }; + keybindings = { + "\\\"" = ""; + o = ""; + c = "mkdir"; + D = ''$rm -fr "$fx"''; + "." = "set hidden!"; + "`" = "mark-load"; + "\\'" = "mark-load"; + "" = "open"; + do = "dragon-out"; + "g~" = "cd"; + gh = "cd"; + "g/" = "/"; + ee = "editor-open"; + V = ''''$${pkgs.bat}/bin/bat --paging=always --theme=gruvbox "$f"''; + }; + settings = { + preview = true; + hidden = true; + drawbox = true; + icons = true; + ignorecase = true; + }; + extraConfig = let + previewer = pkgs.writeShellScriptBin "pv.sh" '' + file=$1 + w=$2 + h=$3 + x=$4 + y=$5 + + if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then + # ${pkgs.kitty}/bin/kitty +kitten icat --silent --stdin no --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty + exit 1 + fi + + ${pkgs.pistol}/bin/pistol "$file" + ''; + cleaner = pkgs.writeShellScriptBin "clean.sh" '' + # ${pkgs.kitty}/bin/kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty + ''; + in '' + set cleaner ${cleaner}/bin/clean.sh + set previewer ${previewer}/bin/pv.sh + ''; + }; + ssh = { + enable = true; + matchBlocks = { + "hi@dessa.dev" = { + host = "gitlab.com github.com"; + identitiesOnly = true; + identityFile = [ + "~/.ssh/id_dev" + ]; + }; + "dess_key" = { + host = "192.168.1.203"; + identitiesOnly = true; + identityFile = ["~/.ssh/id_dess"]; + }; + }; + }; + gpg = { + enable = true; + homedir = "${config.home.homeDirectory}/.gnupg"; + settings = { + use-agent = true; + default-key = "CC10324DD962CB7E"; + }; + }; + git = { + enable = true; + package = pkgs.gitAndTools.gitFull; + lfs.enable = true; + + userName = "deva"; + userEmail = "hi@dessa.dev"; + signing = { + key = "CC10324DD962CB7E"; + signByDefault = true; + }; + + aliases = { + lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"; + lgb = "--no-pager log --oneline --decorate --graph --parents --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"; + nuke = "!git clean -xdf && git reset --hard && git pull"; + st = "status -sb"; + sync = "!git push && git pull"; + rs = "restore --staged"; + ll = "log --oneline"; + last = "log -1 HEAD --stat"; + cm = "commit -m"; + co = "checkout"; + rv = "remote -v"; + df = "diff HEAD"; + }; + + extraConfig = { + init.defaultBranch = "main"; + branch.autosetupmerge = "true"; + push.default = "current"; + merge.stat = "true"; + core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol"; + repack.usedeltabaseoffset = "true"; + pull.ff = "only"; + rebase = { + autoSquash = true; + autoStash = true; + }; + rerere = { + enabled = true; + autoupdate = true; + }; + }; + ignores = [ + "*~" + "*.swp" + "*result*" + ".direnv" + "todo.md" + "node_modules" + ]; + }; + gh = { + enable = true; + settings = { + editor = "nvim"; + git_protocol = "ssh"; + aliases = { + co = "pr checkout"; + rc = "repo clone"; + }; + }; + }; + tmux = { + mouse = true; + prefix = "C-Space"; + keyMode = "vi"; + baseIndex = 1; + plugins = with pkgs.tmuxPlugins; [ + vim-tmux-navigator + yank + { + plugin = mkTmuxPlugin { + pluginName = "tokyo-night-tmux"; + version = "c3bc283cceeefaa7e5896878fe20711f466ab591"; + src = fetchFromGithub { + owner = "janoamaral"; + repo = "tokyo-night-tmux"; + rev = "c3bc283cceeefaa7e5896878fe20711f466ab591"; + hash = "sha256-3rMYYzzSS2jaAMLjcQoKreE0oo4VWF9dZgDtABCUOtY="; + }; + rtpFilePath = "tokyo-night.tmux"; + meta = { + homepage = "https://github.com/janoamaral/tokyo-night-tmux"; + description = "tokyo night tmux theme"; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + }; + }; + extraConfig = '' + set -g @tokyo-night-tmux_show_datetime 0 + set -g @tokyo-night-tmux_show_path 1 + set -g @tokyo-night-tmux_path_format relative + set -g @tokyo-night-tmux_window_id_style dsquare + set -g @tokyo-night-tmux_window_id_style dsquare + set -g @tokyo-night-tmux_show_git 0 + ''; + } + ]; + extraConfig = '' + set-option -sa terminal-overrides ",xterm*:Tc" + set-window-option -g pane-base-index 1 + set-option -g renumber-windows on + + # Use Alt-arrow keys without prefix key to switch panes + bind -n M-Left select-pane -L + bind -n M-Right select-pane -R + bind -n M-Up select-pane -U + bind -n M-Down select-pane -D + + # Shift arrow to switch windows + bind -n S-Left previous-window + bind -n S-Right next-window + + # Shift Alt vim keys to switch windows + bind -n M-H previous-window + bind -n M-L next-window + + bind-key -T copy-mode-vi v send-keys -X begin-selection + bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle + bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + bind '_' split-window -v -c "#{pane_current_path}" + bind | split-window -h -c "#{pane_current_path}" + bind c new-window -c "#{pane_current_path}" + ''; + }; + }; + xdg.configFile."lf/icons".source = ./lf-icons; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + pinentryPackage = pkgs.pinentry-gnome3; + }; + home.sessionVariables = { + SSH_AUTH_SOCK = "$XDG_RUNTIME_DIR/keyring/ssh"; + }; +} diff --git a/user/dev/lf-icons b/user/dev/lf-icons new file mode 100755 index 0000000..4022691 --- /dev/null +++ b/user/dev/lf-icons @@ -0,0 +1,377 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# default values from lf (with matching order) +# ln l # LINK +# or l # ORPHAN +# tw t # STICKY_OTHER_WRITABLE +# ow d # OTHER_WRITABLE +# st t # STICKY +# di d # DIR +# pi p # FIFO +# so s # SOCK +# bd b # BLK +# cd c # CHR +# su u # SETUID +# sg g # SETGID +# ex x # EXEC +# fi - # FILE + +# file types (with matching order) +ln  # LINK +or  # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow  # OTHER_WRITABLE +st t # STICKY +di  # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex  # EXEC +fi  # FILE + +# disable some default filetype icons, let them choose icon by filename +# ln  # LINK +# or  # ORPHAN +# tw # STICKY_OTHER_WRITABLE +# ow # OTHER_WRITABLE +# st # STICKY +# di  # DIR +# pi # FIFO +# so # SOCK +# bd # BLK +# cd # CHR +# su # SETUID +# sg # SETGID +# ex # EXEC +# fi  # FILE + +# file extensions (vim-devicons) +*.styl  +*.sass  +*.scss  +*.htm  +*.html  +*.slim  +*.haml  +*.ejs  +*.css  +*.less  +*.md  +*.mdx  +*.markdown  +*.rmd  +*.json  +*.webmanifest  +*.js  +*.mjs  +*.jsx  +*.rb  +*.gemspec  +*.rake  +*.php  +*.py  +*.pyc  +*.pyo  +*.pyd  +*.coffee  +*.mustache  +*.hbs  +*.conf  +*.ini  +*.yml  +*.yaml  +*.toml  +*.bat  +*.mk  +*.jpg  +*.jpeg  +*.bmp  +*.png  +*.webp  +*.gif  +*.ico  +*.twig  +*.cpp  +*.c++  +*.cxx  +*.cc  +*.cp  +*.c  +*.cs 󰌛 +*.h  +*.hh  +*.hpp  +*.hxx  +*.hs  +*.lhs  +*.nix  +*.lua  +*.java  +*.sh  +*.fish  +*.bash  +*.zsh  +*.ksh  +*.csh  +*.awk  +*.ps1  +*.ml λ +*.mli λ +*.diff  +*.db  +*.sql  +*.dump  +*.clj  +*.cljc  +*.cljs  +*.edn  +*.scala  +*.go  +*.dart  +*.xul  +*.sln  +*.suo  +*.pl  +*.pm  +*.t  +*.rss  +'*.f#'  +*.fsscript  +*.fsx  +*.fs  +*.fsi  +*.rs  +*.rlib  +*.d  +*.erl  +*.hrl  +*.ex  +*.exs  +*.eex  +*.leex  +*.heex  +*.vim  +*.ai  +*.psd  +*.psb  +*.ts  +*.tsx  +*.jl  +*.pp  +*.vue  +*.elm  +*.swift  +*.xcplayground  +*.tex 󰙩 +*.r 󰟔 +*.rproj 󰗆 +*.sol 󰡪 +*.pem  + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee  +*gruntfile.js  +*gruntfile.ls  +*gulpfile.coffee  +*gulpfile.js  +*gulpfile.ls  +*mix.lock  +*dropbox  +*.ds_store  +*.gitconfig  +*.gitignore  +*.gitattributes  +*.gitlab-ci.yml  +*.bashrc  +*.zshrc  +*.zshenv  +*.zprofile  +*.vimrc  +*.gvimrc  +*_vimrc  +*_gvimrc  +*.bashprofile  +*favicon.ico  +*license  +*node_modules  +*react.jsx  +*procfile  +*dockerfile  +*docker-compose.yml  +*docker-compose.yaml  +*compose.yml  +*compose.yaml  +*rakefile  +*config.ru  +*gemfile  +*makefile  +*cmakelists.txt  +*robots.txt 󰚩 + +# file names (case-sensitive adaptations) +*Gruntfile.coffee  +*Gruntfile.js  +*Gruntfile.ls  +*Gulpfile.coffee  +*Gulpfile.js  +*Gulpfile.ls  +*Dropbox  +*.DS_Store  +*LICENSE  +*React.jsx  +*Procfile  +*Dockerfile  +*Docker-compose.yml  +*Docker-compose.yaml  +*Rakefile  +*Gemfile  +*Makefile  +*CMakeLists.txt  + +# file patterns (vim-devicons) (patterns not supported in lf) +# .*jquery.*\.js$  +# .*angular.*\.js$  +# .*backbone.*\.js$  +# .*require.*\.js$  +# .*materialize.*\.js$  +# .*materialize.*\.css$  +# .*mootools.*\.js$  +# .*vimrc.*  +# Vagrantfile$  + +# file patterns (file name adaptations) +*jquery.min.js  +*angular.min.js  +*backbone.min.js  +*require.min.js  +*materialize.min.js  +*materialize.min.css  +*mootools.min.js  +*vimrc  +Vagrantfile  + +# archives or compressed (extensions from dircolors defaults) +*.tar  +*.tgz  +*.arc  +*.arj  +*.taz  +*.lha  +*.lz4  +*.lzh  +*.lzma  +*.tlz  +*.txz  +*.tzo  +*.t7z  +*.zip  +*.z  +*.dz  +*.gz  +*.lrz  +*.lz  +*.lzo  +*.xz  +*.zst  +*.tzst  +*.bz2  +*.bz  +*.tbz  +*.tbz2  +*.tz  +*.deb  +*.rpm  +*.jar  +*.war  +*.ear  +*.sar  +*.rar  +*.alz  +*.ace  +*.zoo  +*.cpio  +*.7z  +*.rz  +*.cab  +*.wim  +*.swm  +*.dwm  +*.esd  + +# image formats (extensions from dircolors defaults) +*.jpg  +*.jpeg  +*.mjpg  +*.mjpeg  +*.gif  +*.bmp  +*.pbm  +*.pgm  +*.ppm  +*.tga  +*.xbm  +*.xpm  +*.tif  +*.tiff  +*.png  +*.svg  +*.svgz  +*.mng  +*.pcx  +*.mov  +*.mpg  +*.mpeg  +*.m2v  +*.mkv  +*.webm  +*.ogm  +*.mp4  +*.m4v  +*.mp4v  +*.vob  +*.qt  +*.nuv  +*.wmv  +*.asf  +*.rm  +*.rmvb  +*.flc  +*.avi  +*.fli  +*.flv  +*.gl  +*.dl  +*.xcf  +*.xwd  +*.yuv  +*.cgm  +*.emf  +*.ogv  +*.ogx  + +# audio formats (extensions from dircolors defaults) +*.aac  +*.au  +*.flac  +*.m4a  +*.mid  +*.midi  +*.mka  +*.mp3  +*.mpc  +*.ogg  +*.ra  +*.wav  +*.oga  +*.opus  +*.spx  +*.xspf  + +# other formats +*.pdf  diff --git a/user/dev/wezterm.lua b/user/dev/wezterm.lua new file mode 100644 index 0000000..624c9cb --- /dev/null +++ b/user/dev/wezterm.lua @@ -0,0 +1,26 @@ +local wezterm = require 'wezterm' + +local config = wezterm.config_builder() + +config.color_scheme = 'Oxocarbon Dark (Gogh)' +config.use_fancy_tab_bar = false +config.window_decorations = "RESIZE" +config.hide_tab_bar_if_only_one_tab = true +config.font = wezterm.font "Cascadia Code NF" + +config.set_environment_variables = { + TERM = "xterm-256color", + EDITOR = "nvim", + VISUAL = "code --wait", +} + +config.window_padding = { + left = 7, + right = 7, + top = 0, + bottom = 0, +} + +config.default_cursor_style = 'SteadyBar' + +return config \ No newline at end of file diff --git a/user/id_dev.pub b/user/id_dev.pub new file mode 100644 index 0000000..e833524 --- /dev/null +++ b/user/id_dev.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJRVqaCvz582ioiqnNELKIrGy4RkJ4IVorYlJ98iuZz hi@dessa.dev diff --git a/user/services.nix b/user/services.nix new file mode 100644 index 0000000..4f103cc --- /dev/null +++ b/user/services.nix @@ -0,0 +1,6 @@ +{ + services.gnome-keyring = { + enable = true; + components = ["secrets" "ssh"]; + }; +} diff --git a/user/shell/bash.nix b/user/shell/bash.nix new file mode 100644 index 0000000..82b44aa --- /dev/null +++ b/user/shell/bash.nix @@ -0,0 +1,112 @@ +{ + pkgs, + config, + ... +}: { + programs.bat.enable = true; + programs.eza.enable = true; + programs.man.enable = true; + + programs.wezterm.enableBashIntegration = true; + programs.fzf = { + enable = true; + enableBashIntegration = true; + }; + services.gpg-agent.enableBashIntegration = true; + programs.bash = { + enable = true; + enableCompletion = true; + # historyControl = ["erasedups" "ignorespace" "ignoredups" "ignoreboth"] + historyFile = "${config.home.homeDirectory}/.histfile"; + historyFileSize = 100000000; + shellOptions = [ + "APPEND_HISTORY" # Append to histfile instead of overwriting. + "SHARE_HISTORY" # Share history between all sessions. + "HIST_IGNORE_SPACE" # Do not record an event starting with a space. + "HIST_IGNORE_ALL_DUPS" # Delete an old recorded event if a new event is a duplicate. + "HIST_SAVE_NO_DUPS" # Do not write a duplicate event to the history file. + "HIST_IGNORE_DUPS" # Do not record an event that was just recorded again. + "HIST_FIND_NO_DUPS" # Do not display a previously found event. + "EXTENDED_HISTORY" # Write the history file in the ':start:elapsed;command' format. + "HIST_EXPIRE_DUPS_FIRST" # Expire a duplicate event first when trimming history. + + "ALWAYS_TO_END" + "ALWAYS_TO_END" + "AUTO_LIST" + "AUTO_MENU" + "AUTO_PARAM_SLASH" + "AUTO_PUSHD" + "ALWAYS_TO_END" + "COMPLETE_IN_WORD" + "EXTENDED_GLOB" + "INC_APPEND_HISTORY" + "INTERACTIVE_COMMENTS" + "MENU_COMPLETE" + "NO_BEEP" + "NOTIFY" + "PATH_DIRS" + "PUSHD_IGNORE_DUPS" + "PUSHD_SILENT" + + "-CASE_GLOB" + "-CORRECT" + "-EQUALS" + "-FLOWCONTROL" + "-NOMATCH" + ]; + initExtra = '' + eval "$(${pkgs.zoxide}/bin/zoxide init --cmd cd bash)" + eval "$(${pkgs.oh-my-posh}/bin/oh-my-posh init bash --config ${./prompt-zen.toml})" + + hash -d "dl"="$HOME/Downloads" + hash -d "docs"="$HOME/Documents" + hash -d "src"="$HOME/src" + hash -d "dots"="$HOME/nix" + hash -d "nix"="$HOME/nix" + hash -d "pics"="$HOME/Pictures" + hash -d "vids"="$HOME/Videos" + ''; + sessionVariables = { + SAVEHIST = 1000000000; + HISTDUP = "erase"; + DIRENV_LOG_FORMAT = ""; + LC_ALL = "en_US.UTF-8"; + KEYTIMEOUT = 1; + GPG_TTY = "$(tty)"; + PATH = "$PATH:$HOME/bin"; + }; + shellAliases = { + run = "nix-shell --command 'zsh' -p"; + nsh = "nix-shell --command 'zsh'"; + nd = "nix develop"; + g = "git"; + gs = "git st"; + gst = "git st"; + src = "cd $HOME/dev"; + sv0 = "ssh -l root proxmox"; + nmcs = "ssh -l kd nmcs"; + pn = "pnpm"; + rm = "rm -rf"; + cp = "cp -ri"; + mkdir = "mkdir -p"; + free = "free -m"; + j = "just"; + ed = "code"; + n = "nvim"; + cdr = "cd \$(git rev-parse --show-toplevel)"; + l = "eza -al --no-time --group-directories-first"; + ls = "eza -al --no-time --group-directories-first"; + la = "eza -a"; + ll = "eza -l --no-time --group-directories-first"; + lt = "eza -aT --no-time --group-directories-first"; + cat = "bat --theme gruvbox-dark --style numbers,changes --color=always --tabs=2 --wrap=never"; + diff = "delta"; + top = "btm"; + c = "clear"; + glg = "git lg"; + ghr = "gh repo"; + serve = "python3 -m http.server"; + ytmp3 = "yt-dlp --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --embed-thumbnail --embed-metadata --output '%(title)s.%(ext)s'"; + }; + }; +} diff --git a/user/shell/prompt-zen.toml b/user/shell/prompt-zen.toml new file mode 100755 index 0000000..6c890ea --- /dev/null +++ b/user/shell/prompt-zen.toml @@ -0,0 +1,70 @@ +#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json + +version = 2 +final_space = true +console_title_template = '{{if .Root}}(Admin){{end}} {{ .PWD }}' + +[[blocks]] + type = 'prompt' + alignment = 'left' + + # [[blocks.segments]] + # type = 'session' + # style = 'plain' + # foreground = '#BF616A' + # template = '{{ .UserName }} ' + + [[blocks.segments]] + type = 'text' + style = 'plain' + foreground = 'blue' + background = 'transparent' + template = '➜ ' + + [[blocks.segments]] + type = 'path' + style = 'plain' + foreground = '#81A1C1' + background = 'transparent' + template = '{{ path .Path .Location }} ' + + [blocks.segments.properties] + style = 'full' + + [[blocks.segments]] + type = 'git' + style = 'plain' + foreground = 'p:grey' + background = 'transparent' + template = '{{ .HEAD }}{{if or (.Working.Changed) (.Staging.Changed)}}*{{end}}{{if gt .Behind 0}}⇣{{end}}{{if gt .Ahead 0}}⇡{{end}} ' + + [blocks.segments.properties] + branch_icon = '' + commit_icon = '@' + fetch_status = true + + [[blocks.segments]] + type = 'text' + style = 'plain' + foreground = 'green' + foreground_templates = [ + "{{if gt .Code 0}}red{{end}}" + ] + background = 'transparent' + template = '{{if eq .UserName "root" }}#{{else}}~{{end}}' + +[transient_prompt] + foreground_templates = [ + "{{if gt .Code 0}}red{{end}}" + ] + foreground = 'green' + background= 'transparent' + template = '~ ' + +[secondary_prompt] + foreground = '#3c3c3c' + background = 'transparent' + template = '~> ' + +[pallete] +grey = '#6c6c6c' diff --git a/user/shell/zsh.nix b/user/shell/zsh.nix new file mode 100644 index 0000000..23c57df --- /dev/null +++ b/user/shell/zsh.nix @@ -0,0 +1,183 @@ +{ + pkgs, + config, + ... +}: { + programs.bat.enable = true; + programs.eza.enable = true; + programs.man.enable = true; + + programs.wezterm.enableZshIntegration = true; + programs.fzf = { + enable = true; + enableZshIntegration = true; + }; + services.gpg-agent.enableZshIntegration = true; + programs.zsh = { + enable = true; + dotDir = ".config/zsh"; + enableCompletion = true; + history = { + path = "${config.home.homeDirectory}/.histfile"; + save = 1000000000; + size = 100000000; + }; + initExtraBeforeCompInit = '' + # zstyle ':completion:*' menu select + zstyle ':completion:*' menu no + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} + zstyle ':completion:*:descriptions' format '[%d]' + zstyle ':completion::complete:*' gain-privileges 1 + zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath' + zstyle ':fzf-tab:complete:+__zoxide_z:*' fzf-preview 'eza -1 --color=always $realpath' + zstyle ':fzf-tab:*' switch-group '<' '>' + zstyle ':completion:*:git-checkout:*' sort false + # _comp_options+=(globdots) + ''; + initExtra = '' + setopt APPEND_HISTORY # Append to histfile instead of overwriting. + setopt SHARE_HISTORY # Share history between all sessions. + setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. + setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. + setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. + setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. + setopt HIST_FIND_NO_DUPS # Do not display a previously found event. + setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. + setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. + + # Set the directory we want to store zinit (and plugins) in + # The XDG_DATA_HOME:-$HOME... line chooses XDG_DATA_HOME if it exists, otherwise .local/share + ZINIT_HOME="''${XDG_DATA_HOME:-''${HOME}/.local/share}/zinit/zinit.git" + + # download zinit if it doesn't exist + if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" + fi + + # load zinit + source "''${ZINIT_HOME}/zinit.zsh" + + #region plugins + zinit light zsh-users/zsh-completions + autoload -U compinit && compinit + eval "$(fzf --zsh)" + zinit light Aloxaf/fzf-tab + zinit light zsh-users/zsh-syntax-highlighting + zinit light zsh-users/zsh-autosuggestions + + # snippets + zinit snippet OMZP::git + zinit snippet OMZP::sudo + zinit snippet OMZP::debian + zinit snippet OMZP::command-not-found + zinit snippet OMZP::extract + + zinit cdreplay -q + eval "$(zoxide init --cmd cd zsh)" + #endregion + + #region setopts + while read -r option; do + setopt $option + done <<-EOF + ALWAYS_TO_END + AUTO_LIST + AUTO_MENU + AUTO_PARAM_SLASH + AUTO_PUSHD + ALWAYS_TO_END + COMPLETE_IN_WORD + EXTENDED_GLOB + INC_APPEND_HISTORY + INTERACTIVE_COMMENTS + MENU_COMPLETE + NO_BEEP + NOTIFY + PATH_DIRS + PUSHD_IGNORE_DUPS + PUSHD_SILENT + EOF + while read -r option; do + unsetopt $option + done <<-EOF + CASE_GLOB + CORRECT + EQUALS + FLOWCONTROL + NOMATCH + EOF + #endregion + + # bindkey -v + # zmodload zsh/complist + # bindkey -M menuselect 'h' vi-backward-char + # bindkey -M menuselect 'k' vi-up-line-or-history + # bindkey -M menuselect 'l' vi-forward-char + # bindkey -M menuselect 'j' vi-down-line-or-history + bindkey "^a" vi-beginning-of-line + bindkey "^e" vi-end-of-line + bindkey '^p' history-search-backward + bindkey '^n' history-search-forward + bindkey '^f' autosuggest-accept + bindkey -M emacs '^[^[' sudo-command-line + bindkey -M vicmd '^[^[' sudo-command-line + bindkey -M viins '^[^[' sudo-command-line + + # prompt init + eval "$(${pkgs.oh-my-posh}/bin/oh-my-posh init zsh --config ${./prompt-zen.toml})" + ''; + dirHashes = { + dl = "${config.home.homeDirectory}/Downloads"; + docs = "${config.home.homeDirectory}/Documents"; + src = "${config.home.homeDirectory}/src"; + dots = "${config.home.homeDirectory}/nix"; + nix = "${config.home.homeDirectory}/nix"; + pics = "${config.home.homeDirectory}/Documents"; + vids = "${config.home.homeDirectory}/Documents"; + }; + sessionVariables = { + DIRENV_LOG_FORMAT = ""; + LC_ALL = "en_US.UTF-8"; + # SSH_AUTH_SOCK = "$(gpgconf --list-dirs agent-ssh-socket)"; + KEYTIMEOUT = 1; + GPG_TTY = "$(tty)"; + PATH = "$PATH:$HOME/bin"; + # FLAKE = "$HOME/sysconf/nix"; + }; + shellAliases = { + run = "nix-shell --command 'zsh' -p"; + nsh = "nix-shell --command 'zsh'"; + nd = "nix develop"; + g = "git"; + gs = "git st"; + gst = "git st"; + src = "cd $HOME/dev"; + sv0 = "ssh -l root proxmox"; + nmcs = "ssh -l kd nmcs"; + pn = "pnpm"; + rm = "rm -rf"; + cp = "cp -ri"; + mkdir = "mkdir -p"; + free = "free -m"; + j = "just"; + ed = "code"; + n = "nvim"; + cdr = "cd \$(git rev-parse --show-toplevel)"; + l = "eza -al --no-time --group-directories-first"; + ls = "eza -al --no-time --group-directories-first"; + la = "eza -a"; + ll = "eza -l --no-time --group-directories-first"; + lt = "eza -aT --no-time --group-directories-first"; + cat = "bat --theme gruvbox-dark --style numbers,changes --color=always --tabs=2 --wrap=never"; + diff = "delta"; + top = "btm"; + c = "clear"; + glg = "git lg"; + ghr = "gh repo"; + serve = "python3 -m http.server"; + ytmp3 = "yt-dlp --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --embed-thumbnail --embed-metadata --output '%(title)s.%(ext)s'"; + }; + }; +} diff --git a/user/shell/zshrc b/user/shell/zshrc new file mode 100755 index 0000000..5b16214 --- /dev/null +++ b/user/shell/zshrc @@ -0,0 +1,167 @@ +# Created by newuser for 5.9 +HISTFILE=~/.histfile +HISTSIZE=100000000 +SAVEHIST=1000000000 +HISTDUP=erase + +setopt APPEND_HISTORY # Append to histfile instead of overwriting. +setopt SHARE_HISTORY # Share history between all sessions. +setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. +setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. +setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. +setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. +setopt HIST_FIND_NO_DUPS # Do not display a previously found event. +setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. +setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. + +# Set the directory we want to store zinit (and plugins) in +# The XDG_DATA_HOME:-$HOME... line chooses XDG_DATA_HOME if it exists, otherwise .local/share +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" + +# download zinit if it doesn't exist +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +fi + +# load zinit +source "${ZINIT_HOME}/zinit.zsh" + +#region plugins +zinit light zsh-users/zsh-completions +autoload -U compinit && compinit +eval "$(fzf --zsh)" +zinit light Aloxaf/fzf-tab +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-autosuggestions + +# snippets +zinit snippet OMZP::git +zinit snippet OMZP::sudo +zinit snippet OMZP::debian +zinit snippet OMZP::command-not-found +zinit snippet OMZP::extract + +zinit cdreplay -q +eval "$(zoxide init --cmd cd zsh)" +#endregion + +#region setopts +while read -r option; do + setopt $option +done <<-EOF +ALWAYS_TO_END +AUTO_LIST +AUTO_MENU +AUTO_PARAM_SLASH +AUTO_PUSHD +ALWAYS_TO_END +COMPLETE_IN_WORD +EXTENDED_GLOB +INC_APPEND_HISTORY +INTERACTIVE_COMMENTS +MENU_COMPLETE +NO_BEEP +NOTIFY +PATH_DIRS +PUSHD_IGNORE_DUPS +PUSHD_SILENT +EOF +while read -r option; do + unsetopt $option +done <<-EOF +CASE_GLOB +CORRECT +EQUALS +FLOWCONTROL +NOMATCH +EOF +#endregion + +# bindkey -v +# zmodload zsh/complist +# bindkey -M menuselect 'h' vi-backward-char +# bindkey -M menuselect 'k' vi-up-line-or-history +# bindkey -M menuselect 'l' vi-forward-char +# bindkey -M menuselect 'j' vi-down-line-or-history +bindkey "^a" vi-beginning-of-line +bindkey "^e" vi-end-of-line +bindkey '^p' history-search-backward +bindkey '^n' history-search-forward +bindkey '^f' autosuggest-accept +bindkey -M emacs '^[^[' sudo-command-line +bindkey -M vicmd '^[^[' sudo-command-line +bindkey -M viins '^[^[' sudo-command-line + +# zstyle ':completion:*' menu select +zstyle ':completion:*' menu no +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*:descriptions' format '[%d]' +zstyle ':completion::complete:*' gain-privileges 1 +zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath' +zstyle ':fzf-tab:complete:+__zoxide_z:*' fzf-preview 'eza -1 --color=always $realpath' +zstyle ':fzf-tab:*' switch-group '<' '>' +zstyle ':completion:*:git-checkout:*' sort false +# _comp_options+=(globdots) + +# prompt init +eval "$(oh-my-posh init zsh --config ~/.config/omp/zen.toml)" + +#region dirHashes +hash -d "dl"="$HOME/Downloads" +hash -d "docs"="$HOME/Documents" +hash -d "dev"="$HOME/dev" +hash -d "dots"="$HOME/sysconf" +hash -d "pics"="$HOME/Pictures" +hash -d "vids"="$HOME/Videos" +#endregion + +#region env +export DIRENV_LOG_FORMAT="" +export LC_ALL="en_US.UTF-8" +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +export KEYTIMEOUT=1 +export GPG_TTY=$(tty) +export PATH="$PATH:$HOME/bin" +export FLAKE="$HOME/sysconf/nix" +#endregion + +#region aliases +alias run="nix-shell --command 'zsh' -p" +alias nsh="nix-shell --command 'zsh'" +alias nd="nix develop" +alias g="git" +alias gs="git st" +alias gst="git st" + +alias src="cd $HOME/dev" +alias sv0="ssh -l root proxmox" +alias nmcs="ssh -l kd nmcs" + +alias pn="pnpm" + +alias rm="rm -rf" +alias cp="cp -ri" +alias mkdir="mkdir -p" +alias free="free -m" +alias j="just" +alias ed="code" +alias n="nvim" +alias cdr="cd \$(git rev-parse --show-toplevel)" + +alias l="eza -al --no-time --group-directories-first" +alias ls="eza -al --no-time --group-directories-first" +alias la="eza -a" +alias ll="eza -l --no-time --group-directories-first" +alias lt="eza -aT --no-time --group-directories-first" + +alias cat="bat --theme gruvbox-dark --style numbers,changes --color=always --tabs=2 --wrap=never" +alias diff="delta" +alias top="btm" +alias c="clear" +alias glg="git lg" +alias ghr="gh repo" +alias serve="python3 -m http.server" +alias ytmp3="yt-dlp --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --embed-thumbnail --embed-metadata --output '%(title)s.%(ext)s'" +#endregion diff --git a/user/users.nix b/user/users.nix new file mode 100644 index 0000000..f1498db --- /dev/null +++ b/user/users.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: { + users.users.deva = { + isNormalUser = true; + shell = pkgs.zsh; + description = "Deva Waves"; + initialPassword = "12345"; + extraGroups = ["wheel" "networkmanager" "audio" "docker" "input" "libvirtd" "plugdev" "video" "adbusers"]; + + openssh.authorizedKeys.keys = [ + (builtins.readFile ./id_dev.pub) + ]; + }; + + users.users.root = { + shell = pkgs.zsh; + openssh.authorizedKeys.keys = [ + (builtins.readFile ./id_dev.pub) + ]; + }; +} diff --git a/waves-hardware.nix b/waves-hardware.nix new file mode 100644 index 0000000..a34f08d --- /dev/null +++ b/waves-hardware.nix @@ -0,0 +1,30 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usbhid" "uas" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = ["dm-snapshot"]; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp58s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}